From 9bfd61afc717d674efea55ef0ddb24b4fc0f993b Mon Sep 17 00:00:00 2001 From: Felipe Date: Tue, 26 Mar 2024 15:36:51 -0700 Subject: [PATCH] Add py12 support --- .github/workflows/end_to_end.yml | 2 +- .github/workflows/minimum.yml | 2 +- .github/workflows/numerical.yml | 2 +- .github/workflows/readme.yml | 2 +- .github/workflows/tutorials.yml | 2 +- .github/workflows/unit.yml | 2 +- pyproject.toml | 17 ++++++++++------- tests/unit/bivariate/test_base.py | 4 ++-- tests/unit/multivariate/test_gaussian.py | 12 ++++++++---- tox.ini | 2 +- 10 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/end_to_end.yml b/.github/workflows/end_to_end.yml index f9f539db..418e5e97 100644 --- a/.github/workflows/end_to_end.yml +++ b/.github/workflows/end_to_end.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/minimum.yml b/.github/workflows/minimum.yml index e56b5a5e..832e7f08 100644 --- a/.github/workflows/minimum.yml +++ b/.github/workflows/minimum.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/numerical.yml b/.github/workflows/numerical.yml index 5c86bcb5..52d0f881 100644 --- a/.github/workflows/numerical.yml +++ b/.github/workflows/numerical.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/readme.yml b/.github/workflows/readme.yml index 4d76f2da..8be604ab 100644 --- a/.github/workflows/readme.yml +++ b/.github/workflows/readme.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest] steps: - uses: actions/checkout@v1 diff --git a/.github/workflows/tutorials.yml b/.github/workflows/tutorials.yml index 9673a618..a59f58a7 100644 --- a/.github/workflows/tutorials.yml +++ b/.github/workflows/tutorials.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v1 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index b3c73a50..34c35314 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v1 diff --git a/pyproject.toml b/pyproject.toml index ac4adb2b..e721a80c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,22 +12,24 @@ classifiers = [ 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Scientific/Engineering :: Artificial Intelligence', ] keywords = [ 'copulas' ] dynamic = ["version"] license = { text = 'BSL-1.1' } -requires-python = '>=3.8,<3.12' +requires-python = '>=3.8,<3.13' readme = 'README.md' dependencies = [ - "numpy>=1.20.0,<2;python_version<'3.10'", - "numpy>=1.23.3,<2;python_version>='3.10'", + "numpy>=1.23.3,<2;python_version>='3.10' and python_version<'3.12'", + "numpy>=1.26.0,<2;python_version>='3.12'", "pandas>=1.1.3;python_version<'3.10'", "pandas>=1.3.4;python_version>='3.10' and python_version<'3.11'", "pandas>=1.5.0;python_version>='3.11'", 'plotly>=5.10.0,<6', "scipy>=1.5.4,<2;python_version<'3.10'", - "scipy>=1.9.2,<2;python_version>='3.10'", + "scipy>=1.9.2,<2;python_version>='3.10' and python_version<'3.12'", + "scipy>=1.12.0,<2;python_version>='3.12'", ] [project.urls] @@ -47,14 +49,14 @@ version = {attr = 'copulas.__version__'} [project.optional-dependencies] tutorials = [ 'markupsafe<=2.0.1', - 'scikit-learn>=0.24,<1.2', + 'scikit-learn>=0.24,', 'jupyter>=1.0.0,<2', ] test = [ 'copulas[tutorials]', 'pytest>=6.2.5,<7', 'pytest-cov>=2.6.0,<3', - 'pytest-rerunfailures>=9.0.0,<10', + 'pytest-rerunfailures>=10.3,<15', 'rundoc>=0.4.3,<0.5', 'tomli>=2.0.0,<3', ] @@ -65,7 +67,8 @@ dev = [ 'pip>=9.0.1', 'build>=1.0.0,<2', 'bump-my-version>=0.18.3,<1', - 'watchdog>=0.8.3,<0.11', + 'watchdog>=1.0.1,<5', + 'pyzmq>=25.1.2', # docs 'm2r>=0.2.0,<0.3', diff --git a/tests/unit/bivariate/test_base.py b/tests/unit/bivariate/test_base.py index e8513897..ac399c67 100644 --- a/tests/unit/bivariate/test_base.py +++ b/tests/unit/bivariate/test_base.py @@ -80,7 +80,7 @@ def test_save(self, json_mock, open_mock): instance.save('test.json') # Check - assert open_mock.called_once_with('test.json', 'w') + open_mock.assert_called_once_with('test.json', 'w') assert json_mock.called compare_nested_dicts(json_mock.call_args[0][0], expected_content) @@ -99,7 +99,7 @@ def test_load_from_file(self, json_mock, open_mock): instance = Bivariate.load('somefile.json') # Check - assert open_mock.called_once_with('test.json', 'r') + open_mock.assert_called_once_with('somefile.json') instance.copula_type == CopulaTypes.FRANK instance.tau == -0.33333333333333337 instance.theta == -3.305771759329249 diff --git a/tests/unit/multivariate/test_gaussian.py b/tests/unit/multivariate/test_gaussian.py index 2e7060b5..7c31e774 100644 --- a/tests/unit/multivariate/test_gaussian.py +++ b/tests/unit/multivariate/test_gaussian.py @@ -392,11 +392,15 @@ def test_sample(self, normal_mock): # Check assert result.equals(expected_result) - assert normal_mock.called_once_with( - np.zeros(instance.correlation.shape[0]), - instance.correlation, - 5 + np.testing.assert_array_equal( + normal_mock.call_args[0][0], + np.zeros(instance.correlation.shape[0]) ) + np.testing.assert_array_equal( + normal_mock.call_args[0][1], + instance.correlation + ) + assert normal_mock.call_args[1] == {'size': 5} def test_sample_random_state(self): """When random_state is set the samples are the same.""" diff --git a/tox.ini b/tox.ini index baaff459..633abe92 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py39-lint, py3{8,9,10,11}-{readme,unit,end_to_end,numerical,minimum,tutorials} +envlist = py39-lint, py3{8,9,10,11,12}-{readme,unit,end_to_end,numerical,minimum,tutorials} [testenv] skipsdist = false