Skip to content

Commit

Permalink
Merge pull request #173 from jeromekelleher/more-platforms
Browse files Browse the repository at this point in the history
Platform and distribution CI
  • Loading branch information
jeromekelleher authored May 2, 2024
2 parents 0bbb709 + 21461e9 commit 55801f7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 8 deletions.
38 changes: 37 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ jobs:
- uses: pre-commit/[email protected]
test:
name: Test
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Use macos-13 because pip binary packages for ARM aren't
# available for many dependencies
os: [macos-13, ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
exclude:
# Just run macos tests on one Python version
- os: macos-13
python-version: "3.9"
- os: macos-13
python-version: "3.10"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -32,3 +41,30 @@ jobs:
python -m pip install --upgrade pip
python -m pip install '.[dev]'
- run: pytest

packaging:
name: Packaging
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build twine validate-pyproject[all]
- name: Check and install package
run: |
validate-pyproject pyproject.toml
python -m build
python -m twine check --strict dist/*
python -m pip install dist/*.whl
- name: Check vcf2zarr CLI
run: |
vcf2zarr --help
python -m bio2zarr vcf2zarr --help
- name: Check vcfpartition CLI
run: |
vcfpartition --help
python -m bio2zarr vcfpartition --help
2 changes: 1 addition & 1 deletion bio2zarr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def bio2zarr():
# up in the right way.
bio2zarr.add_command(cli.vcf2zarr)
bio2zarr.add_command(cli.plink2zarr)
bio2zarr.add_command(cli.vcf_partition)
bio2zarr.add_command(cli.vcfpartition)

if __name__ == "__main__":
bio2zarr()
2 changes: 1 addition & 1 deletion bio2zarr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def plink2zarr():
@click.option("-i", "--index", type=click.Path(), default=None)
@click.option("-n", "--num-parts", type=int, default=None)
# @click.option("-s", "--part-size", type=int, default=None)
def vcf_partition(vcf_path, index, num_parts):
def vcfpartition(vcf_path, index, num_parts):
indexed_vcf = vcf_utils.IndexedVcf(vcf_path, index)
regions = indexed_vcf.partition_into_regions(num_parts=num_parts)
click.echo("\n".join(map(str, regions)))
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ requires-python = ">=3.9"
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
"Operating System :: MacOS :: MacOS X",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
Expand All @@ -43,8 +46,7 @@ documentation = "https://sgkit-dev.github.io/bio2zarr/intro.html"

[project.scripts]
vcf2zarr = "bio2zarr.cli:vcf2zarr"
plink2zarr = "bio2zarr.cli:plink2zarr"
vcf_partition = "bio2zarr.cli:vcf_partition"
vcfpartition = "bio2zarr.cli:vcfpartition"

[project.optional-dependencies]
dev = [
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def test_num_parts(self):

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


@pytest.mark.parametrize(
"cmd", [main.bio2zarr, cli.vcf2zarr, cli.plink2zarr, cli.vcf_partition]
"cmd", [main.bio2zarr, cli.vcf2zarr, cli.plink2zarr, cli.vcfpartition]
)
def test_version(cmd):
runner = ct.CliRunner(mix_stderr=False)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import sys

import numpy as np
import pytest
import zarr
Expand Down Expand Up @@ -54,6 +56,7 @@ def test_bad_min_max(self, min_value, max_value):
core.min_int_dtype(min_value, max_value)


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


@pytest.mark.skipif(sys.platform != "linux", reason="Only valid on Linux")
@pytest.mark.parametrize(
("path", "expected"),
[
Expand Down

0 comments on commit 55801f7

Please sign in to comment.