Skip to content

Commit b1aff28

Browse files
chore: use Pixi for improved CI/CD and update project configuration (#82)
Co-authored-by: Johannes Köster <[email protected]>
1 parent 00b4326 commit b1aff28

File tree

6 files changed

+119
-111
lines changed

6 files changed

+119
-111
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/release-please.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,27 @@ jobs:
1717
release-type: python
1818
package-name: snakemake-interface-executor-plugins
1919

20-
publish:
20+
publish-pypi:
2121
runs-on: ubuntu-latest
2222
needs: release-please
2323
if: ${{ needs.release-please.outputs.release_created }}
24-
steps:
25-
- uses: actions/checkout@v3
26-
27-
- uses: actions/setup-python@v2
28-
with:
29-
python-version: "3.11"
3024

31-
- name: Install poetry
32-
run: pip install poetry
33-
34-
- name: Determine dependencies
35-
run: poetry lock
25+
steps:
26+
- uses: actions/checkout@v4
3627

37-
- uses: actions/setup-python@v4
28+
- name: Install Pixi
29+
uses: prefix-dev/[email protected]
3830
with:
39-
python-version: "3.11"
40-
cache: poetry
31+
environments: publish
32+
pixi-version: v0.42.1
4133

42-
- name: Install Dependencies using Poetry
34+
- name: Build source and wheel distribution + check build
35+
# this will build the source and wheel into the dist/ directory
4336
run: |
44-
poetry install
37+
pixi run --environment publish check-build
4538
46-
- name: Publish to PyPi
39+
- name: Publish distribution to PyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1
4741
env:
4842
PYPI_USERNAME: __token__
4943
PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }}
50-
run: poetry publish --build --username $PYPI_USERNAME --password $PYPI_PASSWORD

.github/workflows/test.yml

Lines changed: 33 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,52 @@ on:
77
pull_request:
88
branches-ignore: []
99

10+
permissions:
11+
contents: read
12+
checks: write
13+
issues: write
14+
pull-requests: write
15+
1016
jobs:
11-
formatting:
17+
quality-control:
1218
runs-on: ubuntu-latest
1319
steps:
1420
- name: Check out the code
15-
uses: actions/checkout@v3
16-
17-
- uses: actions/setup-python@v4
18-
with:
19-
python-version: "3.11"
20-
21-
- name: Install poetry
22-
run: pip install poetry
23-
24-
- name: Determine dependencies
25-
run: poetry lock
26-
27-
- uses: actions/setup-python@v4
28-
with:
29-
python-version: "3.11"
30-
cache: poetry
21+
uses: actions/checkout@v4
3122

32-
- name: Install Dependencies using Poetry
33-
run: poetry install
34-
35-
- name: Check formatting
36-
run: poetry run black --check .
37-
38-
linting:
39-
runs-on: ubuntu-latest
40-
steps:
41-
- name: Check out the code
42-
uses: actions/checkout@v3
43-
44-
- uses: actions/setup-python@v4
23+
- name: Install Pixi
24+
uses: prefix-dev/[email protected]
4525
with:
46-
python-version: "3.11"
47-
48-
- name: Install poetry
49-
run: pip install poetry
26+
environments: dev
27+
pixi-version: v0.42.1
5028

51-
- name: Determine dependencies
52-
run: poetry lock
53-
54-
- uses: actions/setup-python@v4
55-
with:
56-
python-version: "3.11"
57-
cache: poetry
29+
- name: Ruff Format
30+
if: always()
31+
run: |
32+
pixi run --environment dev format --check
5833
59-
- name: Install Dependencies using Poetry
60-
run: poetry install
34+
- name: Ruff lint
35+
if: always()
36+
run: |
37+
pixi run --environment dev lint --diff
38+
# - name: Mypy
39+
# if: always()
40+
# run: |
41+
# pixi run --environment dev type-check
6142

62-
- name: Check code
63-
run: poetry run flake8
43+
- name: Collect QC
44+
run: echo "All quality control checks passed"
6445

6546
testing:
6647
runs-on: ubuntu-latest
6748
steps:
68-
- uses: actions/checkout@v3
49+
- uses: actions/checkout@v4
6950

70-
- uses: actions/setup-python@v4
51+
- name: Install Pixi
52+
uses: prefix-dev/[email protected]
7153
with:
72-
python-version: "3.11"
73-
74-
- name: Install poetry
75-
run: pip install poetry
76-
77-
- name: Determine dependencies
78-
run: poetry lock
79-
80-
- uses: actions/setup-python@v4
81-
with:
82-
python-version: "3.11"
83-
cache: poetry
84-
85-
- name: Install dependencies
86-
run: |
87-
pip install connection-pool # because it is incompatible with poetry
88-
poetry install
89-
90-
- name: Run pytest
91-
run: poetry run coverage run -m pytest tests/tests.py
54+
environments: dev
55+
pixi-version: v0.42.1
9256

