This note details how to contribute to poli.
The main development branch is called dev. To contribute, we recommend creating a fork of this repository and making changes on your version. Once you are ready to contribute, we expect you to document, lint and test.
We recommend you create a poli-dev environment in conda
conda create -n poli-dev python=3.10
conda activate poli-dev
pip install -r requirements.txt
pip install -r requirements-dev.txtThe dev requirements include pre-commit. Install the hooks in our config by running
pre-commit installNow every commit will run linting and isorting for you. You can also run it manually by saying
pre-commit run --all-filesWe follow numpy's documentation standards.
If you're contributing a black box in a new environment, remember to
- Mark all your tests with
@pyest.mark.poli__your_env. - Add a description of your marker to the
[tool.pytest.ini_options].
Since we are testing multiple conda environments, we settled for using a combination of tox and pytest.
pip install tox
# To test linting (from the root of the project)
tox -c tox.ini -e lint
# To test in the base environment for poli
tox -c tox.ini -e poli-base-py39There are several different environments (depending on the black boxes we test). Check tox.ini for more details.
If you want to run tests in all environments, remove -e poli-base-py39 and just run tox. This might take a while, and several conda envs will be created.
What tox does is essentially running certain pytest commands after creating relevant conda environments. You can usually run these by hand from the relevant environments by doing something like
pytest -v -m "unmarked" # for the base env.
pytest -v -m "poli__<relevant-env>" # for whichever environmentYour last commit in your branch should be a bump version.
One of the dev requirements is bump-my-version. You should be able to check what the version would be bumped to by running
bump-my-version show-bumpFor most cases, you'll be bumping pre_n in the dev branch. You can bump it with
bump-my-version bump pre_nThis will modify the relevant files: pyproject.toml and src/poli/__init__.py.
Once all tests pass and you are ready to share your changes, create a pull request to the dev branch.