|
| 1 | +# Contributing to clams-python |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- Python 3.10+ |
| 6 | +- `gh` CLI (for changelog generation) |
| 7 | + |
| 8 | +## Setup |
| 9 | + |
| 10 | +```bash |
| 11 | +pip install -e ".[dev]" |
| 12 | +``` |
| 13 | + |
| 14 | +Unlike the old `setup.py`-based workflow, an editable install |
| 15 | +(`pip install -e .`) is now required before running tests or building |
| 16 | +docs. The package uses `importlib.metadata` for version resolution at |
| 17 | +runtime, which only works when the package is registered in the |
| 18 | +environment. You can no longer run `pytest` or `pytype` directly |
| 19 | +against the source tree without installing first. If you want to avoid |
| 20 | +pulling in all dependencies, `pip install -e . --no-deps` is sufficient |
| 21 | +to register the package metadata. |
| 22 | + |
| 23 | +## Local Development |
| 24 | + |
| 25 | +All build tasks are handled by scripts in `build-tools/`. Each script |
| 26 | +is self-contained and installs its own dependencies as needed. |
| 27 | + |
| 28 | +| Task | Command | |
| 29 | +|------|---------| |
| 30 | +| Build (sdist + wheel) | `python build-tools/build.py` | |
| 31 | +| Run tests | `python build-tools/test.py` | |
| 32 | +| Build docs | `python build-tools/docs.py` | |
| 33 | +| Clean artifacts | `python build-tools/clean.py` | |
| 34 | +| Publish | `python build-tools/publish.py` | |
| 35 | + |
| 36 | +All scripts support `--help` for full usage details. |
| 37 | + |
| 38 | +### Build |
| 39 | + |
| 40 | +```bash |
| 41 | +python build-tools/build.py |
| 42 | +``` |
| 43 | + |
| 44 | +Produces sdist and wheel in `dist/`. |
| 45 | + |
| 46 | +### Test |
| 47 | + |
| 48 | +```bash |
| 49 | +python build-tools/test.py |
| 50 | +``` |
| 51 | + |
| 52 | +Runs pytest with coverage. Use `--skip-install` if you already have the |
| 53 | +package installed in editable mode. |
| 54 | + |
| 55 | +### Documentation |
| 56 | + |
| 57 | +```bash |
| 58 | +python build-tools/docs.py |
| 59 | +``` |
| 60 | + |
| 61 | +Builds Sphinx HTML docs into `docs-test/` (override with `--output-dir`). |
| 62 | +The `--build-ver` flag is accepted for CI compatibility but has no effect |
| 63 | +— clams-python uses unversioned documentation. |
| 64 | + |
| 65 | +### Versioning |
| 66 | + |
| 67 | +Versions are derived automatically from git tags via `setuptools-scm`. |
| 68 | +There is no `VERSION` file to manage. At runtime, the version is |
| 69 | +accessed through `importlib.metadata`: |
| 70 | + |
| 71 | +```python |
| 72 | +from clams.ver import __version__ |
| 73 | +``` |
| 74 | + |
| 75 | +For a dev install without a matching tag, `setuptools-scm` generates a |
| 76 | +version like `1.4.1.dev20+gaf551a4e4.d20260325`. |
| 77 | + |
| 78 | +## Migration from Makefile |
| 79 | + |
| 80 | +The old `Makefile` and `setup.py` have been removed. If you are |
| 81 | +accustomed to the old workflow, here is a mapping: |
| 82 | + |
| 83 | +| Old command | New equivalent | |
| 84 | +|-------------|----------------| |
| 85 | +| `make package` / `python setup.py sdist` | `python build-tools/build.py` | |
| 86 | +| `make develop` / `python setup.py develop` | `pip install -e ".[dev]"` | |
| 87 | +| `make test` | `python build-tools/test.py` | |
| 88 | +| `make doc` | `python build-tools/docs.py` | |
| 89 | +| `make version` / `make devversion` | Automatic via `setuptools-scm` (tag-based) | |
| 90 | +| `make clean` | `python build-tools/clean.py` | |
| 91 | +| `make publish` | `python build-tools/publish.py` | |
0 commit comments