Skip to content

Commit

Permalink
start np20 update
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-jansen committed Sep 24, 2024
1 parent e945ae1 commit 44e4b1a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
15 changes: 10 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [

license = { file = "LICENSE" }

requires-python = '>=3.8'
requires-python = '>=3.9'
dependencies = [
'alembic >=0.7.7',
'bcolz-zipline >=1.2.6',
Expand All @@ -46,7 +46,7 @@ dependencies = [
'multipledispatch >=0.6.0',
'networkx >=2.0',
'numexpr >=2.6.1',
'numpy >=1.14.5,<2.0.0',
'numpy >=1.14.5',
'pandas >=1.3',
'patsy >=0.4.0',
'python-dateutil >=2.4.2',
Expand Down Expand Up @@ -75,7 +75,8 @@ requires = [
'wheel>=0.36.0',
'Cython>=0.29.21',
# 'Cython>=3',
'oldest-supported-numpy; python_version>="3.8"',
'numpy>=2.1.0rc1'
# 'oldest-supported-numpy; python_version>="3.9"',
]
build-backend = 'setuptools.build_meta'

Expand Down Expand Up @@ -105,6 +106,7 @@ dev = [
'pre-commit >=2.12.1',
# 'Cython>=0.29.21,<3',
'Cython>=0.29.21',
'ruff'
]
docs = [
'Cython',
Expand All @@ -114,7 +116,6 @@ docs = [
'pydata-sphinx-theme',
'sphinx_markdown_tables',
'm2r2'

]

[project.scripts]
Expand Down Expand Up @@ -161,7 +162,7 @@ test-skip = ["*"]

[tool.black]
line-length = 88
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py39', 'py310', 'py311', 'py312']
exclude = '''
(
asv_bench/env
Expand All @@ -175,6 +176,10 @@ exclude = '''
)
'''

[tool.ruff.lint]
select = ["NPY201"]


[tool.tox]
legacy_tox_ini = """
[tox]
Expand Down
3 changes: 2 additions & 1 deletion src/zipline/lib/quantiles.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""
Algorithms for computing quantiles on numpy arrays.
"""
from numpy.lib import apply_along_axis
# from numpy.lib import apply_along_axis
from numpy import apply_along_axis
from pandas import qcut


Expand Down
5 changes: 3 additions & 2 deletions src/zipline/pipeline/factors/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
full,
isnan,
log,
NINF,
# NINF,
sqrt,
sum as np_sum,
unique,
errstate as np_errstate,
)
import numpy as np

from zipline.pipeline.data import EquityPricing
from zipline.utils.input_validation import expect_types
Expand Down Expand Up @@ -157,7 +158,7 @@ class MaxDrawdown(SingleInputMixin, CustomFactor):

def compute(self, today, assets, out, data):
drawdowns = fmax.accumulate(data, axis=0) - data
drawdowns[isnan(drawdowns)] = NINF
drawdowns[isnan(drawdowns)] = -np.inf
drawdown_ends = nanargmax(drawdowns, axis=0)

# TODO: Accelerate this loop in Cython or Numba.
Expand Down

0 comments on commit 44e4b1a

Please sign in to comment.