ZodiacCore-Py
Stop copy-pasting your FastAPI infrastructure.
An opinionated, async-first core library, CLI, and agent-ready quality loop.
🎯 Mission
Stop copy-pasting your infrastructure code.
Every new FastAPI project starts the same way: setting up logging, error handling, database sessions, pagination... It's tedious, error-prone, and inconsistent across teams.
ZodiacCore solves this in three ways: a library you drop into any FastAPI app, a CLI that scaffolds a full project in seconds, and a quality loop so you — or your coding agent — build on it correctly.
✨ Key Features
- 🔍 Observability First: Built-in JSON structured logging with Trace ID injection across the entire request lifecycle (Middleware → Context → Log).
- 🛡️ Robust Error Handling: Centralized exception handlers that map
ZodiacExceptionto standard HTTP 4xx/5xx JSON responses. - 💾 Database Abstraction: Async SQLAlchemy session management and
BaseSQLRepositorywith pagination helpers (paginate_query). - 🎁 Standard Response Wrapper: Automatic wrapping of API responses into
code/data/messageviaAPIRouter. - 📄 Standard Pagination:
PageParamsandPagedResponse[T]with repository integration. - ⚡ Async Ready: Python 3.12–3.14 async/await from the ground up.
- ⌨️ zodiac CLI: Scaffold a 3-tier FastAPI project (DI, routers, config) with one command.
- 🔎 Wiring Checks:
zodiac checkAST-scans services for envelope, exception, session, HTTP, and middleware wiring anti-patterns. - 🧩 Developer Skills: Version-matched docs and adoption audits ship in the wheel, linked with
zodiac skills install.
📦 Quick Install
| Use case | Install |
|---|---|
| Library only (use in your app) | uv add zodiac-core |
| Library + CLI (scaffold new projects) | uv add "zodiac-core[zodiac]" |
Extras (combinable): zodiac-core[sql] (SQLModel), zodiac-core[mongo] (Motor, helpers planned), zodiac-core[cache] (aiocache), zodiac-core[zodiac] (CLI). See the Installation Guide for details.
🚀 Ways to use ZodiacCore
1. Scaffolding (fastest start)
Use the zodiac CLI to generate a full project: 3-tier architecture, dependency injection, config, and tests.
Note:
dfd-servicebelow is the name of the new project you want to create; replace it with your own.
mkdir dfd-service
cd dfd-service
uv init --python 3.12
uv add "zodiac-core[zodiac,sql]"
zodiac new dfd-service --tpl standard-3tier -o .. --force
uv add "fastapi[standard]" --dev
uv run zodiac skills install
uv run zodiac check
uv run fastapi run --reload
Open http://127.0.0.1:8000/docs and http://127.0.0.1:8000/api/v1/health. See Getting started and CLI docs.
2. Library (use in your own app)
Add zodiac-core to an existing FastAPI project and wire up logging, middleware, and response wrapping.
from fastapi import FastAPI
from loguru import logger
from zodiac_core.exception_handlers import register_exception_handlers
from zodiac_core.exceptions import NotFoundException
from zodiac_core.logging import setup_loguru
from zodiac_core.middleware import register_middleware
from zodiac_core.routing import APIRouter
setup_loguru(level="INFO", json_format=True)
app = FastAPI()
register_middleware(app)
register_exception_handlers(app)
router = APIRouter()
@router.get("/items/{item_id}")
async def read_item(item_id: int):
logger.info(f"request: item_id={item_id}")
if item_id == 0:
raise NotFoundException(message="Item not found")
return {"item_id": item_id}
app.include_router(router)
🛠️ Developer & quality loop
Building on that core is also made safer for people and coding agents. Services
get a quality loop: look up the version-matched docs before writing, audit
adoption with a skill that runs zodiac check, and honor the project rules in
AGENTS.md.
| Part | What it is | What it gives you |
|---|---|---|
| Core | zodiac_core |
Logging, exceptions, DB, pagination, response, config, routing, schemas |
| Pre-coding | zodiac-docs |
Version-matched docs + source-map before editing |
| Audit & fix | zodiac-core-integration-summary |
✅/❌/➖/❓ matrix; runs zodiac check for mechanical evidence and applies change |
| Project rules | AGENTS.md |
Session ownership, lifecycle, DI/layering judgment |
📚 Documentation
- Online: https://ttwshell.github.io/ZodiacCore-Py/ (multiple versions via release).
- Local:
make docs-serve(sources indocs/). - Developer skills: reusable agent skills ship in the
zodiac-corewheel underzodiac/skills/. Link them withuv run zodiac skills install. Usezodiac-docsfor version-aware framework guidance (including looking up docs before writing APIs) andzodiac-core-integration-summaryfor adoption audits (zodiac check --format jsonsupplies mechanical wiring evidence). See the skills guide.
🤝 Contributing
Contributions are welcome. Please read CONTRIBUTING.md for development setup and workflow.
📄 License
This project is licensed under the MIT License.
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 zodiac_core-0.14.2.tar.gz.
File metadata
- Download URL: zodiac_core-0.14.2.tar.gz
- Upload date:
- Size: 105.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e885e182a9e3479a9990ee2342dd0d39e3164cbb540a79cab5130c4c3a04ff58
|
|
| MD5 |
32434852a88b41fe33998eb0a517071a
|
|
| BLAKE2b-256 |
a99247468d8dfbefedf7eb84d03853554f09ba172b237021999c1681dd500201
|
Provenance
The following attestation bundles were made for zodiac_core-0.14.2.tar.gz:
Publisher:
ci.yml on TTWShell/ZodiacCore-Py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zodiac_core-0.14.2.tar.gz -
Subject digest:
e885e182a9e3479a9990ee2342dd0d39e3164cbb540a79cab5130c4c3a04ff58 - Sigstore transparency entry: 2624127789
- Sigstore integration time:
-
Permalink:
TTWShell/ZodiacCore-Py@c55a63ebcefeb93c4b1b37baf29ae08c939fecbe -
Branch / Tag:
refs/tags/0.14.2 - Owner: https://github.com/TTWShell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c55a63ebcefeb93c4b1b37baf29ae08c939fecbe -
Trigger Event:
release
-
Statement type:
File details
Details for the file zodiac_core-0.14.2-py3-none-any.whl.
File metadata
- Download URL: zodiac_core-0.14.2-py3-none-any.whl
- Upload date:
- Size: 113.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09c90c03e17b8cb15efebf93b8199200ca25ee2150d832952002eeaa5e63d631
|
|
| MD5 |
20ffd620d2782d0fc21886c264932260
|
|
| BLAKE2b-256 |
88dde0afc3de50cb1ba2fc791d6e9b207dcc47a27f0fa08dacdd0ed326beaca5
|
Provenance
The following attestation bundles were made for zodiac_core-0.14.2-py3-none-any.whl:
Publisher:
ci.yml on TTWShell/ZodiacCore-Py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zodiac_core-0.14.2-py3-none-any.whl -
Subject digest:
09c90c03e17b8cb15efebf93b8199200ca25ee2150d832952002eeaa5e63d631 - Sigstore transparency entry: 2624127866
- Sigstore integration time:
-
Permalink:
TTWShell/ZodiacCore-Py@c55a63ebcefeb93c4b1b37baf29ae08c939fecbe -
Branch / Tag:
refs/tags/0.14.2 - Owner: https://github.com/TTWShell
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@c55a63ebcefeb93c4b1b37baf29ae08c939fecbe -
Trigger Event:
release
-
Statement type: