Please use Python 3.10 for consistent and complete support. Older or newer versions may bring problems.
Note: the last label for the version number (PATCH) is not important. One can use the latest version of Python 3.10, which is so far 3.10.9. Please refer to https://semver.org/ for details for semantic versioning.
The project uses Python virtual environment to maintain environment consistency. Please refer to https://docs.python.org/3.10/library/venv.html for documentation.
- Open a terminal inside the project root
- Install
virtualenv
module if you haven't:pip3 install virtualenv
- Initialize a virtual environment for the project:
python3 -m virtualenv venv
- Enable the virtual environment for this terminal session:
- For command line shells, a developer should initialize the environment by sourcing
corresponding
activate
script residing invenv
. Typically:- For Windows, execute
.\venv\Scripts\Activate.ps1
in a Windows Powershell terminal; - For Linux/macOS, execute
source venv/bin/activate
in a bash/zsh terminal.
- For Windows, execute
- For command line shells, a developer should initialize the environment by sourcing
corresponding
- Install dependencies
pip3 install -r requirements.txt
- Open the project in your IDE. Your IDE should recognize the virtual environment and use it upon opening the project.
- Install
- Pull master branch before doing anything:
git pull
- Checkout a new branch:
git checkout -b your-branch-name
- Make changes
- Add and commit changes:
git add . && git commit
- Push changes to the remote branch:
git push
- Open a pull request
- Request for peer review
- Merge in to master branch
- Format your code before committing changes.
- Annotate type of every variable if possible.
- Avoid deep nesting in the code.
If the code uses more than 4 indentations, you may need to cut it down possibly by:
- Converting
if-else
statements toif
guards; - Refactoring the logic into smaller functions;
- Using
itertools
to flatten loops;
- Converting
- Write good comments when code cannot document itself.
- Use private fields and property decorator for class attributes