Developer Information
Contributions to this project are highly appreciated! You can either contact the maintainers, create an issue or directly create a pull request for your proposed changes:
Fork the Project
Create your Feature Branch (
git checkout -b feature/<descriptive-name>
)Commit your changes (
git commit -m 'Added NewFeature'
)Push to remote (
git push origin feature/<descriptive-name>
)Open a Pull Request to be merged with dev
Contributor information
To contribute to this project, please follow these steps:
Dev env setup
Install miniforge.
Create a new virtual environment using
conda
: Runconda create -n pystatis python=3.11
. You can choose another Python version as long as it is supported by this package, see the pyproject.toml for supported Python versions.Install poetry inside your conda environment: Run
conda install poetry
.Clone the repository via git.
Change into the project root directory.
Run
poetry install
to install all dependencies into the current conda environment (runpoetry env info
to see the details of the current environment). Runpoetry install --with dev
to receive all additional developer dependencies.poetry
has installed all dependencies for you, as well as the packagepystatis
itself.Install pre-commit: Run
poetry run pre-commit install
. This will activate the pre-commit hooks that will run prior every commit to ensure code quality.
Workflow
Check out the
dev
branch and make sure it is up to date by runninggit pull
.Create a new branch by running
git checkout -b <new-branch>
orgit switch -c <new-branch>
. If possible, add an issue number to the branch name.Do your changes.
Delete the cassettes folder under tests to make sure that the tests are loading the latest data from the API.
Run
poetry run pytest tests -s -vv --vcr-record=new_episodes
to see if all existing tests still run through. It is important to usepoetry run
to callpytest
so thatpoetry
uses the created virtual environment and not the system’s default Python interpreter. Alternatively, you can runpoetry shell
to letpoetry
activate the virtual environment for the current session. Afterwards, you can runpytest
as usual without any prefix. You can leave the poetry shell with theexit
command.Add new tests depending on your changes.
Run
poetry run pytest tests -s -vv --vcr-record=new_episodes
again to make sure your tests are also passed.Commit your changes. This will trigger all pre-commit hooks as defined in
.pre-commit-config.yaml
. If any of these pre-hooks fails, your commit is declined and you have to fix the issues first.Before you create a PR make sure that you have the latest changes from dev. Run
git switch dev
, rungit pull
, switch back to your branch withgit switch -
and either do agit rebase -i dev
orgit merge dev
to get the latest changes in your current working branch. Solve all merge conflicts.Push your final changes.
Create a new PR, always against
dev
as target.
To learn more about poetry
, see Dependency Management With Python Poetry by realpython.com.
Documentation process
Documentation can also be built locally by ensuring that pandoc is installed, e.g. via conda install pandoc
, and then running
cd docs && make clean && make html
from the project root directory. Besides providing parsed docstrings of the individual package modules, the full documentation currently mirrors most of the readme, like installation and usage. The mirroring crucially relies on the names of the section headers in the ReadMe, so change them with care!
More information on how to use sphinx is provided here.