Skip to content

Commit

Permalink
Test on Python 3.12 - but only on NumPy 2 due to cbgen version constr…
Browse files Browse the repository at this point in the history
…aints

Update flake8

Fix flake8 errors

Don't run pre-commit for NumPy 2 tests

Try installing latest bio2zarr at end

Replace pkg_resources with importlib.metadata
  • Loading branch information
tomwhite committed Oct 11, 2024
1 parent 8402fb3 commit 9078798
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-numpy-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions requirements-numpy2-dev.txt
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions requirements-numpy2.txt
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions sgkit/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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__ = [
Expand Down
2 changes: 1 addition & 1 deletion sgkit/tests/test_stats_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
]

Expand Down
4 changes: 2 additions & 2 deletions validation/gwas/method/regenie/hail_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
}
Expand Down

0 comments on commit 9078798

Please sign in to comment.