Thank you for your interest in contributing to Norfair! Before you begin writing code, it is important that you share your intention to contribute with the team, based on the type of contribution:
- You want to propose a new feature and implement it:
- Post your intended feature in an issue, and we shall discuss the design and implementation. Once we agree that the plan looks good, go ahead and implement it.
- You want to implement a feature or bug fix for an outstanding issue.
- Search for your issue in the list.
- Pick an issue and comment that you'd like to work on the feature or bug-fix.
- If you need more context on a particular issue, please ask and we shall provide it.
Once you implement and test your feature or bug fix, please submit a Pull Request to https://github.com/tryolabs/norfair/pulls.
- Clone this repository
git clone [email protected]:tryolabs/norfair.git
. - Set up Python. Although version 3.6 is still supported, we recommend using a newer version for development. Using pyenv is highly recommended.
- Install poetry version 1.2 or above.
- Install dependencies
poetry install --all-extras
.
In the following commands, we will include poetry run <cmd>
when a command needs the virtual environment. This is not necessary if you activate it by running poetry shell
once.
We use black and isort to automatically format our python code. It's recommended that you configure them on your editor of choice. If you don't, you'll likely get a linting error on the PR
For VSCode, follow the setup recommended here.
Alternatively, make sure to run poetry run black .
and poetry run isort .
on the root directory before committing.
The tests are automatically checked on each PR by a GitHub Action. For this reason, you are encouraged to skip this setup and send a PR without testing it locally first. Delaying this step until the tests fail on the GitHub Action if they ever do.
Tests are run with tox using poetry run tox
You will likely receive an error where tox is not able to find the python versions necessary, to solve this with pyenv:
- List installed versions with
pyenv versions
. - Make sure you have at least one version installed for each python
3.6
,3.7
,3.8
, and3.9
. Available versions can be found withpyenv install --list
and installed withpyenv install X.X.X
. - Once you have one version of each python run
pyenv local 3.6.X 3.7.X 3.8.X 3.9.X
. SubstituteX
with the specific versions listed inpyenv versions
.
Tox will run the unit tests on all python versions and one integration test that checks the performance in the MOT Challenge. This integration test can take a few minutes and needs an internet connection.
Any suggestion on how to improve the documentation is welcome and don't feel obligated to set up the repo locally to contribute. Simply create an issue describing the change and we will take care of it.
Nevertheless, if you still want to test the change first and create the PR yourself, follow these steps:
- Install documentation dependencies
poetry run pip install -r docs/requirements.txt
. - Start the debugging server
poetry run mkdocs serve
and open http://localhost:8000. - The above version is useful for debugging but it doesn't include the versioning. Once you are happy with the result you can see the final result with run
poetry run mike deploy dev
andpoetry run mike serve
. Open the browser and switch todev
version.
Our documentation follows numpy style docstring format.