A modern Python monorepo template using uv for fast dependency management and workspace organization.
This project uses a uv workspace structure:
.
├── apps/
│ └── sample-app/ # Sample application package (rename this)
│ ├── src/ # Source code
│ ├── tests/ # Tests
│ └── pyproject.toml # Package configuration
├── .github/
│ └── workflows/ # GitHub Actions workflows
├── pyproject.toml # Workspace configuration
├── release-please-config.json # Release Please configuration
├── .release-please-manifest.json # Release Please manifest
└── README.md # This file
- Python 3.11+
- uv package manager
Before using this template, you'll need to replace the following placeholder values:
-
Project Name: Replace
sample-appthroughout the codebase with your actual project name:- Directory name:
apps/sample-app/→apps/your-project-name/ - Package name in
apps/sample-app/pyproject.toml - Import statements in source code
- Script entry points
- Directory name:
-
Template Placeholders: Replace any remaining template placeholders:
{{project_name}}in configuration files- Author information in
pyproject.tomlfiles - Repository URLs and descriptions
-
Package Structure: Update the package structure in
apps/sample-app/src/sample_app/to match your project name
- Clone the repository:
git clone <repository-url>
cd your-project-name- Install dependencies using uv:
uv sync- Install pre-commit hooks:
uv run pre-commit install# Run the sample app (update command after renaming)
uv run python -m sample_app
# Or use the script entry point
uv run sample-app# Run all tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=src --cov-report=html
# Run tests for a specific app
uv run pytest apps/sample-app/tests/# Format code
uv run ruff format
# Lint code
uv run ruff check
# Fix linting issues automatically
uv run ruff check --fix
# Run pre-commit hooks
uv run pre-commit run --all-files- Create a new branch for your feature/fix
- Make your changes
- Run tests and ensure they pass
- Run code quality checks
- Commit your changes (pre-commit hooks will run automatically)
- Push your branch and create a pull request
To add a new application to the workspace:
- Create a new directory under
apps/:
mkdir apps/new-app-
Create a
pyproject.tomlfile following the pattern inapps/sample-app/pyproject.toml -
Set up the source structure:
mkdir -p apps/new-app/src/new_app
mkdir -p apps/new-app/tests- The workspace will automatically detect the new app after running
uv sync
This project uses Release Please for automated releases. The workflow requires a PERSONAL_GITHUB_ACCESS_TOKEN secret with contents: write and pull-requests: write permissions.
Prompt for your coding agent:
"Please set up the Release Please GitHub Actions secret for this repository. Go to the repository Settings → Secrets and variables → Actions and create a new repository secret named
PERSONAL_GITHUB_ACCESS_TOKEN. The token needscontents: writeandpull-requests: writepermissions on this repository. If I already have a personal access token with these scopes, use that. Otherwise, guide me to create one athttps://github.com/settings/tokens."
Use conventional commit messages for automatic version bumping:
feat:- New features (minor version bump)fix:- Bug fixes (patch version bump)feat!:orfix!:- Breaking changes (major version bump)docs:,style:,refactor:,test:,chore:- No version bump
- Fast dependency management with uv
- Monorepo structure for multiple related packages
- Pre-commit hooks for code quality
- Automated testing with pytest and coverage
- Code formatting with ruff
- Automated releases with Release Please
- GitHub Actions workflows for CI/CD
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass and code quality checks pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.