diff --git a/docs/development/contributing.md b/docs/development/contributing.md new file mode 100644 index 0000000..11ecb57 --- /dev/null +++ b/docs/development/contributing.md @@ -0,0 +1,70 @@ +# Contributing + +## Bug reports, feature requests and feedback + +Head over to [docstub's issue tracker](https://github.com/scientific-python/docstub/issues) and feel very welcome to open an issue! + + +## Development workflow + +This section assumes familiarity with Python development. +For a more general introduction you can check out [Scientific Python's Intro to development](https://learn.scientific-python.org/development/tutorials/dev-environment/). + + +### Setup a development environment + +Create a [fork of docstub](https://github.com/scientific-python/docstub/fork) and clone your fork. +The following sections assume that you are running a shell inside that cloned project folder (`docstub/`). + +```shell +pip install --group dev --editable . +pre-commit install +``` + + +### Run tests + +Run test suite and doctests: + +```shell +python -m pytest +``` + +Check stub files for docstub: + +```shell +python -m mypy.stubtest \ + --mypy-config-file "pyproject.toml" \ + --allowlist "stubtest_allow.txt" \ + docstub +``` + +Type check test suite: + +```shell +python -m mypy "tests/" +python -m basedpyright "tests/" +``` + +Before committing you can also perform all linting checks explicitly with + +```shell +pre-commit run --all +``` + + +### Build the documentation + +```shell +python -m sphinx --fresh-env --nitpicky --fail-on-warning "docs/" "docs/build/" +``` + + +## Design goals + +- Docstub is not a type checker. +- Docstub is not a linter. +- Docstub aims for readable type descriptions in docstrings. + It should not introduce more complexity in docstrings than if [Python-native annotations](https://typing.python.org/en/latest/spec/glossary.html#term-annotation-expression) were used. +- Docstub encourages fallback mechanisms like inline annotations, or creating a stub file manually. + This helps with cases that would have a poor readability in docstrings, would be very complex, or are not supported. diff --git a/docs/development/index.md b/docs/development/index.md new file mode 100644 index 0000000..b288adb --- /dev/null +++ b/docs/development/index.md @@ -0,0 +1,10 @@ +# Development + +Resources for and about the development of docstub. + +:::{toctree} +:maxdepth: 1 + +contributing +release +::: diff --git a/docs/development/release.md b/docs/development/release.md new file mode 100644 index 0000000..e7d8c98 --- /dev/null +++ b/docs/development/release.md @@ -0,0 +1,73 @@ +# Release process + +This section documents the steps to make a release of docstub. +Depending on the release type not all steps may be mandatory – use appropriate judgement. + + +## Create release notes + +Generate a [read-only GitHub token](https://github.com/settings/personal-access-tokens), install [changelist](https://github.com/scientific-python/changelist), and generate a first draft of the release notes with it. + +```shell +pip install changelist + +RELEASE_TAG=... +PREV_TAG=... +export GH_TOKEN=... + +changelist scientific-python/docstub \ + --version "${RELEASE_TAG}" \ + --out "doc/release_notes/v${RELEASE_TAG}.md" \ + "${PREV_TAG}" main +``` + +- `RELEASE_TAG` is the tag of the current release (for example `v1.1.0`) +- `PREV_TAG` is the tag of the previous release (for example `v1.0.0`). + +So changelist will generate notes based on the changes between `${PREV_TAG}..main`. + +Review and update `doc/release_notes/v${RELEASE_TAG}.md`. +Don't forget to add the new document to `doc/release_notes/index.md`. + +Create a pull request with the new release notes. +If desired, include this pull request in the release notes, too. + + +## Create a new tag + +Once the pull request with the release notes is merged, tag the resulting commit with the desired version tag. +This should be a signed tag. + +```shell +git tag --sign "v${RELEASE_TAG}" +``` + +Include the release notes in the tag's message in the same formatting style as other release tags. + +Review and then push the tag: + +```shell +git push origin "v${RELEASE_TAG}" +``` + + +## Create a new "version" on Read the Docs + +Login to https://app.readthedocs.org/projects/docstub. + +Create a [new version](https://app.readthedocs.org/dashboard/docstub/version/create/) for the tag corresponding to the new release. + + +## Trigger release workflow on GitHub + +Trigger [docstub's release workflow on GitHub](https://github.com/scientific-python/docstub/actions/workflows/cd.yml). +As a security measure, this workflow needs to be approved by one eligible maintainer. +If successful, the workflow will build the package and push it to PyPI. + + +## Format and publish GitHub release + +[Create a new release draft](https://github.com/scientific-python/docstub/releases/new) and copy the content of `doc/release_notes/v${RELEASE_TAG}.md` into it. +(Remove the duplicate level 1 headline in the first line.) + +Review and publish. diff --git a/docs/index.md b/docs/index.md index 19fb24e..16d81c6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,6 +22,7 @@ It does so by supporting widely used readable conventions such as `array of dtyp installation introduction +development/index ::: :::{toctree} diff --git a/pyproject.toml b/pyproject.toml index 34bb588..8569630 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,8 @@ dependencies = [ ] [project.urls] -Homepage = "https://github.com/lagru/docstub" +Source = "https://github.com/lagru/docstub" +Documentation = "https://docstub.readthedocs.io" [project.scripts] docstub = "docstub.__main__:cli"