Skip to content

Commit 6d4c703

Browse files
committed
Drop Python 3.9
1 parent 6708eb1 commit 6d4c703

File tree

8 files changed

+66
-88
lines changed

8 files changed

+66
-88
lines changed

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- uses: actions/checkout@v4
2020
- uses: actions/setup-python@v5
2121
with:
22-
python-version: '3.9'
22+
python-version: '3.10'
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
# Use macos-13 because pip binary packages for ARM aren't
2626
# available for many dependencies
2727
os: [macos-13, macos-14, ubuntu-latest]
28-
python-version: ["3.9", "3.10", "3.11", "3.12"]
28+
python-version: ["3.10", "3.11", "3.12"]
2929
exclude:
3030
# Just run macos tests on one Python version
3131
- os: macos-13
@@ -34,8 +34,6 @@ jobs:
3434
python-version: "3.11"
3535
- os: macos-13
3636
python-version: "3.12"
37-
- os: macos-14
38-
python-version: "3.9"
3937
- os: macos-14
4038
python-version: "3.10"
4139
- os: macos-14

bio2zarr/core.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
import multiprocessing
88
import os
99
import os.path
10-
import sys
1110
import threading
1211
import time
13-
import warnings
1412

1513
import humanfriendly
1614
import numcodecs
@@ -256,22 +254,6 @@ def setup_progress_counter(counter):
256254
_progress_counter = counter
257255

258256

