To contribute to the base framework, you need to sign the Contributor License Agreement and follow the Development Guide.
This project uses Black for code formatting and flake8 for linting. To check your code:
# Install tools
pip install black flake8 autoflake
# Remove unused imports
autoflake --in-place --remove-all-unused-imports --recursive .
# Check formatting (add --diff to see changes)
black --check .
# Format code
black .
# Run linter (will catch trailing whitespaces)
flake8 .
You can also run the tools on specific directories:
autoflake --in-place --remove-all-unused-imports --recursive src/ tests/
black src/ tests/
flake8 src/ tests/
The recommended order is:
- Run autoflake to remove unused imports
- Run black to format the code
- Run flake8 to check for remaining issues
Flake8 will report trailing whitespaces with these warnings:
- W291: trailing whitespace
- W293: blank line contains whitespace
To automatically remove trailing whitespaces, you can use the strip-trailing-whitespace
command in VS Code or run this command:
# Find files with trailing whitespaces
find . -type f -name "*.py" -exec grep -l "[[:space:]]$" {} \;
# Remove trailing whitespaces (macOS/Linux)
find . -type f -name "*.py" -exec sed -i '' -e 's/[[:space:]]*$//' {} \;
# Remove trailing whitespaces (Linux only)
find . -type f -name "*.py" -exec sed -i 's/[[:space:]]*$//' {} \;
To run the test suite:
pytest tests/ -v
For test coverage information:
pytest tests/ -v --cov=src
The repository is configured with GitHub Actions that automatically run linting and tests on every push and pull request. The workflow configuration can be found in .github/workflows/tests.yml
.
To ensure your PR can be merged:
- Make sure all tests pass locally
- Run the linter and fix any issues
- Format your code with Black