|
| 1 | +# Contributing |
| 2 | + |
| 3 | +To contribute to this Python client, install its development dependencies using |
| 4 | +Python 3.8+ and a modern pip: |
| 5 | + |
| 6 | +```bash |
| 7 | +python -m pip install --upgrade pip |
| 8 | +python -m pip install -e '.[dev]' |
| 9 | +``` |
| 10 | + |
| 11 | +## Code quality |
| 12 | + |
| 13 | +Install `.[dev]` to get the pinned development tools. Black 24.8.0, isort 5.13.2, |
| 14 | +and Flake8 7.1.1 use 100-column formatting, isort's Black profile, and a Python |
| 15 | +3.8 target. |
| 16 | + |
| 17 | +```bash |
| 18 | +make format # Sort imports and apply Black to src/ and tests/ |
| 19 | +make lint # Check formatting, imports, Flake8 and Google-style docstrings |
| 20 | +make typecheck # Check annotated library code with mypy |
| 21 | +make test # Run the HTTP contract tests |
| 22 | +make check # Run lint, type checking and tests |
| 23 | +make build # Build distributions and check their metadata |
| 24 | +``` |
| 25 | + |
| 26 | +Activate your environment first, or specify it explicitly, for example: |
| 27 | +`make check PYTHON=.venv/bin/python`. The CI lint job uses the same commands. |
| 28 | +EditorConfig defines whitespace and newline conventions for supporting editors. |
| 29 | + |
| 30 | +Add annotations and docstrings to new functions, methods and classes, including |
| 31 | +constructors and test helpers. Public docstrings should explain side effects, |
| 32 | +permissions, return values and failure behavior where useful. JSON dictionaries |
| 33 | +retain `Any` values because node parameters and server response fields are dynamic; |
| 34 | +this release does not pretend to provide complete generated response models. |
| 35 | +Mypy checks library signatures and bodies; Flake8 and formatting cover both the |
| 36 | +library and tests. Runtime tests continue to cover Python 3.8 in CI. |
| 37 | + |
| 38 | +## Versioning |
| 39 | + |
| 40 | +```bash |
| 41 | +make version # Show the current version |
| 42 | +make check-version # Verify both version fields agree |
| 43 | +make bump-patch # 2.0.0 -> 2.0.1 |
| 44 | +make bump-minor # 2.0.0 -> 2.1.0 |
| 45 | +make bump-major # 2.0.0 -> 3.0.0 |
| 46 | +make bump-version VERSION=2.1.0 # Set an explicit stable version |
| 47 | +``` |
| 48 | + |
| 49 | +Bumps update `pyproject.toml` and `subfork.__version__` together. They do not |
| 50 | +commit, tag, or publish. Review and commit the changes before releasing. |
| 51 | + |
| 52 | +## Documentation site |
| 53 | + |
| 54 | +Public documentation lives in `docs/`. Its `mkpages.yml` selects the dark theme. |
| 55 | +To generate the Jekyll source with Python 3.12: |
| 56 | + |
| 57 | +```bash |
| 58 | +python -m pip install -e '.[docs]' |
| 59 | +mkpages build docs --output .mkpages |
| 60 | +mkpages preview docs/ |
| 61 | +``` |
| 62 | + |
| 63 | +The Pages workflow builds pull requests and deploys `master`. In repository |
| 64 | +**Settings → Pages**, select **GitHub Actions** as the source. The initial site |
| 65 | +URL is `https://subforkdev.github.io/subfork-python/`; the workflow supplies its |
| 66 | +`--url` and `--baseurl` options. Update those if a custom domain is configured. |
| 67 | +Preview serves the documentation at `http://127.0.0.1:4000/`. |
0 commit comments