259-
def warn_py39_mac():
260-
if sys.platform == "darwin" and sys.version_info[:2] == (3, 9):
261-
warnings.warn(
262-
"There is a known issue with bio2zarr on MacOS Python 3.9 "
263-
"in which OS-level named semaphores are leaked. "
264-
"You will also probably see warnings like 'There appear to be N "
265-
"leaked semaphore objects at shutdown'. "
266-
"While this is likely harmless for a few runs, it could lead to "
267-
"issues if you do a lot of conversion. To get prevent this issue "
268-
"either: (1) use --worker-processes=0 or (2) upgrade to a newer "
269-
"Python version. See https://github.com/sgkit-dev/bio2zarr/issues/209 "
270-
"for more details.",
271-
stacklevel=2,
272-
)
273-
274-
275257
class ParallelWorkManager(contextlib.AbstractContextManager):
276258
def __init__(self, worker_processes=1, progress_config=None):
277259
# Need to specify this explicitly to suppport Macs and
@@ -284,7 +266,6 @@ def __init__(self, worker_processes=1, progress_config=None):
284266
# production. See note on the SynchronousExecutor class.
285267
self.executor = SynchronousExecutor()
286268
else:
287-
warn_py39_mac()
288269
self.executor = cf.ProcessPoolExecutor(
289270
max_workers=worker_processes,
290271
mp_context=ctx,

bio2zarr/typing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from pathlib import Path
2-
from typing import Union
32

4-
PathType = Union[str, Path]
3+
PathType = str | Path

bio2zarr/vcf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,8 @@ def chunks(self, partition_id, start_chunk=0):
638638
chunk_cumulative_records = self.chunk_record_index(partition_id)
639639
chunk_num_records = np.diff(chunk_cumulative_records)
640640
for count, cumulative in zip(
641-
chunk_num_records[start_chunk:], chunk_cumulative_records[start_chunk + 1 :]
641+
chunk_num_records[start_chunk:],
642+
chunk_cumulative_records[start_chunk + 1 :],
642643
):
643644
path = partition_path / f"{cumulative}"
644645
chunk = self.read_chunk(path)

bio2zarr/vcf_utils.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections.abc import Sequence
88
from dataclasses import dataclass
99
from enum import Enum
10-
from typing import IO, Any, Optional, Union
10+
from typing import IO, Any
1111

1212
import cyvcf2
1313
import humanfriendly
@@ -33,7 +33,7 @@ def get_file_offset(vfp: int) -> int:
3333
return vfp >> 16 & address_mask
3434

3535

36-
def read_bytes_as_value(f: IO[Any], fmt: str, nodata: Optional[Any] = None) -> Any:
36+
def read_bytes_as_value(f: IO[Any], fmt: str, nodata: Any | None = None) -> Any:
3737
"""Read bytes using a `struct` format string and return the unpacked data value.
3838
3939
Parameters
@@ -85,8 +85,8 @@ class Region:
8585
"""
8686

8787
contig: str
88-
start: Optional[int] = None
89-
end: Optional[int] = None
88+
start: int | None = None
89+
end: int | None = None
9090

9191
def __post_init__(self):
9292
assert self.contig is not None
@@ -197,9 +197,7 @@ def get_first_locus_in_bin(csi: CSIIndex, bin: int) -> int:
197197
return (bin - first_bin_on_level) * (max_span // level_size) + 1
198198

199199

200-
def read_csi(
201-
file: PathType, storage_options: Optional[dict[str, str]] = None
202-
) -> CSIIndex:
200+
def read_csi(file: PathType, storage_options: dict[str, str] | None = None) -> CSIIndex:
203201
"""Parse a CSI file into a `CSIIndex` object.
204202
205203
Parameters
@@ -314,7 +312,7 @@ def offsets(self) -> Any:
314312

315313

316314
def read_tabix(
317-
file: PathType, storage_options: Optional[dict[str, str]] = None
315+
file: PathType, storage_options: dict[str, str] | None = None
318316
) -> TabixIndex:
319317
"""Parse a tabix file into a `TabixIndex` object.
320318
@@ -512,8 +510,8 @@ def _filter_empty_and_refine(self, regions):
512510

513511
def partition_into_regions(
514512
self,
515-
num_parts: Optional[int] = None,
516-
target_part_size: Union[None, int, str] = None,
513+
num_parts: int | None = None,
514+
target_part_size: None | int | str = None,
517515
):
518516
if num_parts is None and target_part_size is None:
519517
raise ValueError("One of num_parts or target_part_size must be specified")

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dependencies = [
2626
"cyvcf2",
2727
"bed_reader",
2828
]
29-
requires-python = ">=3.9"
29+
requires-python = ">=3.10"
3030
classifiers = [
3131
"Development Status :: 4 - Beta",
3232
"License :: OSI Approved :: Apache Software License",
@@ -37,7 +37,6 @@ classifiers = [
3737
"Intended Audience :: Science/Research",
3838
"Programming Language :: Python",
3939
"Programming Language :: Python :: 3",
40-
"Programming Language :: Python :: 3.9",
4140
"Programming Language :: Python :: 3.10",
4241
"Programming Language :: Python :: 3.11",
4342
"Programming Language :: Python :: 3.12",
@@ -55,6 +54,7 @@ vcfpartition = "bio2zarr.cli:vcfpartition"
5554

5655
[project.optional-dependencies]
5756
dev = [
57+
"click>=8.2.0",
5858
"hypothesis-vcf",
5959
"msprime",
6060
"pysam",
@@ -76,8 +76,8 @@ testpaths = "tests"
7676
addopts = "--cov=bio2zarr --cov-report term-missing"
7777

7878
[tool.ruff]
79-
# Assume Python 3.9
80-
target-version = "py39"
79+
# Assume Python 3.10
80+
target-version = "py310"
8181

8282
# Same as Black.
8383
line-length = 88
@@ -86,7 +86,8 @@ indent-width = 4
8686
[tool.ruff.lint]
8787
select = ["E", "F", "B", "W", "I", "N", "UP", "A", "PT"]
8888
#Allow uppercase names for e.g. call_AD
89-
ignore = ["N806", "N802", "A001", "A002", "RUF"]
89+
#Don't add strict=False to zips (B905)
90+
ignore = ["N806", "N802", "A001", "A002", "B905", "RUF"]
9091

9192
fixable = ["ALL"]
9293
unfixable = []

0 commit comments

Comments
 (0)