Skip to main content

ZodiacCore-Py

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

The opinionated, async-first core library for modern Python web services.

🎯 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 two ways: a library you drop into any FastAPI app, and a CLI that scaffolds a full project so you can start coding in seconds.

✨ 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+ async/await from the ground up.
  • ⌨️ zodiac CLI: Scaffold a 3-tier FastAPI project (DI, routers, config) with one command.

📦 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[zodiac] (CLI). See the Installation Guide for details.


🚀 Two 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 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)

📚 Documentation

  • Online: https://ttwshell.github.io/ZodiacCore-Py/ (multiple versions via release).
  • Local: make docs-serve (sources in docs/).
  • Codex skills: reusable developer skills live in skills/. To install one into a service project, download it into that project's .codex/skills/ directory:
mkdir -p .codex/skills/zodiac-core-integration-summary
curl -L \
  https://raw.githubusercontent.com/TTWShell/ZodiacCore-Py/master/skills/zodiac-core-integration-summary/SKILL.md \
  -o .codex/skills/zodiac-core-integration-summary/SKILL.md

Then ask Codex for a zodiac-core-integration-summary audit from that project.

🤝 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

zodiac_core-0.11.1.tar.gz (70.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zodiac_core-0.11.1-py3-none-any.whl (75.5 kB view details)

Uploaded Python 3

File details

Details for the file zodiac_core-0.11.1.tar.gz.

File metadata

  • Download URL: zodiac_core-0.11.1.tar.gz
  • Upload date:
  • Size: 70.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zodiac_core-0.11.1.tar.gz
Algorithm Hash digest
SHA256 893c92a3579fbb6ecec00e186e834c692603d1361c2ea1f0e14f0876c624f0bc
MD5 0dd9e48af042985eea8f81e02c704042
BLAKE2b-256 f4d0ebf7afbd29d8f2ad5a5d20aeb2ddea79fa16051adacc430f2ad2bb250a02

See more details on using hashes here.

Provenance

The following attestation bundles were made for zodiac_core-0.11.1.tar.gz:

Publisher: ci.yml on TTWShell/ZodiacCore-Py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zodiac_core-0.11.1-py3-none-any.whl.

File metadata

  • Download URL: zodiac_core-0.11.1-py3-none-any.whl
  • Upload date:
  • Size: 75.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zodiac_core-0.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f87fd0e6f4ffb936faa18d4aa1d77b2bf5f7beaa9b6e1eb7161f8377d3de0b05
MD5 a6d1ab4c9f340f592794a44b91e71aab
BLAKE2b-256 9c548ffd8f20ed77518c23e07e9ca76a3793b45ffe8ca2112d3ee7073ec619b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for zodiac_core-0.11.1-py3-none-any.whl:

Publisher: ci.yml on TTWShell/ZodiacCore-Py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.14.2

2 files

0.14.1

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

This release

0.11.1 This release

2 files

0.11.0

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

2 files

0.5.4

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

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