From 04faec5b00825d5f5f2750cd85cc84cc7b372092 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Wed, 27 Oct 2021 20:58:24 -0400 Subject: [PATCH] Update sanic example with wiring_config --- examples/miniapps/sanic/README.rst | 6 +++--- examples/miniapps/sanic/giphynavigator/application.py | 1 - examples/miniapps/sanic/giphynavigator/containers.py | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/miniapps/sanic/README.rst b/examples/miniapps/sanic/README.rst index 7c75b2b3..d50b8552 100644 --- a/examples/miniapps/sanic/README.rst +++ b/examples/miniapps/sanic/README.rst @@ -104,13 +104,13 @@ The output should be something like: giphynavigator/tests.py ... [100%] - ---------- coverage: platform darwin, python 3.9 ----------- + ---------- coverage: platform darwin, python 3.10.0-final-0 ---------- Name Stmts Miss Cover --------------------------------------------------- giphynavigator/__init__.py 0 0 100% giphynavigator/__main__.py 4 4 0% - giphynavigator/application.py 11 0 100% - giphynavigator/containers.py 6 0 100% + giphynavigator/application.py 10 0 100% + giphynavigator/containers.py 7 0 100% giphynavigator/giphy.py 14 9 36% giphynavigator/handlers.py 11 0 100% giphynavigator/services.py 9 1 89% diff --git a/examples/miniapps/sanic/giphynavigator/application.py b/examples/miniapps/sanic/giphynavigator/application.py index 2c2d99df..4613f660 100644 --- a/examples/miniapps/sanic/giphynavigator/application.py +++ b/examples/miniapps/sanic/giphynavigator/application.py @@ -10,7 +10,6 @@ def create_app() -> Sanic: """Create and return Sanic application.""" container = Container() container.config.giphy.api_key.from_env("GIPHY_API_KEY") - container.wire(modules=[handlers]) app = Sanic("giphy-navigator") app.ctx.container = container diff --git a/examples/miniapps/sanic/giphynavigator/containers.py b/examples/miniapps/sanic/giphynavigator/containers.py index 62ddc4b1..19dc5de7 100644 --- a/examples/miniapps/sanic/giphynavigator/containers.py +++ b/examples/miniapps/sanic/giphynavigator/containers.py @@ -7,6 +7,8 @@ from . import giphy, services class Container(containers.DeclarativeContainer): + wiring_config = containers.WiringConfiguration(modules=[".handlers"]) + config = providers.Configuration(yaml_files=["config.yml"]) giphy_client = providers.Factory(