This is a sample project structure template for a Python project. I use this template in most of my projects.
It contains a bunch of shell files, that can be executed using the make command.
Note: If you want to use this for now, you can do a project-wide search and
replace for sample_project
and SampleProject
with your project name.
Will be adding the support for cookie cutter soon.
make setup
: Setups the development environmentmake lint
: Runs the lint process using mypy and ruffmake format
: Formats the project using ruffmake unit_test
: Runs the unit testmake integration_test
: Runs the integration testmake e2e_test
: Runs the e2e test
The project comes with Dockerfile which performs the multistage build The docker image would not have development and test dependencies installed, and the final image would have only installed production dependencies.
To test inside the container you can use the docker compose.
docker compose run dev
: Runs the code based on the base docker imagedocker compose run unit_tests
: Runs the unit_tests inside the container.docker compose run integration_tests
: Runs the integration_tests inside the container.docker compose run e2e_tests
: Runs the e2e_tests inside the container.
Poetry is used for managing the dependencies of the project.
project.toml
file contains the configuration for the various tools used in this project.
poetry add --group test coverage
: Installs the coverage package as a test dependencypoetry add pydantic
: Installs the pydantic package as a dependencypoetry config --list
: Quickly check the environment variables related to the poetrypoetry run <Any commad>
: Runs the command inside the poetry virtual environmentpoetry shell
: Activates the poetry virtual environment
- Add support for GitHub actions
- Add support for cookie-cutter