This is a quick guide on how to follow best practice and contribute smoothly to SMACT
.
We follow the GitHub flow, using branches for new work and pull requests for verifying the work.
The steps for a new piece of work can be summarised as follows:
- Push up or create an issue.
- Create a branch from main, with a sensible name that relates to the issue.
- Do the work and commit changes to the branch. Push the branch regularly to GitHub to make sure no work is accidentally lost.
- Write or update unit tests for the code you work on.
- When you are finished with the work, ensure that all of the unit tests pass on your own machine.
- Open a pull request on the pull request page.
- If nobody acknowledges your pull request promptly, feel free to poke one of the main developers into action.
For a general overview of using pull requests on GitHub look in the GitHub docs.
When creating a pull request you should:
- Ensure that the title succinctly describes the changes so it is easy to read on the overview page
- Reference the issue which the pull request is closing
Recommended reading: How to Write the Perfect Pull Request
When developing locally, it is recommended to install the python packages in requirements-dev.txt
.
pip install -r requirements-dev.txt
This will allow you to run the tests locally with pytest as described in the main README, as well as run pre-commit hooks to automatically format python files with isort and black. To install the pre-commit hooks (only needs to be done once):
pre-commit install
pre-commit run --all-files # optionally run hooks on all files
Pre-commit hooks will check all files when you commit changes, automatically fixing any files which are not formatted correctly. Those files will need to be staged again before re-attempting the commit.