Skip to content

Commit 55801f7

Browse files
Merge pull request #173 from jeromekelleher/more-platforms
Platform and distribution CI
2 parents 0bbb709 + 21461e9 commit 55801f7

File tree

6 files changed

+50
-8
lines changed

6 files changed

+50
-8
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,19 @@ jobs:
1717
- uses: pre-commit/[email protected]
1818
test:
1919
name: Test
20-
runs-on: ubuntu-latest
20+
runs-on: ${{ matrix.os }}
2121
strategy:
2222
matrix:
23+
# Use macos-13 because pip binary packages for ARM aren't
24+
# available for many dependencies
25+
os: [macos-13, ubuntu-latest]
2326
python-version: ["3.9", "3.10", "3.11"]
27+
exclude:
28+
# Just run macos tests on one Python version
29+
- os: macos-13
30+
python-version: "3.9"
31+
- os: macos-13
32+
python-version: "3.10"
2433
steps:
2534
- uses: actions/checkout@v4
2635
- name: Set up Python ${{ matrix.python-version }}
@@ -32,3 +41,30 @@ jobs:
3241
python -m pip install --upgrade pip
3342
python -m pip install '.[dev]'
3443
- run: pytest
44+
45+
packaging:
46+
name: Packaging
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: actions/setup-python@v5
51+
with:
52+
python-version: '3.11'
53+
- name: Install dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
python -m pip install build twine validate-pyproject[all]
57+
- name: Check and install package
58+
run: |
59+
validate-pyproject pyproject.toml
60+
python -m build
61+
python -m twine check --strict dist/*
62+
python -m pip install dist/*.whl
63+
- name: Check vcf2zarr CLI
64+
run: |
65+
vcf2zarr --help
66+
python -m bio2zarr vcf2zarr --help
67+
- name: Check vcfpartition CLI
68+
run: |
69+
vcfpartition --help
70+
python -m bio2zarr vcfpartition --help

bio2zarr/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def bio2zarr():
1616
# up in the right way.
1717
bio2zarr.add_command(cli.vcf2zarr)
1818
bio2zarr.add_command(cli.plink2zarr)
19-
bio2zarr.add_command(cli.vcf_partition)
19+
bio2zarr.add_command(cli.vcfpartition)
2020

2121
if __name__ == "__main__":
2222
bio2zarr()

bio2zarr/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def plink2zarr():
529529
@click.option("-i", "--index", type=click.Path(), default=None)
530530
@click.option("-n", "--num-parts", type=int, default=None)
531531
# @click.option("-s", "--part-size", type=int, default=None)
532-
def vcf_partition(vcf_path, index, num_parts):
532+
def vcfpartition(vcf_path, index, num_parts):
533533
indexed_vcf = vcf_utils.IndexedVcf(vcf_path, index)
534534
regions = indexed_vcf.partition_into_regions(num_parts=num_parts)
535535
click.echo("\n".join(map(str, regions)))

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ requires-python = ">=3.9"
2626
classifiers = [
2727
"Development Status :: 3 - Alpha",
2828
"License :: OSI Approved :: Apache Software License",
29-
"Operating System :: OS Independent",
29+
"Operating System :: POSIX",
30+
"Operating System :: POSIX :: Linux",
31+
"Operating System :: MacOS",
32+
"Operating System :: MacOS :: MacOS X",
3033
"Intended Audience :: Science/Research",
3134
"Programming Language :: Python",
3235
"Programming Language :: Python :: 3",
@@ -43,8 +46,7 @@ documentation = "https://sgkit-dev.github.io/bio2zarr/intro.html"
4346

4447
[project.scripts]
4548
vcf2zarr = "bio2zarr.cli:vcf2zarr"
46-
plink2zarr = "bio2zarr.cli:plink2zarr"
47-
vcf_partition = "bio2zarr.cli:vcf_partition"
49+
vcfpartition = "bio2zarr.cli:vcfpartition"
4850

4951
[project.optional-dependencies]
5052
dev = [

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def test_num_parts(self):
611611

612612
runner = ct.CliRunner(mix_stderr=False)
613613
result = runner.invoke(
614-
cli.vcf_partition, [path, "-n", "5"], catch_exceptions=False
614+
cli.vcfpartition, [path, "-n", "5"], catch_exceptions=False
615615
)
616616
assert list(result.stdout.splitlines()) == [
617617
"20:60001-278528",
@@ -623,7 +623,7 @@ def test_num_parts(self):
623623

624624

625625
@pytest.mark.parametrize(
626-
"cmd", [main.bio2zarr, cli.vcf2zarr, cli.plink2zarr, cli.vcf_partition]
626+
"cmd", [main.bio2zarr, cli.vcf2zarr, cli.plink2zarr, cli.vcfpartition]
627627
)
628628
def test_version(cmd):
629629
runner = ct.CliRunner(mix_stderr=False)

tests/test_core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
import numpy as np
24
import pytest
35
import zarr
@@ -54,6 +56,7 @@ def test_bad_min_max(self, min_value, max_value):
5456
core.min_int_dtype(min_value, max_value)
5557

5658

59+
@pytest.mark.skipif(sys.platform == "darwin", reason="Issue #75")
5760
class TestParallelWorkManager:
5861
@pytest.mark.parametrize("total", [1, 10, 2**63])
5962
@pytest.mark.parametrize("workers", [0, 1])
@@ -181,6 +184,7 @@ def test_5_chunk_1(self, n, expected):
181184
assert result == expected
182185

183186

187+
@pytest.mark.skipif(sys.platform != "linux", reason="Only valid on Linux")
184188
@pytest.mark.parametrize(
185189
("path", "expected"),
186190
[

0 commit comments

Comments
 (0)