CLI for services template for Python (FastAPI, SQLAlchemy, Alembic)
Project description
Skeletone
A minimal, well-toned Python project skeleton and micro-framework for rapid backend development.
Built on top of FastAPI, SQLAlchemy, and Alembic with automated template versioning, advanced logging, and production-ready features.
Features
- ๐ FastAPI foundation with modern Python async practices
- ๐๏ธ SQLAlchemy (async) ORM with Alembic migrations
- ๐งฉ Minimal framework structure with clear folder layout
- ๐ฆ Template management: init, upgrade, downgrade, version lock
- ๐ Patch-based updates between template versions (v1.1.0 to v1.9.0)
- ๐ Incremental version tracking via
skeletone.lock - ๐ Advanced Request Logging: All incoming API requests logged to database
- ๐งพ Batch Logging System with async buffer and periodic flush (v1.4.0+)
- ๐ก๏ธ Bulkhead Pattern middleware for concurrency control (v1.9.0+)
- ๐ Lifespan Management for startup/shutdown tasks
- โก Production-ready - optimized for performance and reliability
What's New in Latest Versions
v1.9.0
- โจ Bulkhead Middleware: Control max concurrent requests to prevent overload
- ๐๏ธ Restructured middleware organization
v1.8.0 - v1.7.0
- ๐ Enhanced logging service architecture
- ๐ง Improved lifespan management
v1.6.0 - v1.4.0
- ๐ Batch Logging: Logs are buffered and flushed periodically for better performance
- โฑ๏ธ Async logging with configurable flush intervals
- ๐ Graceful shutdown with log flushing
v1.3.0 - v1.1.0
- ๐ Initial request logging to database
- ๐๏ธ Base project structure with FastAPI + SQLAlchemy
Installation
pip install skeletone
Quick Start
1. Initialize a New Project
mkdir my-awesome-api && cd my-awesome-api
skeletone init
2. Check Available Versions
skeletone versions
3. Upgrade Your Project
skeletone upgrade
4. Rollback if Needed
# Interactive version selection
skeletone downgrade
# Or specify version directly
skeletone downgrade -v v1.2.0
CLI Commands
| Command | Description |
|---|---|
skeletone init |
Initialize new project from latest template |
skeletone upgrade |
Upgrade to latest template version |
skeletone downgrade |
Downgrade to a previous template version |
skeletone versions |
List all available template versions |
skeletone help |
Show detailed help and usage examples |
How It Works
Skeletone is built around a patch-based versioning system:
- Init: Sets up a fresh project from the latest template (currently v1.9.0)
- Upgrade: Applies sequential
.patchdiffs to upgrade your project - Downgrade: Applies reverse patches to safely revert
- Track: Saves current version to
skeletone.lock
Template Structure
The generated project includes:
your-project/
โโโ app/
โ โโโ models/ # SQLAlchemy models (async)
โ โโโ routers/ # FastAPI route handlers
โ โโโ dependencies/ # DI system & authorization
โ โโโ services/ # Business logic & logging service
โ โโโ middlewares/ # Request logging & bulkhead pattern
โ โโโ lifespan/ # Startup/shutdown management
โ โโโ utils/ # Enums, configs, helpers
โโโ alembic/ # Database migrations
โโโ config.py # App settings
โโโ main.py # FastAPI application entrypoint
โโโ requirements.txt # Dependencies
โโโ skeletone.lock # Template version lock file
Key Components
๐ก๏ธ Bulkhead Middleware (v1.9.0+)
Prevents system overload by limiting concurrent requests:
app.add_middleware(BulkheadMiddleware, max_concurrent_requests=40, timeout=0)
๐ Advanced Logging System
- Request Logger: Automatically logs all HTTP requests with path, method, status, response time
- Batch Processing: Logs are buffered and flushed periodically for optimal performance
- Database Storage: All logs stored in PostgreSQL for analysis
- Async Everything: Non-blocking logging that doesn't impact response times
๐ Lifespan Management
Clean startup and shutdown handling:
- Initialize services on startup
- Gracefully close connections on shutdown
- Flush pending logs before termination
Example Workflow
# Create and initialize a new project
mkdir blog-api && cd blog-api
skeletone init
# Do your development work...
# Upgrade to latest version (v1.9.0)
skeletone upgrade
# Check available versions
skeletone versions
# Shows: v1.9.0 (current), v1.8.0, v1.7.0, ... v1.1.0
# Rollback if needed
skeletone downgrade -v v1.1.0
Version Table Example
Available Skeletone Versions
โโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ Version โ Status โ
โโโโโโโโโโโผโโโโโโโโโโโโโโค
โ v1.9.0 โ โ
Current โ
โ v1.8.0 โ โ
โ ... โ โ
โ v1.1.0 โ โ
โโโโโโโโโโโดโโโโโโโโโโโโโโ
Best Practices
- Always commit your code before upgrade/downgrade
- Review diffs and changes after updating
- Thoroughly test after version transitions
- Track your modifications to avoid patch conflicts
- Configure bulkhead limits based on your server capacity
- Monitor logs regularly for performance insights
Template Repository
The base template for Skeletone lives here:
๐ https://github.com/yoursteacup/skeletone
Contributing
Contributions are welcome! Please see the GitHub repo for guidelines and issue tracking.
Author
Developer: Zhaxybayev Daulet
GitHub: yoursteacup
Telegram: @yoursteacup
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 skeletone-0.1.15.tar.gz.
File metadata
- Download URL: skeletone-0.1.15.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63ad8346065c8282cbe68c7b448418b832571740931a915b5328323ef9493799
|
|
| MD5 |
6433ea1d58911290c9a83486396497d4
|
|
| BLAKE2b-256 |
02168d7bda33b66e485c0a8bbc18d3ce4d69a832ccd52a7509402302224c0955
|
File details
Details for the file skeletone-0.1.15-py3-none-any.whl.
File metadata
- Download URL: skeletone-0.1.15-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cca7d050ca111d2f18d986f51f42920f57c80ac607572c35c4da9de363b96afa
|
|
| MD5 |
281207de36297388157b6e5fe7632fef
|
|
| BLAKE2b-256 |
6b71f095c46b2dd68bfb97f2525adef6c7eb3b223cb50eb34b0311135e1f54cd
|