|
| 1 | +# Contributing |
| 2 | + |
| 3 | +First, thanks for contributing to **pystapi**! |
| 4 | +The [README](./README.md#development) as instructions on setting up your development environment, which is a great place to start. |
| 5 | + |
| 6 | +## Repository organization |
| 7 | + |
| 8 | +**pystapi** is a "monorepo", meaning that it contains several sub-projects. |
| 9 | +Each project has it's own `pyproject.toml` file, README, CHANGELOG, tests, and more. |
| 10 | +Development dependencies should be specified at the top-level `pyproject.toml` file, as tests are intended to be run for the entire repository at once. |
| 11 | + |
| 12 | +## Branches |
| 13 | + |
| 14 | +We have a single primary development branch, **main**. |
| 15 | +Releases are cut from this branch by tags. |
| 16 | +Tags are named to identify which project they are releasing, e.g. a **stapi-pydantic** tag might look like `stapi-pydantic/v0.1.2`. |
| 17 | +If necessary, long-lived release branches are used to manage non-breaking changes and fixes, e.g. a `stapi-pydantic/v0.1` branch to handle any bugfixes that need to be backported to the v0.1 lineage of the project after **main** has incorporated breaking changes. |
| 18 | + |
| 19 | +## Testing |
| 20 | + |
| 21 | +We use [pytest](https://docs.pytest.org). |
| 22 | +Tests should be written in the "pytest style", i.e. free functions. |
| 23 | + |
| 24 | +Good: |
| 25 | + |
| 26 | +```python |
| 27 | +def test_foo() -> None: |
| 28 | + assert 1 == 1 |
| 29 | +``` |
| 30 | + |
| 31 | +Bad: |
| 32 | + |
| 33 | +```python |
| 34 | +class FooTest(unittest.TestCase): |
| 35 | + def test_foo(self) -> None: |
| 36 | + assert 1 == 1 |
| 37 | +``` |
| 38 | + |
| 39 | +## Static typing |
| 40 | + |
| 41 | +We use [mypy](https://mypy-lang.org/) for static typing. |
| 42 | +When possible, projects work in `strict` mode, meaning that type checking is strongly enforced. |
| 43 | +Some projects are not quite ready for `strict` mode, but we want to get them there. |
| 44 | + |
| 45 | +## Lints and checks |
| 46 | + |
| 47 | +We use [pre-commit](https://pre-commit.com/). |
| 48 | +If you want to run checks on every commit: |
| 49 | + |
| 50 | +```shell |
| 51 | +uv run pre-commit install |
| 52 | +``` |
| 53 | + |
| 54 | +If you ever need to disable **pre-commit** when committing use `--no-verify`: |
| 55 | + |
| 56 | +```shell |
| 57 | +git commit --no-verify |
| 58 | +``` |
| 59 | + |
| 60 | +## Submitting changes |
| 61 | + |
| 62 | +Open a [pull request](https://github.com/stapi-spec/pystapi/pulls) with your changes, and fill out the provided template. |
| 63 | +It's not required, but it's helpful if you name your pull request in the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) style, as the pull request titles are the eventual commit title for your changes (we use squash-and-merge). |
| 64 | +A **pystapi** maintainer will review your PR and request any changes. |
| 65 | +Once approved, if you have the permissions you can merge your PR ... if you don't, a maintainer will. |
| 66 | + |
| 67 | +If your PR is not ready for review, but you'd like some feedback on it anyways, open it as a draft. |
0 commit comments