Skip to main content

A lean backend framework for type-safe Python APIs — file-based routing, typed config/DI, scoped providers, plugin registry, and background tasks.

Project description

causeway (Python)

A lean backend framework for type-safe Python APIs.

uv add 'causeway==0.1.0a0'   # alpha — drop the pin once v0.1.0 ships

This is the core Python package of Causeway. It ships:

  • A file-based router that walks src/app/routes/**/*.py, picks up [id].py, (group)/, _middleware.py, and _scope.py, and registers handlers into the app's route table.
  • A typed config layer that wraps pydantic-settings and exposes non-secret fields to the generated TypeScript client.
  • A scoped DI container driven by _scope.py providers.
  • A @task contract for background jobs with a Dramatiq reference adapter.
  • A plugin registry with Python-entry-point discovery and per-environment activation.
  • A CLI (causeway new, causeway dev, causeway build, causeway deploy <target>) that runs the whole loop.

For the full story, the design rationale, and a side-by-side vs. FastAPI / Django + Ninja / Encore.ts / NestJS, see the repo README.

30-second example

my-app/
├── pyproject.toml
├── causeway.toml
└── src/app/
    ├── config.py
    ├── plugins.py
    └── routes/
        ├── _middleware.py
        ├── index.py
        └── users/
            ├── _scope.py
            ├── index.py
            └── [id].py
# src/app/routes/users/[id].py
from typing import Annotated
from uuid import UUID
from msgspec import Struct
from causeway import get, raises
from causeway.errors import NotFound

class User(Struct):
    id: UUID
    name: str

@get
@raises(NotFound)
async def show(id: UUID) -> User:
    ...

Run it:

causeway dev

causeway dev discovers the routes, boots uvicorn, regenerates a typed client.ts for your frontend on every save, and exposes /__causeway with the route tree, registered tasks, current config, and plugin list.

Primitives in this package

Primitive Purpose
File router ([id].py, (group)/) Discovery + URL pattern generation.
_middleware.py / _scope.py Per-subtree middleware + scoped DI providers.
Settings (wraps pydantic-settings) Typed config with allowlisted exposure to the generated client.
@get / @post / @put / @patch / @delete HTTP method decorators.
@task(...) Background-job contract; adapter-agnostic.
@cron(...) Scheduled tasks via the same adapter.
register(...) Plugin registration (TaskAdapter, Storage, KV, AuthProvider, …).
TestApp Test client with DI overrides and tasks_eager() mode.
causeway CLI new, dev, build, plugins, deploy <target>.

Full reference: https://github.com/tamimbinhakim/causeway/tree/main/docs/api-reference

Optional extras

uv add 'causeway[dramatiq]'  # reference task adapter
uv add 'causeway[otel]'      # OpenTelemetry middleware hooks
uv add 'causeway[all]'       # everything

Scope

Causeway ships project shape and a small set of contracts. It does not ship vertical integrations — no ORM, no admin panel, no template engine, no infrastructure provisioning. Those layers compose on top of the fundamentals and live in their own plugin packages or in user code.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causeway-0.2.1.tar.gz (83.5 kB view details)

Uploaded Source

Built Distribution

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

causeway-0.2.1-py3-none-any.whl (81.4 kB view details)

Uploaded Python 3

File details

Details for the file causeway-0.2.1.tar.gz.

File metadata

  • Download URL: causeway-0.2.1.tar.gz
  • Upload date:
  • Size: 83.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for causeway-0.2.1.tar.gz
Algorithm Hash digest
SHA256 38a94d3d68eeee7b81a0aae16877fecafabf4a634f62739b010aa103be4117e4
MD5 4c99e7fdfe3de7cb320c304a6d7c73f1
BLAKE2b-256 f277dbe9733cae2e52f9044280e38a2f0fc8d3ca33b75a2d89203aecd94d95be

See more details on using hashes here.

File details

Details for the file causeway-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: causeway-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 81.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for causeway-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5ae09b222ce7cf262a25691882459fec8f5bb9b5189edfdc5269df126d84e99
MD5 19495fd9f71861d37bad860914650ac6
BLAKE2b-256 6327b65379d11b1017375445036bb172a877dd1f144688a23d75b56a94236d70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page