Skip to main content

ZodiacCore-Py

Python 3.12–3.15 FastAPI Pydantic v2 Async First Documentation PyPI version codecov License

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 ZodiacException to standard HTTP 4xx/5xx JSON responses.
  • 💾 Database Abstraction: Async SQLAlchemy session management and BaseSQLRepository with pagination helpers (paginate_query).
  • 🎁 Standard Response Wrapper: Automatic wrapping of API responses into code / data / message via APIRouter.
  • 📄 Standard Pagination: PageParams and PagedResponse[T] with repository integration.
  • ⚡ Async Ready: Python 3.12–3.15 async/await from the ground up.
  • ⌨️ zodiac CLI: Scaffold a 3-tier FastAPI project (DI, routers, config) with one command.
  • 🔎 Wiring Checks: zodiac check AST-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-service below 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 in docs/).
  • Developer skills: reusable agent skills ship in the zodiac-core wheel under zodiac/skills/. Link them with uv run zodiac skills install. Use zodiac-docs for version-aware framework guidance (including looking up docs before writing APIs) and zodiac-core-integration-summary for adoption audits (zodiac check --format json supplies 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.

Metadata

Release files for zodiac-core 0.14.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zodiac-core 0.14.4
File Size Uploaded Provenance
zodiac_core-0.14.4.tar.gz 105.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for zodiac-core 0.14.4
File Interpreter ABI Platform
zodiac_core-0.14.4-py3-none-any.whl Python 3 none any Details

Total release size: 218.8 kB

Release files / zodiac_core-0.14.4.tar.gz

Download URL zodiac_core-0.14.4.tar.gz
Size 105.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6b37fbe44fbc7e8a83ada6e7b7a6c761bb77802e923b8815587ea4d82bd8e67f
BLAKE2b-256 checksum
How to use checksums
3468c3aa7ef06340b73ce702c7d7f21ad82c00481ed87a30d7f16f28528a4978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / zodiac_core-0.14.4-py3-none-any.whl

Download URL zodiac_core-0.14.4-py3-none-any.whl
Size 113.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2560e5655f49573632e9cb935b7c430e19fc58d6f3f639b55bd854d5c4e10d0c
BLAKE2b-256 checksum
How to use checksums
cd6ce5c6e98b6ac38f8a58eb438dc54c9d74c23cf4a0cddac1d7993160e3ef50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for zodiac-core 0.14.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for zodiac_core-0.14.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page