Contributing¶
This page provides a guide for developers wishing to contribute to Sphinx-Modeling.
Bugs, Features and PRs¶
For bug reports and well-described technical feature requests, please use our issue tracker:
https://github.com/useblocks/sphinx-modeling/issues
For feature ideas and questions, please use our discussion board:
https://github.com/useblocks/sphinx-modeling/discussions
If you have already created a PR, you can send it in. Our CI workflow will check (test and code styles) and a maintainer will perform a review, before we can merge it. Your PR should conform with the following rules:
A meaningful description or link, which describes the change
The changed code (for sure :) )
Test cases for the change (important!)
Updated documentation, if behavior gets changed or new options/directives are introduced.
Update of
docs/changelog.rst
.If this is your first PR, feel free to add your name in the
AUTHORS
file.
Installing Dependencies¶
Sphinx-Modeling requires only Poetry to be installed as a system dependency, the rest of the dependencies are ‘bootstrapped’ and installed in an isolated environment by Poetry.
Install project dependencies
poetry install
Install the Pre-Commit hooks
pre-commit install
For running tests, install the dependencies of our official documentation:
pip install -r docs/requirements.txt
List make targets¶
Sphinx-Modeling uses make
to invoke most development related actions.
Use make list
to get a list of available targets.
docs-html
docs-html-fast
docs-pdf
format
lint
test
test-matrix
test-short
Build docs¶
To build the Sphinx-Modeling documentation stored under /docs
, run:
# Build HTML pages
make docs-html
or
# Build PDF pages
make docs-pdf
It will always perform a clean build (calls make clean
before the build).
If you want to avoid this, run the related sphinx-commands directly under /docs
(e.g. make docs
).
Check links in docs¶
To check if all used links in the documentation are still valid, run:
make docs-linkcheck
Running Tests¶
Hint
Please be sure to have the dependencies of the official documentation installed:
pip install -r docs/requirements.txt
make test
Linting & Formatting¶
Sphinx-Modeling uses black and isort to format its source code.
make lint
Running Test Matrix¶
This project provides a test matrix for running the tests across a range of Python and Sphinx versions. This is used primarily for continuous integration.
Nox is used as a test runner.
Running the matrix tests requires additional system-wide dependencies
You will also need multiple Python versions available. You can manage these using Pyenv
You can run the test matrix by using the nox
command
nox
or using the provided Makefile
make test-matrix
For a full list of available options, refer to the Nox documentation,
and the local noxfile
.
Our noxfile.py
import nox
from nox_poetry import session
PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
SPHINX_VERSIONS = ["5.0.2"]
SPHINX_NEEDS_VERSIONS = ["1.0.1", "1.0.2"]
def run_tests(session, sphinx, sphinx_needs):
session.install(".")
session.run("pip", "install", f"sphinx=={sphinx}")
session.run("pip", "install", f"sphinx-needs=={sphinx_needs}")
session.run("echo", "FINAL PACKAGE LIST", external=True)
session.run("pip", "freeze")
session.run("make", "test", external=True) # runs 'poetry run pytest' which re-uses the active nox environment
@session(python=PYTHON_VERSIONS, reuse_venv=True)
@nox.parametrize("sphinx_needs", SPHINX_NEEDS_VERSIONS)
@nox.parametrize("sphinx", SPHINX_VERSIONS)
def tests(session, sphinx, sphinx_needs):
run_tests(session, sphinx, sphinx_needs)
Running Commands¶
See the Poetry documentation for a list of commands.
In order to run custom commands inside the isolated environment, they
should be prefixed with poetry run
(ie. poetry run <command>
).
Maintainers¶
Marco Heinemann <marco@useblocks.com>
Contributors¶
Publishing a new release¶
There is a release pipeline installed for the CI.
This gets triggered automatically, if a tag is created and pushed.
The tag must follow the format: [0-9].[0-9]+.[0-9]
. Otherwise the release jobs won’t trigger.
The release jobs will build the source and wheel distribution and try to upload them
to test.pypi.org
and pypy.org
.