Modern Python scaffolding framework inspired by NestJS CLI - scaffold FastAPI projects with Docker, Alembic, and production-ready structure
Project description
BoringPy
Modern Python scaffolding framework inspired by NestJS CLI - scaffold production-ready FastAPI projects in seconds.
โจ Features
- ๐ Instant FastAPI Projects - Generate complete APIs with Docker, Alembic, and tests
- ๐๏ธ Database Ready - PostgreSQL, MySQL, or SQLite with SQLModel ORM
- ๐ณ Docker First - Full docker-compose setup with hot reload
- ๐ฆ UV Powered - Lightning-fast package management with uv
- ๐ฏ Type Safe - Full type annotations and strict type checking
- ๐๏ธ Monorepo Ready - Workspace support for multiple APIs and shared libraries
- ๐งช Test Infrastructure - pytest with coverage reporting
- ๐ Professional Makefile - 30+ commands for development workflow
๐ฆ Installation
Requirements
- Python 3.13+
- uv package manager
Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install BoringPy
pip install boringpy
Or with uv:
uv tool install boringpy
๐ Quick Start
1. Create a Workspace
boringpy init my-workspace
cd my-workspace
This creates:
my-workspace/
โโโ src/
โ โโโ apps/ # Generated APIs
โ โโโ libs/ # Shared libraries
โ โโโ scripts/ # Utility scripts
โโโ boringpy.json # Workspace config
โโโ pyproject.toml # UV workspace
โโโ README.md
2. Generate Your First API
boringpy generate api my_blog --port 8000 --db postgresql
This creates a complete FastAPI application with:
- โ FastAPI with async/await
- โ SQLModel ORM + Alembic migrations
- โ Docker & docker-compose
- โ Environment-based configuration
- โ Structured logging
- โ pytest test suite
- โ Professional Makefile
- โ Health check endpoints
- โ API documentation (Swagger/ReDoc)
3. Run Your API
cd src/apps/my_blog
# Copy environment file
cp .env.example .env
# Start with Docker (recommended)
make docker-up
# Run migrations
make db-upgrade
# View logs
make docker-logs
# Stop containers
make docker-down
Your API is now running at http://localhost:8000!
- API Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Health: http://localhost:8000/health
๐ Usage
Commands
# Show version
boringpy --version
# Show help
boringpy --help
# Initialize workspace
boringpy init <workspace-name>
# Generate FastAPI application
boringpy generate api <name> [OPTIONS]
--port INTEGER API port (default: 8000)
--db TEXT Database type: postgresql, mysql, sqlite (default: postgresql)
# Coming soon
boringpy generate lib <name> # Generate shared library
boringpy generate model <name> # Generate SQLModel
Database Options
PostgreSQL (default):
boringpy generate api my_api --db postgresql
MySQL:
boringpy generate api my_api --db mysql
SQLite (no container needed):
boringpy generate api my_api --db sqlite
Generated API Makefile Commands
Every generated API includes a comprehensive Makefile:
# Development
make dev # Run API locally
make dev-reload # Run with auto-reload
make test # Run tests
make test-cov # Run tests with coverage
# Code Quality
make format # Format code with ruff
make lint # Lint code
make typecheck # Type check with ty
make check # Run all checks
# Docker
make docker-build # Build Docker image
make docker-up # Start containers
make docker-down # Stop containers
make docker-logs # View logs
make docker-shell # Shell into container
# Database
make db-upgrade # Run migrations
make db-downgrade # Rollback migration
make db-create-migration MSG="description" # Create migration
make db-history # View migration history
make db-shell # Database shell
๐๏ธ Project Structure
Generated APIs follow this structure:
my_api/
โโโ app/
โ โโโ core/
โ โ โโโ config.py # Settings & configuration
โ โ โโโ database.py # Database connection
โ โ โโโ logger.py # Logging setup
โ โ โโโ lifespan.py # App lifecycle
โ โโโ models/
โ โ โโโ base.py # Base SQLModel
โ โ โโโ example.py # Example model
โ โโโ api/
โ โ โโโ deps.py # Dependencies
โ โ โโโ v1/
โ โ โโโ endpoints/
โ โ โโโ health.py
โ โโโ services/ # Business logic
โ โโโ main.py # FastAPI app
โโโ migrations/ # Alembic migrations
โโโ tests/ # pytest tests
โโโ docker-compose.yml # Multi-container setup
โโโ Dockerfile # Multi-stage build
โโโ Makefile # Development commands
โโโ .env.example # Environment template
โโโ alembic.ini # Migration config
โโโ README.md # API documentation
๐ง Configuration
Workspace Config (boringpy.json)
{
"version": "0.1.0",
"type": "workspace",
"defaults": {
"api": {
"db_type": "postgresql",
"port": 8000
}
},
"workspace_members": [
"src/apps/my_api"
]
}
API Environment (.env)
# Application
APP_NAME=my_api
APP_VERSION=0.1.0
DEBUG=true
# Server
HOST=0.0.0.0
PORT=8000
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/db
DB_ECHO=false
DB_POOL_SIZE=5
DB_MAX_OVERFLOW=10
# Logging
LOG_LEVEL=INFO
๐ฏ Use Cases
Single API Project
boringpy init my-project
cd my-project
boringpy generate api backend --port 8000
Microservices Monorepo
boringpy init my-company
cd my-company
boringpy generate api users_service --port 8001
boringpy generate api orders_service --port 8002
boringpy generate api payments_service --port 8003
API + Shared Libraries
boringpy init my-platform
cd my-platform
boringpy generate api web_api --port 8000
boringpy generate lib auth_utils # Coming soon
boringpy generate lib database_models # Coming soon
๐ ๏ธ Technology Stack
Generated projects use:
- FastAPI - Modern async web framework
- SQLModel - SQL databases with Python types
- Alembic - Database migrations
- Pydantic - Data validation
- uvicorn - ASGI server
- pytest - Testing framework
- ruff - Linting & formatting
- Docker - Containerization
- uv - Package management
๐ Examples
Minimal Example
# Create and run an API in 4 commands
boringpy init blog
cd blog
boringpy generate api api --db sqlite
cd src/apps/api && make dev
Production Example
# Full production setup with PostgreSQL
boringpy init production-app
cd production-app
boringpy generate api api --port 8000 --db postgresql
cd src/apps/api
cp .env.example .env
# Edit .env with production values
make docker-build
make docker-up
make db-upgrade
๐ค Why BoringPy?
BoringPy takes the "boring" out of project setup. No more:
- โ Manual FastAPI boilerplate
- โ Copying docker-compose files
- โ Setting up Alembic from scratch
- โ Writing Makefiles
- โ Configuring logging
Just run boringpy generate api and start building features immediately.
Inspired by NestJS CLI - but for Python and FastAPI.
๐บ๏ธ Roadmap
- Workspace initialization
- FastAPI API generation
- Multi-database support
- Docker setup
- Alembic migrations
- Library generation
- SQLModel generator
- CRUD endpoint generator
- Authentication templates
- AWS/GCP deployment helpers
- Plugin system
๐ค Contributing
Contributions welcome! Please check out our contributing guidelines.
๐ License
MIT License - see LICENSE for details.
๐ Acknowledgments
- Inspired by NestJS CLI
- Powered by Astral tooling (uv, ruff)
- Built with Typer and Rich
Built with โค๏ธ for the Python community
โญ Star us on GitHub | ๐ฆ PyPI Package | ๐ Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boringpy-0.1.1.tar.gz.
File metadata
- Download URL: boringpy-0.1.1.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7daec203ece4c9669e1433376506f34bf8c489b0b8528c8a54676c6334d510ee
|
|
| MD5 |
d5462412bda09b69eac88066d5529fff
|
|
| BLAKE2b-256 |
0e828ab815c6bbf49285cff28e7e07120ac43103afd213847bbe053b9c791dc2
|
File details
Details for the file boringpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: boringpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50362bf5ceb7e5e0e4244ebd0e5514ade8a6290f5107b67683063014da99bb68
|
|
| MD5 |
6a1b00a70ebe639b90e0213bd3b6e5ae
|
|
| BLAKE2b-256 |
12b72d1f7791aa44c2b37f96b7d7dcdcee56196d4269c327c44d530897a61c7f
|