Develop¶
1. Code Style¶
We adopt PEP8 as the preferred code style.
We use the following tools for linting and formatting: - flake8: linter - yapf: formatter - isort: sort imports
Style configurations of yapf and isort can be found in setup.cfg.
We use a pre-commit hook that checks and formats for flake8, yapf, seed-isort-config, isort, trailing whitespaces,
fixes end-of-files, and sorts requirements.txt automatically on every commit.
The config for the pre-commit hook is stored in .pre-commit-config.
After you clone the repository, you will need to install and initialize the pre-commit hook:
pip install -r requirements-test.txt
pre-commit install
After this, code linters and formatters will be enforced on every commit.
If you want to use pre-commit to check all the files, you can run:
pre-commit run --all-files
If you only want to format and lint your code, you can run:
make linter
2. Tests¶
Run the current root implementation, archived compatibility suites, or the complete suite with:
python -m pytest tests --ignore=tests/legacy_1x -q
python -m pytest tests/legacy_1x -q
python -m pytest tests -q
Current coverage uses coverage run -m pytest tests
--ignore=tests/legacy_1x, followed by coverage report -m.