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.1.tar.gz (134.4 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.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for neva_fastapi-1.1.1.tar.gz
Algorithm Hash digest
SHA256 5c307c2fa60c2b68d94b28fd75bda0c388a12c76bc5f3bed683874e3d1f15ca7
MD5 9cf2183ebb7927b170f88f82874a16ea
BLAKE2b-256 0ad0a9873b7d248eae7366ab9de24a2049732343ad08aeca76bab75472d11abc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for neva_fastapi-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b167d8005fb0bd34c233f9840469af25c597235fc9dccf3b9acf6587032894e3
MD5 cacd914bd3a9f3034ef4ea87ac13b52a
BLAKE2b-256 276e647b3bd06688f1fd8ff103af4130bacc65d57d0aa45537164e303f9d4ee7

See more details on using hashes here.

Release history Release notifications | RSS feed

1.2.0

2 files

1.1.2

2 files

This release

1.1.1 This release

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