Assuming you have pyenv and Poetry, clone the repository and run:
# Use Python 3.9.9 in the project
pyenv local 3.9.9
# Tell Poetry to use pyenv
poetry env use $(pyenv which python)
# Install dependencies
poetry install
# Activate the virtual environment
poetry shell
# Install pre-commit hooks
pre-commit install
We've tried to keep necessary things as simplistic as possible. However, we need to install some things.
This project uses Poetry for creating virtual environments and managing Python packages. This should be installed globally and can be done by running:
curl -sSL https://install.python-poetry.org | python3 -
You can verify it's installed and accessible by running poetry --version
.
Once you've got Poetry installed, we think it's best to install Python dependencies into a .venv/
folder within the cloned repo. Tell Poetry to handle this for you:
poetry config virtualenvs.in-project true
For more on how to manage, add, remove, and update dependencies, see the official Poetry documentation.
There are two ways of managing your Python environments. We recommend pyenv, but we have also included instructions for Anaconda.
Install pyenv following the instructions within the official repo for your system. Remember to do step 2!
You can verify it's installed with pyenv --version
.
- Install the Python version you want with
pyenv install 3.9.9
- Go to the cloned repo
- Assign the specific Python version to the project by running
pyenv local 3.9.9
If you want a different version of Python, just change the version in the steps.
Install Anaconda using the instructions on the official website.
Then create an environment for your project by running:
conda create -n PROJECT_NAME python=3.9
conda activate PROJECT_NAME
- Dependency management with Poetry
- Easier task running with Poe the Poet
- Code formatting with Black and Prettier
- Linting with pre-commit and Flake8, using the strict wemake-python-styleguide
- Automated Python Docstring Formatting with docformatter
- Continuous integration with GitHub Actions
- Testing with pytest
- Code coverage with coverage.oy
- Static type-checking with mypy
- Automated Python syntax updates with pyupgrade
- Security audit with Bandit
- Automated release notes with Release Drafter
- Manage project labels with GitHub Labeler
- Automated dependency updates with Dependabot
To ensure all code is standardized, we use black, along with other automatic formatters. To enforce a consistent coding style, we use Flake8 with the wemake-python-styleguide. To verify and enforce type annotations, we use mypy. Common tasks can be called using Poe the Poet.
Poe the Poet is a task runner that works well with Poetry. To see what tasks exist, run poe
in your terminal. If you want to add more tasks, check the documentation and what already exists.
If you have issues getting poe
to work, make sure that you are already within the activated shell (by running poetry shell
).
If you want to automatically format on every commit, you can use pre-commit. As mentioned above, run pre-commit install
and it will install the hooks.
To manually format all files, run
poe format
If you want to check the linting rules on the codebase, run
poe lint
If you want to check types on the codebase, run
poe typecheck
We've settled on a middle ground when it comes to developing: keep the main
branch clean.
Within branches, you can do whatever you want to do, but you should never push anything directly to the main
branch.
For every PR, an automated set of linters and formatters will check your code to
see whether it follows the set rules. If it fails, do not merge with the
main
branch.