diff --git a/.github/workflows/build-numpy-2.yml b/.github/workflows/build-numpy-2.yml index 0374905b8..4e1c14890 100644 --- a/.github/workflows/build-numpy-2.yml +++ b/.github/workflows/build-numpy-2.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v2 @@ -22,11 +22,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt -r requirements-dev.txt + pip install -r requirements-numpy2.txt -r requirements-numpy2-dev.txt # update bio2zarr for NumPy 2, see https://github.com/sgkit-dev/bio2zarr/issues/256 pip install -U 'numpy<2.1' -U git+https://github.com/sgkit-dev/bio2zarr.git - - name: Run pre-commit - uses: pre-commit/action@v2.0.0 + # - name: Run pre-commit + # uses: pre-commit/action@v2.0.0 - name: Test with pytest (numba jit disabled) env: NUMBA_DISABLE_JIT: 1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index db0311976..9db4e02e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: black language_version: python3 - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 + rev: 6.1.0 hooks: - id: flake8 language_version: python3 diff --git a/requirements-numpy2-dev.txt b/requirements-numpy2-dev.txt new file mode 100644 index 000000000..275c7d538 --- /dev/null +++ b/requirements-numpy2-dev.txt @@ -0,0 +1,23 @@ +callee +pre-commit +pytest +pytest-cov +pytest-datadir +pytest-mock +hypothesis +scikit-allel +statsmodels +msprime>=1.0 +scikit-learn +partd +bed-reader +rechunker +cbgen > 1.0.5; platform_system != "Windows" +cbgen == 1.0.1; platform_system == "Windows" +yarl +matplotlib +asv +networkx +aiohttp +requests +graphviz diff --git a/requirements-numpy2.txt b/requirements-numpy2.txt new file mode 100644 index 000000000..491e63fb8 --- /dev/null +++ b/requirements-numpy2.txt @@ -0,0 +1,12 @@ +numpy < 2.1 +xarray +dask[array] >= 2023.01.0, <= 2024.8.0 +distributed >= 2023.01.0, <= 2024.8.0 +dask-ml +scipy +typing-extensions +numba +zarr >= 2.10.0, != 2.11.0, != 2.11.1, != 2.11.2, < 3 +fsspec != 2021.6.* +scikit-learn +pandas diff --git a/setup.cfg b/setup.cfg index 77bf3cd73..8bacbf5f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,6 +19,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Scientific/Engineering [options] diff --git a/sgkit/__init__.py b/sgkit/__init__.py index dbe5832a9..3a82272ac 100644 --- a/sgkit/__init__.py +++ b/sgkit/__init__.py @@ -1,4 +1,4 @@ -from pkg_resources import DistributionNotFound, get_distribution # type: ignore[import] +from importlib.metadata import PackageNotFoundError, version # type: ignore[import] from .display import display_genotypes, display_pedigree from .distance.api import pairwise_distance @@ -68,8 +68,8 @@ ) try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: # pragma: no cover + __version__ = version(__name__) +except PackageNotFoundError: # pragma: no cover __version__ = "unknown" __all__ = [ diff --git a/sgkit/tests/test_stats_utils.py b/sgkit/tests/test_stats_utils.py index 965a350a0..d26b10ccb 100644 --- a/sgkit/tests/test_stats_utils.py +++ b/sgkit/tests/test_stats_utils.py @@ -107,7 +107,7 @@ def sample_dataset(draw): # Split first dimension assignment into two groups and assign second # dimension with unique names since n cols will differ dims = [ - (f"dim-0-{i%2}",) if i < n_1d else (f"dim-0-{i%2}", f"dim-1-{i}") + (f"dim-0-{i % 2}",) if i < n_1d else (f"dim-0-{i % 2}", f"dim-1-{i}") for i in range(n_arrs) ] diff --git a/validation/gwas/method/regenie/hail_sim.py b/validation/gwas/method/regenie/hail_sim.py index 181825a87..0c8c5bd4e 100755 --- a/validation/gwas/method/regenie/hail_sim.py +++ b/validation/gwas/method/regenie/hail_sim.py @@ -49,8 +49,8 @@ def get_plink_sim_dataset(n_variants=16, n_samples=4, n_contigs=2, seed=0): for s in range(n_samples): data.append( { - "v": f"{c+1}:{v+1}:A:C", - "s": f"S{s+1:07d}", + "v": f"{c + 1}:{v + 1}:A:C", + "s": f"S{s + 1:07d}", "cm": 0.1, "GT": hl.Call([rs.randint(0, 2), rs.randint(0, 2)]), }