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.2.0.tar.gz (162.7 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.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for neva_fastapi-1.2.0.tar.gz
Algorithm Hash digest
SHA256 2773677ca73e6a74eb5f16b18704cad63c42976d0777677b39220c0768604f1e
MD5 57f2bf21d18cedd9f9b978ee8ba244b0
BLAKE2b-256 9ae9c9acf7dfee6e641b3cc223b2789b5581f8eb25b24b11b0cf689fd004d89d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neva_fastapi-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a87504fd9eaaaa5294b270958bd1830c59a9f3573fbd29f8f509bc20f8b7b31a
MD5 dbb4203167a16911a300a5ff42f1042a
BLAKE2b-256 978866dcad46a05d69f163e7e8f34173283e2660b9ad9282bf84d55ae0e2048a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 files

1.1.2

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