Python project bootstrapping
The modern way: use pyproject.toml only
Avoid these outdated mechanisms
- distutils
- setup.py
- setup.cfg
Sphinx API docs
Note: the most reliable way to have autodoc working is to install the package in question in the environment where Sphinx is executed
-
Set up Sphinx:
sphinx-quickstart docs
-
In docs/conf.py, add the
sphinx.ext.autodoc
extension -
Add docs/api.rst:
API reference ============= .. automodule:: goeiedag :imported-members: :members: :undoc-members:
-
Add
api
totoctree
in docs/index.rst
Publishing on Read the Docs
- Sign up on https://about.readthedocs.com/
- Import a project
- Add and adjust the .readthedocs.yaml file as per the wizard
Examples:
Releasing to PyPI
Prerequisities: the packages
build
and
twine
-
update CHANGELOG.md and version in pyproject.toml
-
execute the following commands
mkdir -p dist rm dist/*.tar.gz dist/*.whl python -m build python -m twine upload --repository testpypi dist/* # either python -m twine upload dist/* # or