Pyramid integration for Dishka
Dishka DI integration for the Pyramid framework.
Installation
via uv:
uv add dishka-pyramid
via pip:
pip install dishka-pyramid
Usage
Usage example
from typing import Final
from dishka import Provider, Scope, make_container, provide
from pyramid.config import Configurator
from pyramid.request import Request
from pyramid.response import Response
from pyramid.view import view_config
from dishka_pyramid import FromDishka, PyramidProvider, inject, setup_dishka
class GetHelloInteractor:
def execute(self) -> str:
return "Hello from Dishka!"
class MyProvider(Provider):
@provide(scope=Scope.REQUEST)
def get_hello_interactor(self) -> GetHelloInteractor:
return GetHelloInteractor()
GET_HELLO_ROUTE_NAME: Final[str] = "hello"
@view_config(route_name=GET_HELLO_ROUTE_NAME)
@inject
def my_view(request: Request, interactor: FromDishka[GetHelloInteractor]) -> Response:
response_text = interactor.execute()
return Response(response_text)
container = make_container(PyramidProvider(), MyProvider())
config = Configurator()
setup_dishka(container=container, config=config)
config.add_route(name=GET_HELLO_ROUTE_NAME, pattern="/hello")
config.scan()
app = config.make_wsgi_app()
Metadata
Release files for dishka-pyramid 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dishka_pyramid-1.0.2.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dishka_pyramid-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / dishka_pyramid-1.0.2.tar.gz
| Download URL | dishka_pyramid-1.0.2.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2a188446a9dc2f263939889e415aaec04b164e78bf938481eeedc595d9331c2
|
|
BLAKE2b-256 checksum How to use checksums |
6a74dc15db782ad3a9880fe9353a357786fe900a93bb7d7fb7c360dec6a087df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / dishka_pyramid-1.0.2-py3-none-any.whl
| Download URL | dishka_pyramid-1.0.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98cf0e7c1b6a9141912d4ba6905ea335393a14e672bc36dd422736b5515b0faa
|
|
BLAKE2b-256 checksum How to use checksums |
6d067e1daca34e5f61d6bd2fee46cb6da3f1618c480a1982ec64a0870bacfcbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|