Skip to content

Commit f1b2be0

Browse files
authored
Merge pull request #4 from rachis-org/pypi-rachis
MAINT: update to Rachis and add nox matrix
2 parents 6a4e6ec + ccb39c0 commit f1b2be0

8 files changed

Lines changed: 239 additions & 67 deletions

File tree

.github/workflows/ci-cron.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "ci-cron"
2+
3+
on:
4+
schedule:
5+
# At 01:05 AM UTC, every 3 days, starting on day of the month
6+
- cron: '05 01 1/3 * *'
7+
workflow_dispatch: {}
8+
9+
jobs:
10+
setup-matrix:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
session: ${{ steps.set-matrix.outputs.session }}
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: astral-sh/setup-uv@v7
17+
- id: set-matrix
18+
shell: bash
19+
run: echo session=$(uv run --only-dev nox -k 'test' --json -l | jq -c '[.[].session]') | tee --append $GITHUB_OUTPUT
20+
21+
tests:
22+
name: "${{ matrix.session }} [${{ matrix.os }}]"
23+
needs: [setup-matrix]
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
session: ${{ fromJson(needs.setup-matrix.outputs.session) }}
28+
os: ['macos-latest', 'macos-15-intel', 'ubuntu-latest']
29+
runs-on: ${{ matrix.os }}
30+
steps:
31+
- uses: actions/checkout@v6
32+
with:
33+
fetch-depth: 0
34+
fetch-tags: true
35+
- uses: astral-sh/setup-uv@v7
36+
- run: uv run nox -s "${{ matrix.session }}"

