|
| 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 | + |
0 commit comments