93-
- name: Run Coverage
94-
run: poetry run coverage report -m
57+
- name: Run tests
58+
run: pixi run --environment dev test --show-capture=all -s -vv

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,8 @@ cython_debug/
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161161

162-
poetry.lock
162+
poetry.lock
163+
# pixi environments
164+
.pixi
165+
*.egg-info
166+
pixi.lock

pyproject.toml

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
[tool.poetry]
2-
authors = ["Johannes Köster <[email protected]>"]
3-
description = "This package provides a stable interface for interactions between Snakemake and its executor plugins."
4-
license = "MIT"
1+
[project]
52
name = "snakemake-interface-executor-plugins"
6-
packages = [{include = "snakemake_interface_executor_plugins"}]
7-
readme = "README.md"
83
version = "9.3.3"
9-
10-
[tool.poetry.dependencies]
11-
argparse-dataclass = "^2.0.0"
12-
python = "^3.11"
13-
throttler = "^1.2.2"
14-
snakemake-interface-common = "^1.17.4"
15-
16-
[tool.poetry.dev-dependencies]
17-
black = "^24.0.0"
18-
coverage = {extras = ["toml"], version = "^6.3.1"}
19-
flake8 = "^4.0.1"
20-
flake8-bugbear = "^22.1.11"
21-
pytest = "^7.0"
22-
snakemake = {git="https://github.com/snakemake/snakemake.git"}
23-
snakemake-executor-plugin-cluster-generic = {git = "https://github.com/snakemake/snakemake-executor-plugin-cluster-generic.git"}
4+
description = "This package provides a stable interface for interactions between Snakemake and its executor plugins."
5+
authors = [{ name = "Johannes Köster", email = "[email protected]" }]
6+
license = { text = "MIT" }
7+
readme = "README.md"
8+
requires-python = ">=3.11"
9+
dependencies = [
10+
"snakemake-interface-common>=1.17.4",
11+
"throttler>=1.2.2",
12+
"argparse-dataclass>=2.0.0",
13+
]
2414

2515
[tool.coverage.run]
2616
omit = [".*", "*/site-packages/*"]
@@ -31,3 +21,57 @@ fail_under = 63
3121
[build-system]
3222
build-backend = "poetry.core.masonry.api"
3323
requires = ["poetry-core"]
24+
25+
[tool.pixi.project]
26+
channels = ["conda-forge"]
27+
platforms = ["osx-arm64", "linux-64"]
28+
29+
[tool.pixi.pypi-dependencies]
30+
31+
[tool.pixi.tasks]
32+
33+
[tool.pixi.environments]
34+
dev = { features = ["dev"] }
35+
publish = { features = ["publish"] }
36+
37+
[tool.pixi.feature.dev.pypi-dependencies]
38+
snakemake-interface-executor-plugins = { path = ".", editable = true }
39+
snakemake = { git = "https://github.com/snakemake/snakemake.git" }
40+
snakemake-executor-plugin-cluster-generic = { git = "https://github.com/snakemake/snakemake-executor-plugin-cluster-generic.git" }
41+
42+
[tool.pixi.feature.dev.tasks.test]
43+
cmd = [
44+
"pytest",
45+
"--cov=snakemake_interface_executor_plugins",
46+
"--cov-report=xml:coverage-report/coverage.xml",
47+
"--cov-report=term-missing",
48+
"tests/tests.py"
49+
]
50+
description = "Run tests and generate coverage report"
51+
52+
53+
[tool.pixi.feature.dev.dependencies]
54+
pytest = ">=8.3.5,<9"
55+
ruff = ">=0.10.0,<0.11"
56+
mypy = ">=1.15.0,<2"
57+
pytest-cov = ">=6.0.0,<7"
58+
59+
[tool.pixi.feature.dev.tasks]
60+
format = "ruff format snakemake_interface_executor_plugins"
61+
lint = "ruff check"
62+
type-check = "mypy snakemake_interface_executor_plugins/"
63+
qc = { depends-on = ["format", "lint", "type-check"] }
64+
65+
[tool.mypy]
66+
ignore_missing_imports = true
67+
68+
# Publish
69+
[tool.pixi.feature.publish.dependencies]
70+
twine = ">=6.1.0,<7"
71+
python-build = ">=1.2.2,<2"
72+
73+
[tool.pixi.feature.publish.tasks]
74+
build = { cmd = "python -m build", description = "Build the package into the dist/ directory" }
75+
check-build = { cmd = "python -m twine check dist/*", depends-on = [
76+
"build",
77+
], description = "Check that the package can be uploaded" }

snakemake_interface_executor_plugins/executors/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def isdigit(i):
4646
for resource, value in job.resources.items()
4747
if isinstance(value, int)
4848
# need to check bool seperately because bool is a subclass of int
49-
and isdigit(value) and resource not in excluded_resources
49+
and isdigit(value)
50+
and resource not in excluded_resources
5051
}
5152

5253
def get_resource_declarations(self, job: JobExecutorInterface):

0 commit comments

Comments
 (0)