.github/workflows/ci-dev.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: ci-dev
2+
on:
3+
pull_request:
4+
branches: ["main"]
5+
push:
6+
branches: ["main"]
7+
8+
jobs:
9+
setup-matrix:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
tests: ${{ steps.set-matrix.outputs.tests }}
13+
misc: ${{ steps.set-matrix.outputs.misc }}
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: astral-sh/setup-uv@v7
17+
- id: set-matrix
18+
shell: bash
19+
run: |
20+
echo tests=$(uv run --only-dev nox -t pr-matrix --json -l | jq -c '[.[].session]') | tee --append $GITHUB_OUTPUT
21+
echo misc=$(uv run --only-dev nox -t pr --json -l | jq -c '[.[].session]') | tee --append $GITHUB_OUTPUT
22+
23+
misc:
24+
name: "${{ matrix.session }}"
25+
needs: [setup-matrix]
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
session: ${{ fromJson(needs.setup-matrix.outputs.misc) }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v6
33+
- uses: astral-sh/setup-uv@v7
34+
- run: uv run nox -s "${{ matrix.session }}"
35+
36+
tests:
37+
name: "${{ matrix.session }} [${{ matrix.os }}]"
38+
needs: [setup-matrix]
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
session: ${{ fromJson(needs.setup-matrix.outputs.tests) }}
43+
os: ['macos-latest', 'ubuntu-latest']
44+
runs-on: ${{ matrix.os }}
45+
steps:
46+
- uses: actions/checkout@v6
47+
with:
48+
fetch-depth: 0
49+
fetch-tags: true
50+
- uses: astral-sh/setup-uv@v7
51+
- run: TMPDIR=$RUNNER_TEMP uv run nox -s "${{ matrix.session }}"

.github/workflows/ci.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.github/workflows/pypi-publish.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: pypi-publish
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
build:
8+
name: Build Package
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
13+
14+
- name: Checkout release
15+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v.6.0.2
16+
with:
17+
fetch-depth: 0
18+
fetch-tags: true
19+
20+
- name: Build package
21+
run: uv build
22+
23+
- name: Store dist/*
24+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
25+
with:
26+
name: dist
27+
path: dist
28+
29+
test:
30+
needs: [build]
31+
name: Test Wheels
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os: ['macos-latest', 'ubuntu-latest']
36+
runs-on: ${{ matrix.os }}
37+
steps:
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
40+
41+
- name: Fetch dist/*
42+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
43+
with:
44+
name: dist
45+
path: dist
46+
47+
- name: Test package
48+
run: uv run --isolated --no-project --with dist/*.whl artifinder --help
49+
50+
pypi:
51+
needs: [build, test]
52+
name: Publish to PyPI
53+
runs-on: ubuntu-latest
54+
# Environment and permissions for trusted publishing via PyPI
55+
environment:
56+
name: pypi
57+
permissions:
58+
id-token: write
59+
contents: read
60+
steps:
61+
- name: Install uv
62+
uses: astral-sh/setup-uv@61cb8a9741eeb8a550a1b8544337180c0fc8476b # v7.2.0
63+
64+
- name: Fetch dist/*
65+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
66+
with:
67+
name: dist
68+
path: dist
69+
70+
- name: Publish
71+
run: uv publish

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ This can be useful when:
1313
If you have an existing `rachis` deployment, such as QIIME 2 2025.10, or MOSHPIT 2025.10, you can activate that environment and then install `artifinder` as follows:
1414

1515
```shell
16-
pip install git+https://github.com/gregcaporaso/artifinder.git@main
16+
pip install --no-deps artifinder
1717
```
1818

19-
If you don't have an existing deployment, you can install the tiny distribution with artifinder as follows:
19+
If you don't have an existing deployment, you can install via PyPI as follows:
2020

2121
```shell
22-
conda env create -n artifinder --file https://raw.githubusercontent.com/gregcaporaso/artifinder/refs/heads/main/environment-files/artifinder-dev.yml
22+
pip install artifinder
2323
```
2424

2525
## Basic usage

noxfile.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env -S uv run --script
2+
3+
# /// script
4+
# dependencies = ["nox>=2025.11.12"]
5+
# ///
6+
7+
import nox
8+
9+
# Tags:
10+
# test-min - for local testing of min deps
11+
# test-max - for local testing of max deps
12+
# pr - for pull-requests
13+
# pr-matrix - for pull-requests, will us OS matrix
14+
15+
16+
# [*((python-version, uv-resolution), [*tags])]
17+
MATRIX = [
18+
(("3.10", "lowest-direct"), ["test-min", "pr-matrix"]),
19+
(("3.10", "highest"), []),
20+
(("3.11", "highest"), []),
21+
(("3.12", "highest"), ["pr-matrix"]),
22+
(("3.13", "highest"), []),
23+
(("3.14", "highest"), ["test-max", "pr-matrix"]),
24+
]
25+
26+
27+
def setup_uv(session: nox.Session, resolution="highest") -> None:
28+
"""
29+
IMPORTANT: make sure to set `venv_backend="uv"` on @nox.session().
30+
"""
31+
session.run_install(
32+
"uv",
33+
"sync",
34+
f"--resolution={resolution}",
35+
f"--python={session.virtualenv.location}",
36+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
37+
)
38+
39+
40+
@nox.session(venv_backend="uv", tags=["pr", "lint"])
41+
def lint(session: nox.Session) -> None:
42+
"""
43+
Run the linters
44+
"""
45+
setup_uv(session)
46+
session.run("ruff", "check", *session.posargs)
47+
48+
49+
@nox.session(venv_backend="uv")
50+
@nox.parametrize(
51+
"python,resolution",
52+
[x[0] for x in MATRIX],
53+
ids=['py' + ':'.join(x[0]) for x in MATRIX],
54+
tags=[x[1] for x in MATRIX],
55+
)
56+
def test(session: nox.Session, resolution) -> None:
57+
"""
58+
Run the tests (can use `-t test-min` or `-t test-max` to filter)
59+
"""
60+
setup_uv(session, resolution)
61+
session.run("pytest", *session.posargs, '-v')

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ classifiers = [
2424
license = "BSD-3-Clause"
2525
license-files = ["LICENSE"]
2626
dependencies = [
27-
"click",
28-
"qiime2"
27+
"click>=8.1.8",
28+
"rachis"
29+
]
30+
31+
[dependency-groups]
32+
dev = [
33+
"nox>=2026.2.9",
34+
"pytest>=9.0.2",
35+
"ruff>=0.15.2",
2936
]
3037

3138
[project.scripts]
@@ -40,7 +47,7 @@ Issues = "https://github.com/gregcaporaso/artifinder/issues"
4047

4148
[tool.versioningit.vcs]
4249
method = "git-archive"
43-
describe-subst = "$Format:%(describe)$"
50+
describe-subst = "$Format:%(describe:tags)$"
4451
default-tag = "0.0.1"
4552

4653
[tool.versioningit.next-version]

src/artifinder/_util.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
import click
44

5-
from qiime2.sdk.result import Result
6-
from qiime2.core.archive.provenance_lib import ProvDAG
5+
try:
6+
from rachis.sdk.result import Result
7+
from rachis.core.archive.provenance_lib import ProvDAG
8+
except ModuleNotFoundError:
9+
from qiime2.sdk.result import Result
10+
from qiime2.core.archive.provenance_lib import ProvDAG
11+
712

813
from ._version import __version__ as artifinder_version
914

0 commit comments

Comments
 (0)