Infrastructure¶
Documentation¶
We use Sphinx, and the references page is automatically generated thanks to
sphinx.ext.autodoc
and sphinx_autodoc_typehints
extensions. All functions / methods / classes should have a
proper docstring.
To build the doc locally:
$ tox -e docs
To preview:
# MacOS:
$ open docs/_build/index.html
# Linux:
$ xdg-open docs/_build/index.html
Hosted documentation (https://pyinaturalist.readthedocs.io/) is automatically updated when code gets pushed to GitHub.
Testing¶
We use the pytest framework.
To run locally:
$ pytest
It is however always good to run tox
frequently, to run the tests against multiple Python versions, as well as some
style and type annotations checks:
$ tox
Travis-CI is run when code is pushed to GitHub.
Type annotations¶
All functions / methods should have parameters and return value type annotations. Those type annotations are checked by
MyPy (tox -e mypy
) and will appear in the documentation.
Releasing at PyPI¶
Release checklist:
Make sure the code is tested, annotated and documented.
Update version in HISTORY.rst, setup.py and pyinaturalist/__init__.py
Create the distributions:
python setup.py sdist bdist_wheel
Use twine to upload the package to PyPI:
twine upload dist/*
Push a vX.Y.Z tag to GitHub:
git tag vX.Y.Z && git push origin --tags