A Python project starter kit with testing, linting, and code quality tools configured.
- Python 3.10 or higher
- Poetry (Python package manager)
If you don't have Poetry installed:
curl -sSL https://install.python-poetry.org | python3 -- Clone this repository
- Install dependencies:
poetry install
- Set up pre-commit hooks (runs checks automatically before each commit):
poetry run pre-commit install
Run all tests:
poetry run pytestRun tests with coverage report:
poetry run pytest --covRun tests in parallel (faster):
poetry run pytest -n autoLinting (check for code issues):
poetry run ruff check .Auto-fix issues:
poetry run ruff check . --fixFormatting (standardize code style):
poetry run ruff format .Type Checking (catch type-related bugs):
poetry run mypy .Security Scanning (find potential vulnerabilities):
poetry run bandit -r src pythonsqaOnce installed, pre-commit hooks automatically run before each commit to check:
- Code formatting (ruff)
- Linting (ruff)
- Type checking (mypy)
- Security issues (bandit)
If any check fails, the commit will be blocked. Fix the issues and try again.
pythonsqa/
├── src/ # Source code goes here
├── tests/ # Test files (test_*.py)
├── pyproject.toml # Project configuration and dependencies
└── README.md # This file
Place test files in the tests/ directory with names starting with test_:
# tests/test_example.py
def test_addition():
assert 1 + 1 == 2Run your specific test file:
poetry run pytest tests/test_example.py| Task | Command |
|---|---|
| Install dependencies | poetry install |
| Run tests | poetry run pytest |
| Check code style | poetry run ruff check . |
| Format code | poetry run ruff format . |
| Type check | poetry run mypy . |
| Security scan | poetry run bandit -r src pythonsqa |
- Check tool documentation if you encounter errors
- Ask your team lead for clarification
- Review test examples in the
tests/directory