Skip to content

Commit d442b17

Browse files
committed
Test on Python 3.12 - but only on NumPy 2 due to cbgen version constraints
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
1 parent 8402fb3 commit d442b17

File tree

7 files changed

+46
-11
lines changed

7 files changed

+46
-11
lines changed

.github/workflows/build-numpy-2.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: ["3.10", "3.11"]
14+
python-version: ["3.10", "3.11", "3.12"]
1515

1616
steps:
1717
- uses: actions/checkout@v2
@@ -22,11 +22,11 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install -r requirements.txt -r requirements-dev.txt
25+
pip install -r requirements-numpy2.txt -r requirements-numpy2-dev.txt
2626
# update bio2zarr for NumPy 2, see https://github.com/sgkit-dev/bio2zarr/issues/256
2727
pip install -U 'numpy<2.1' -U git+https://github.com/sgkit-dev/bio2zarr.git
28-
- name: Run pre-commit
29-
uses: pre-commit/action@v2.0.0
28+
# - name: Run pre-commit
29+
# uses: pre-commit/action@v2.0.0
3030
- name: Test with pytest (numba jit disabled)
3131
env:
3232
NUMBA_DISABLE_JIT: 1

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: black
1818
language_version: python3
1919
- repo: https://github.com/pycqa/flake8
20-
rev: 6.0.0
20+
rev: 6.1.0
2121
hooks:
2222
- id: flake8
2323
language_version: python3

requirements-numpy2-dev.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
callee
2+
pre-commit
3+
pytest
4+
pytest-cov
5+
pytest-datadir
6+
pytest-mock
7+
hypothesis
8+
scikit-allel
9+
statsmodels
10+
msprime>=1.0
11+
scikit-learn
12+
partd
13+
bed-reader
14+
rechunker
15+
cbgen > 1.0.5; platform_system != "Windows"
16+
cbgen == 1.0.1; platform_system == "Windows"
17+
yarl
18+
matplotlib
19+
asv
20+
networkx
21+
aiohttp
22+
requests
23+
graphviz

requirements-numpy2.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
numpy < 2.1
2+
xarray
3+
dask[array] >= 2023.01.0, <= 2024.8.0
4+
distributed >= 2023.01.0, <= 2024.8.0
5+
dask-ml
6+
scipy
7+
typing-extensions
8+
numba
9+
zarr >= 2.10.0, != 2.11.0, != 2.11.1, != 2.11.2, < 3
10+
fsspec != 2021.6.*
11+
scikit-learn
12+
pandas

sgkit/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pkg_resources import DistributionNotFound, get_distribution # type: ignore[import]
1+
from importlib.metadata import PackageNotFoundError, version # type: ignore[import]
22

33
from .display import display_genotypes, display_pedigree
44
from .distance.api import pairwise_distance
@@ -68,8 +68,8 @@
6868
)
6969

7070
try:
71-
__version__ = get_distribution(__name__).version
72-
except DistributionNotFound: # pragma: no cover
71+
__version__ = version(__name__)
72+
except PackageNotFoundError: # pragma: no cover
7373
__version__ = "unknown"
7474

7575
__all__ = [

sgkit/tests/test_stats_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def sample_dataset(draw):
107107
# Split first dimension assignment into two groups and assign second
108108
# dimension with unique names since n cols will differ
109109
dims = [
110-
(f"dim-0-{i%2}",) if i < n_1d else (f"dim-0-{i%2}", f"dim-1-{i}")
110+
(f"dim-0-{i % 2}",) if i < n_1d else (f"dim-0-{i % 2}", f"dim-1-{i}")
111111
for i in range(n_arrs)
112112
]
113113

validation/gwas/method/regenie/hail_sim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def get_plink_sim_dataset(n_variants=16, n_samples=4, n_contigs=2, seed=0):
4949
for s in range(n_samples):
5050
data.append(
5151
{
52-
"v": f"{c+1}:{v+1}:A:C",
53-
"s": f"S{s+1:07d}",
52+
"v": f"{c + 1}:{v + 1}:A:C",
53+
"s": f"S{s + 1:07d}",
5454
"cm": 0.1,
5555
"GT": hl.Call([rs.randint(0, 2), rs.randint(0, 2)]),
5656
}

0 commit comments

Comments
 (0)