Skip to content

Commit

Permalink
py39 > numpy1
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-jansen committed Sep 26, 2024
1 parent 13d06e2 commit 8f5beba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
type: string
description: 'Version tag'
required: true
default: '3.1.0'
default: '3.1'

jobs:
build_wheels:
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ license = { file = "LICENSE" }

requires-python = '>=3.9'
dependencies = [
"numpy>=1.23.5, <2; python_version<'3.10'",
"numpy>=1.23.5; python_version<'3.12'",
"numpy>=1.26.0; python_version>='3.12'",
"pandas >=1.3.0,<3.0",
Expand Down Expand Up @@ -77,7 +78,8 @@ requires = [
'wheel>=0.36.0',
'Cython>=0.29.21',
# 'Cython>=3',
"numpy>=2.0.0rc1",
'numpy>=2.0.0rc1 ; python_version>"3.9"',
'numpy<2.0 ; python_version<="3.9"'
# 'oldest-supported-numpy; python_version>="3.9"',
]
build-backend = 'setuptools.build_meta'
Expand All @@ -95,7 +97,8 @@ test = [
'matplotlib >=1.5.3',
'responses >=0.9.0',
'pandas-datareader >=0.2.1',
'click <8.1.0',
# 'click <8.1.0',
'click',
'coverage',
'pytest-rerunfailures',
]
Expand Down
7 changes: 5 additions & 2 deletions src/zipline/examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@

NUMPY2 = Version(numpy.__version__) >= Version("2.0.0")
if not NUMPY2:
import talib
try:
import talib
except ImportError:
talib = None


# These are used by test_examples.py to discover the examples to run.
def load_example_modules():
example_modules = {}
for f in os.listdir(os.path.dirname(__file__)):
if NUMPY2 and f == "dual_ema_talib.py":
if (NUMPY2 or talib is None) and f == "dual_ema_talib.py":
continue
if not f.endswith(".py") or f == "__init__.py" or f == "buyapple_ide.py":
continue
Expand Down
11 changes: 7 additions & 4 deletions tests/pipeline/test_technical.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@
import pytest
import re

# talib is not yet compatible with numpy 2.0
# talib is not yet compatible with numpy 2.0, and also now optional.
NUMPY2 = Version(np.__version__) >= Version("2.0.0")
if not NUMPY2:
import talib
try:
import talib
except ImportError:
talib = None


class BollingerBandsTestCase(BaseUSEquityPipelineTestCase):
Expand Down Expand Up @@ -79,7 +82,7 @@ def expected_bbands(self, window_length, k, closes):
mask_last_sid={True, False},
__fail_fast=True,
)
@pytest.mark.skipif(NUMPY2, reason="requires numpy 1.0")
@pytest.mark.skipif(NUMPY2 or talib is None, reason="requires numpy 1.0")
def test_bollinger_bands(self, window_length, k, mask_last_sid):
closes = self.closes(mask_last_sid=mask_last_sid)
mask = ~np.isnan(closes)
Expand Down Expand Up @@ -199,7 +202,7 @@ def test_fso_expected_basic(self):
range(5),
],
)
@pytest.mark.skipif(NUMPY2, reason="requires numpy 1.0")
@pytest.mark.skipif(NUMPY2 or talib is None, reason="requires numpy 1.0")
def test_fso_expected_with_talib(self, seed):
"""
Test the output that is returned from the fast stochastic oscillator
Expand Down

0 comments on commit 8f5beba

Please sign in to comment.