diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index d6969a9c2e..dd091641ef 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -13,7 +13,7 @@ on: type: string description: 'Version tag' required: true - default: '3.1.0' + default: '3.1' jobs: build_wheels: diff --git a/pyproject.toml b/pyproject.toml index 8418f5310f..e72afcdd5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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' @@ -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', ] diff --git a/src/zipline/examples/__init__.py b/src/zipline/examples/__init__.py index e474acd74f..255c30bfbf 100644 --- a/src/zipline/examples/__init__.py +++ b/src/zipline/examples/__init__.py @@ -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 diff --git a/tests/pipeline/test_technical.py b/tests/pipeline/test_technical.py index 3ed5fd9d96..b1a9d37525 100644 --- a/tests/pipeline/test_technical.py +++ b/tests/pipeline/test_technical.py @@ -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): @@ -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) @@ -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