Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 2.48 KB

CONTRIBUTING.md

File metadata and controls

76 lines (58 loc) · 2.48 KB

Contributing Code to Shimmer

The best way to make a contribution is to first fork the repository on github, create a new branch with an explicit name for your change, and then create a pull request with your changes.

The project requires Python 3.11. Make sure that you have a compatible version. Using Pyenv is an easy way to get the right python version.

We use poetry as our package manager, so make sure it is installed and you have run poetry install in your directory.

When you add features or change APIs, update CHANGELOG.md to track new changes.

With each commit, the github workflow is executed and will check for:

  • code quality;
  • unit tests.

Code quality workflow

This workflow makes sure that the provided code follows correct code formatting and linting using ruff, and type issues with mypy.

This project is fully typed, so any contribution should provide typing annotations.

To run the tools locally, make sure that you have installed dependencies with dev group:

poetry install --sync

Then you can run:

poetry run ruff check --fix  # lint the project (and fix errors if ruff can)
poetry run ruff format  # reformat the project

There is a pre-commit configuration set to lint and reformat using ruff. Set it up to run all automated checks before each commit:

To install the pre-commit hooks:

poetry run pre-commit install

After this command, the ruff format and checks will be automatically done before each commit.

You can test the hook by running it explicitely:

poetry run pre-commit run --all-files

Note

mypy can be long to execute, so it is not ran as a pre-commit hook. you can run it manually, or let github run it for you when you push.

To check type issues with mypy:

poetry run mypy --install-types .

Tests

We use pytest.

poetry run pytest tests/

Checkpoint Migration

Note that among the tests, we check that old GW checkpoints can still be migrated automatically. If you plan on making some changes that would break old checkpoints, please also provide a migration script in shimmer/ckpt_migrations.

You just need to create a new file N_what_I_changed.py (see the store migrations in a folder section).