- Manage project dependencies with poetry
- Linting and formatting with mypy, black, autoflake, isort
- Testing with pytest
- (Optional) Create virtual environment:
python3 -m venv venv && source venv/bin/activate
- Install poetry:
pip install poetry
- There're 3 groups of dependencies: main, dev, test
- Add to main group:
poetry add <package_name>
- Add to dev group:
poetry add <package_name> --group dev
- Add to test group:
poetry add <package_name> --group test
- Install dependencies for project:
poetry install
- Format and import:
sh scripts/format-import.sh
- Lint:
sh scripts/lint.sh
- Alembic
- Auto generate migration:
alembic revision --autogenerate -m "migration message"
- Pytest auto discover: https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#test-discovery
- File name for testing:
test_*.py
or*_test.py
- Write test function with name like:
test*
- Write test class with name like:
Test*
with test method liketest*
- TBD