Skip to main content

neva-fastapi

The FastAPI integration for the Neva framework. It marries FastAPI to neva's dishka-based dependency-injection container so that route handlers resolve injected services, while keeping all HTTP concerns out of the framework-agnostic python-neva core.

Most consumers pull this in transitively via the python-neva[fastapi] extra rather than depending on it directly.

What it provides

Everything is re-exported from neva.fastapi:

  • App — a subclass of fastapi.FastAPI that owns a neva.arch.Application (the DI container) and drives it: builds the container, reads app metadata from neva config (app.*), wires neva providers' lifespan() hooks, and installs per-request DI scoping middleware.
  • APIRouter — a subclass of fastapi.APIRouter that forces route_class=DishkaRoute so injection works inside handlers.
  • Inject — a re-export of dishka.FromDishka. Annotate handler params as Inject[SomeService]. Inject only works on this package's APIRouter (or App's routes) — a vanilla fastapi.APIRouter lacks DishkaRoute and injection silently won't happen.

neva is a namespace package (no top-level neva/__init__.py); this repo owns neva/fastapi/ and shares the neva.* namespace with python-neva.

Testing helpers

Fixtures in neva/fastapi/fixtures.py ship as a pytest plugin — opt in with pytest_plugins = ["neva.fastapi.fixtures"] in your conftest.py. It provides webapp (an App built from a test_config path you supply) and http_client (an httpx.AsyncClient wired to the app via ASGITransport).

Develop

uv sync          # install/refresh deps
poe lint         # ruff check
poe fmt          # ruff format
poe tc           # pyrefly check
poe test         # pytest
poe test-cov     # pytest --cov=neva --cov-report=term-missing

asyncio_mode = "auto" is set, so async tests need no @pytest.mark.asyncio.

Contributing

Commits follow Conventional Commits with gitmoji prefixes, enforced by cz_gitmoji. Commitizen is a dev dependency — run cz commit for the guided wizard, or format manually as :gitmoji: type(scope): subject.

Releases are cut per-repo with commitizen from the repo root:

cz bump                          # bump version in pyproject, write CHANGELOG, tag v<version>
git push --follow-tags origin main
uv build && uv publish           # build + publish the wheel/sdist

cz bump derives the level from the commits since the last tag, updates CHANGELOG.md, and runs scripts/retag-with-changelog.sh to rewrite the new tag with the rendered changelog as its annotation.

Download files

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

Source Distribution

neva_fastapi-1.1.2.tar.gz (162.0 kB view details)

Uploaded Source

Built Distribution

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

neva_fastapi-1.1.2-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file neva_fastapi-1.1.2.tar.gz.

File metadata

  • Download URL: neva_fastapi-1.1.2.tar.gz
  • Upload date:
  • Size: 162.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for neva_fastapi-1.1.2.tar.gz
Algorithm Hash digest
SHA256 1a110370a8f3cab3f572eae0b8d803a0c36125a53b919ed3ab333728682f96d2
MD5 f992884092414b55ea1a57c0137852d1
BLAKE2b-256 4338024fa1020bad22e80d1ca42aa72230a43bd1bb8f22a331dd82c31e69a2ff

See more details on using hashes here.

File details

Details for the file neva_fastapi-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for neva_fastapi-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 70ed364c0289c9a8cd0aae93f44eb803d70581871c6c777eaf99617f1fe4b454
MD5 a4d0d6000e1b4cfc83a30db03d1598a1
BLAKE2b-256 382642153c5d7204357ea1adf9b90fc68932d7376a1e584495d3b30f753541a1

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

This release

1.1.2 This release

2 files

1.1.1

2 files

1.1.0

2 files

1.0.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