Skip to main content

Dishka DI integration for Pyramid framework

Project description

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()

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

dishka_pyramid-1.0.2.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

dishka_pyramid-1.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file dishka_pyramid-1.0.2.tar.gz.

File metadata

  • Download URL: dishka_pyramid-1.0.2.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for dishka_pyramid-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f2a188446a9dc2f263939889e415aaec04b164e78bf938481eeedc595d9331c2
MD5 ab1d8012a14f3e6292a9b44918cdcc8e
BLAKE2b-256 6a74dc15db782ad3a9880fe9353a357786fe900a93bb7d7fb7c360dec6a087df

See more details on using hashes here.

File details

Details for the file dishka_pyramid-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: dishka_pyramid-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for dishka_pyramid-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98cf0e7c1b6a9141912d4ba6905ea335393a14e672bc36dd422736b5515b0faa
MD5 e7645e1013bbe739cf6a2e533f786de0
BLAKE2b-256 6d067e1daca34e5f61d6bd2fee46cb6da3f1618c480a1982ec64a0870bacfcbb

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