This is a highly opinionated template for Python projects that provides a solid foundation for building modern Python applications with best practices and modern tooling.
Note: This project has been tested and verified only on macOS. While it may work on other operating systems, we cannot guarantee full compatibility.
Before you begin, ensure you have the following installed:
- Python 3.8 or higher
- uv - Fast Python package installer
- just - Command runner
- Docker and Docker Compose - For containerization
-
On github.com, navigate to the main page of the repository.
-
Above the file list, click Use this template.
-
Select Create a new repository.
-
Type a name for your repository, and an optional description.
-
Click Create repository from template.
-
Wait about 20 seconds then refresh this page. GitHub Actions will automatically update the README.md.
-
Clone your locally created repository:
git clone git@github.com/{your-new-repo}.git
Then open the project in your favorite IDE.
-
Install the package installer uv:
pip install uv
-
Create and activate a virtual environment:
uv venv source .venv/bin/activate # On Unix/macOS # or .venv\Scripts\activate # On Windows
-
Install development dependencies:
just dev-deps
-
Build the Docker container:
just build
-
Start the application:
just up
python-project-template/
├── .github/ # GitHub Actions workflows
├── src/ # Source code
├── tests/ # Test files
├── .pre-commit-config.yaml # Pre-commit hooks configuration
├── dev-requirements.in # Development dependencies
├── requirements.in # Production dependencies
├── justfile # Just commands
└── docker-compose.yml # Docker configuration
The following commands are available in the justfile:
Command | Description |
---|---|
venv |
Create a virtual environment |
dev-deps |
Install development dependencies |
deps |
Install production dependencies |
build |
Build the Docker container |
up |
Start the application |
stop |
Stop the application |
down |
Stop and remove containers |
ruff |
Run code linting and formatting |
test |
Run tests |
Just is a command runner that simplifies running project commands. You can install it using your package manager:
- macOS:
brew install just
- Linux:
sudo apt-get install just
or equivalent for your distribution - Windows:
choco install just
orscoop install just
Before you can run hooks, you must have the pre-commit package manager installed. It helps maintain code quality by running checks before each commit.
Ruff aims to be significantly faster than alternative tools while integrating more functionality behind a single, common interface. It's used for linting and formatting Python code.
The pytest framework makes it easy to write small, readable tests, and can scale to support complex functional testing for applications and libraries.
An extremely fast Python package installer and resolver, written in Rust. Designed as a drop-in replacement for common pip and pip-tools workflows.
Feel free to submit issues and enhancement requests!
This project is licensed under the MIT License - see the LICENSE file for details.