This is a Brownie project template preconfigured for:
- Continuous integration with Github Actions
- Standardized testing environments with tox
- Linting checks using black, flake8 and isort
- Pre-commit for linting hooks
Please read this entire document carefully to ensure the proper setup of each component.
Feel free to join us in the Brownie Gitter channel, or open an issue if you encounter a problem with this template.
-
Install Brownie, if you haven't already.
-
Use the
bake
command to initialize a new project from this template:brownie bake github-actions
It is strongly recommended use a virtual environment with this project. This ensures that dependencies are strictly contained within your project and will not alter or affect your other development environment.
To create a new virtual environment and install the required dependencie:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
In future sessions, activate the virtual environment with:
source venv/bin/activate
To learn more about venv
, see the official Python documentation.
Pre-commit is a tool that executes linting checks each time you make a commit. It is useful for enforcing proper codestyle and preventing commits that would fail the linting build.
To install pre-commit locally:
pre-commit install
Once installed, the pre-commit hooks will automatically run each time you make a commit.
Github Actions is a hosted continuous integration service provided by Github. It runs your project tests each time you push a new commit or open a pull request, providing quick feedback on the outcome of each change.
Github Actions is provided free for public repositories. It is automatically enabled - if you create your own project with this mix as a base it will be active whenever you push a commit.
Depending on the requirements of your project, you may need to set the following environment variables:
ETHERSCAN_TOKEN
: Etherscan API token, required if you are querying source files from Etherscan.GITHUB_TOKEN
: Github personal access token, required by py-solc-x when querying installable solc versions.WEB3_INFURA_PROJECT_ID
: Infura project ID, required for connecting to Infura hosted nodes.
See the official Github Actions documentation for information on how to set environment variables.
This project uses tox to standardize the local and remote testing environments.
To run all of your project's unit tests and perform linting checks:
tox
To run only the linting checks:
tox -e lint
This project is licensed under the MIT license.