Skip to content

Commit d7eded3

Browse files
authored
implement release-please (#4)
1 parent 8c4641c commit d7eded3

8 files changed

Lines changed: 122 additions & 29 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
release-please:
13+
name: Release Please
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
steps:
19+
- uses: googleapis/release-please-action@v4
20+
id: release
21+
with:
22+
config-file: release-please-config.json
23+
manifest-file: .release-please-manifest.json

.release-please-manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/manifest.json",
3+
".": "2.0.0"
4+
}

CONTRIBUTING.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Contributing to `snakemk_util`
2+
3+
## Development environment
4+
5+
The project uses [`uv`](https://docs.astral.sh/uv/) for dependency management.
6+
7+
### Initial setup
8+
9+
```bash
10+
# Create the conda env (provides Python + uv)
11+
micromamba env create -f environment-dev.yml
12+
micromamba activate snakemk_util
13+
14+
# Install all dependency groups (runtime + dev + test + lint) into a uv-managed venv
15+
uv sync --all-groups --all-extras
16+
```
17+
18+
All subsequent commands assume the env is activated and `uv` is on `PATH`.
19+
20+
## Running tasks
21+
22+
The project standardises tasks through [`tox`](https://tox.wiki/) with the `tox-uv` runner. Run any environment with:
23+
24+
```bash
25+
uv run tox -e <env>
26+
```
27+
28+
Available environments (defined in `pyproject.toml`):
29+
30+
| Env | Purpose |
31+
|-----------------|------------------------------------------|
32+
| `format-check` | `ruff format --check .` |
33+
| `lints` | `ruff check .` |
34+
| `typecheck` | `mypy snakemk_util` |
35+
| `py3.11` | Run pytest under Python 3.11 |
36+
| `py3.14` | Run pytest under Python 3.14 |
37+
38+
Run the full matrix CI runs with:
39+
40+
```bash
41+
uv run tox
42+
```
43+
44+
### Quick commands
45+
46+
```bash
47+
# Format code
48+
uv run ruff format .
49+
50+
# Lint with autofix
51+
uv run ruff check --fix .
52+
53+
# Run tests directly (single Python)
54+
uv run pytest
55+
56+
# Run a single test
57+
uv run pytest tests/test_rule_args.py::test_name -x
58+
```
59+
60+
## Releases
61+
62+
Versioning and tagging are automated by [release-please](https://github.com/googleapis/release-please) (`.github/workflows/release-please.yml`). Publishing is handled by `.github/workflows/publish.yml`:
63+
64+
- release-please watches commits on `master` and opens/maintains a release PR that bumps `pyproject.toml` and updates `CHANGELOG.md`.
65+
- Merging the release PR cuts a `vX.Y.Z` tag and a GitHub release.
66+
- The tag triggers `publish.yml`, which builds sdist + wheel and uploads to PyPI via trusted publishing (OIDC).
67+
- `__version__` is sourced at runtime from package metadata (`importlib.metadata.version("snakemk_util")`).
68+
69+
Use [Conventional Commits](https://www.conventionalcommits.org/) on `master` so release-please can pick the next version (`fix:` → patch, `feat:` → minor, `feat!:` / `BREAKING CHANGE:` → major).
70+

environment-dev.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: snakemk_util
2+
channels:
3+
- conda-forge
4+
- bioconda
5+
- nodefaults
6+
dependencies:
7+
# common
8+
- python >=3.13
9+
- uv =0.11

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "snakemk_util"
7-
dynamic = ["version"]
7+
version = "2.0.0"
88
description = "utility functions for snakemake"
99
authors = [
1010
{ name = "Florian R. Hölzlwimmer", email = "git.ich@frhoelzlwimmer.de" }
@@ -24,7 +24,6 @@ snakemk_util = "snakemk_util.main:main"
2424

2525
[dependency-groups]
2626
dev = [
27-
"bumpversion",
2827
"tox>=4",
2928
"tox-uv",
3029
]
@@ -42,9 +41,6 @@ lint = [
4241
[tool.setuptools]
4342
packages = ["snakemk_util"]
4443

45-
[tool.setuptools.dynamic]
46-
version = { attr = "snakemk_util.__version__" }
47-
4844
[tool.ruff]
4945
target-version = "py311"
5046
line-length = 120

release-please-config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "python",
6+
"package-name": "snakemk_util",
7+
"include-component-in-tag": false,
8+
"include-v-in-tag": true
9+
}
10+
}
11+
}

snakemk_util/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
__version__ = "2.0.1-dev"
1+
from importlib.metadata import version
2+
3+
__version__ = version("snakemk_util")
24

35
from .formatting import recursive_format
46
from .rule_args import (

uv.lock

Lines changed: 1 addition & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)