Skip to content

Latest commit

 

History

History
118 lines (79 loc) · 3.26 KB

CONTRIBUTING.md

File metadata and controls

118 lines (79 loc) · 3.26 KB

Contributing guidelines

Development

PROTEUS targets Python 3.11 or newer.

Clone the repository into the proteus directory:

git clone https://github.com/FormingWorlds/PROTEUS proteus

Install using virtualenv:

cd proteus
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e .[develop]

Alternatively, install using Conda:

cd proteus
conda create -n proteus python=3.12
conda activate proteus
pip install -e .[develop]

Linting

Linting is a term for static code analysis to flag programming errors, bugs, stylistic errors and suspicious constructs. PROTEUS uses ruff for linting. The linting rules are defined in pyproject.toml.

This check are run automatically via a Github Action: codestyle.

You can ruff on locally using one of these commands:

ruff check start_proteus.py  # single file
ruff check src/proteus       # directory
ruff check .                 # everything

If you prepend --fix, it can also fix some issues for you:

ruff check . --fix

You can also use pre-commit to automatically run ruff on every commit, e.g.:

pre-commit install

Running tests

PROTEUS uses pytest to run the tests.

The tests are run automatically via a Github Action: tests.

You can run the tests for yourself using:

pytest

To check coverage:

coverage run -m pytest
coverage report  # to output to terminal
coverage html    # to generate html report

Building the documentation

The documentation is written in markdown, and uses mkdocs to generate the pages.

To build the documentation for yourself:

pip install -e '.[docs]'
mkdocs serve

You can find the documentation source in the docs directory. If you are adding new pages, make sure to update the listing in the mkdocs.yml under the nav entry.

The documentation is hosted on readthedocs.

Making a release

The versioning scheme we use is CalVer.

  1. Update requirements files:
python tools/generate_requirements_txt.py
pip-compile -o requirements_full.txt pyproject.toml
  1. Bump the version (release/patch) as needed
bump-my-version bump release
# 24.08.12
  1. Commit and push your changes.

  2. Make a new release. Make sure to set the tag to the specified version, e.g. 24.08.12.

  3. The upload to pypi is triggered when a release is published and handled by this workflow.