Follow the instructions in the README if you haven't already setup your development environment.
You can't directly push to the main
branch. All contributions will require review to ensure code is understandable
and can be built upon.
- To contribute new code, make a new Git branch in this repository (don't use a fork, since that will not properly trigger the checks when you make a PR). When your code is ready for review, make a PR and request reviews from the appropriate people (if you're not sure who to request a review from, default to Nishanth and/or Will).
- To merge a PR, you need at least one approval, and you have to pass the 4 checks defined in
.github/workflows/ci_checks.yml
(these will be run automatically on GitHub whenever you push or open a PR). You can run these checks locally in one line via./scripts/run_checks.sh
. For more details, refer to the next section.
We use isort
and black
for autoformatting, flake8
and mypy
for linting and type checking, and pytest
for unit and integration testing. You can run all these commands in one simple script via ./scripts/run_checks.sh
.
If you wish to run these commands individually, you can run these commands from the repo directory:
isort . && black .
flake8 .
mypy . --config-file mypy.ini
pytest -s tests/ --cov-config=.coveragerc --cov=lisdf/ --cov-fail-under=75 --cov-report=term-missing:skip-covered --durations=10
- The 1st command is the autoformatting check, which runs
black
andisort
. - The 2nd command is the linter check, which runs
flake8
- The 3rd command is the static typing check, which uses
mypy
to verify type annotations. - The 4th command is the unit testing check, which verifies that unit tests pass and that code is adequately covered.
- The "75" means that 75% of all lines in every file in
lisdf/
must be covered (excludestests/
).
- The "75" means that 75% of all lines in every file in
Right now, the plan is to manually publish to PyPI when required. We can automate the release process later if needed.
We use Hatch as our build system because it is lightweight, easy to use yet powerful
in comparison to other tools like poetry
.
- Increment
__version__
inlisdf/__init__.py
to the new version number.- We try to follow the semantic versioning convention.
- Install
hatch
viapip install hatch
if you haven't already. - Build the package via
hatch build
- Inspect the build artifacts in
dist/
to ensure that everything looks good.- Note: the
.whl
file is just a zip file, so you can unzip it to inspect the contents.
- Note: the
- Publish to PyPI via
hatch publish
- Pre-requisite: you will need to have a PyPI account and be added as a collaborator of the package. Ask Will to add you if you don't have access yet.