From 2bd5eed77ff4b1b22604cd8f25f066cfc3532ada Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 18:14:23 -0600 Subject: [PATCH 1/6] chore: incorporate upstream changes from di --- .../advanced/dependencies/tutorial_001.py | 4 +- .../advanced/dependencies/tutorial_002.py | 6 +- .../advanced/dependencies/tutorial_004.py | 6 +- .../advanced/dependencies/tutorial_005.py | 4 +- docs_src/advanced/websockets.py | 4 +- .../tutorial/dependencies/tutorial_007.py | 10 +- poetry.lock | 201 ++++++++---------- pyproject.toml | 2 +- tests/test_dependency_injection.py | 8 +- .../body/test_field_extractors.py | 4 +- tests/test_responses/test_response_proxy.py | 6 +- tests/test_routing/test_mounts.py | 4 +- xpresso/__init__.py | 3 +- xpresso/_utils/overrides.py | 6 +- xpresso/applications.py | 25 ++- xpresso/binders/dependants.py | 6 +- xpresso/dependencies/models.py | 43 +++- xpresso/routing/operation.py | 11 +- xpresso/routing/pathitem.py | 6 +- xpresso/routing/router.py | 8 +- xpresso/routing/websockets.py | 16 +- 21 files changed, 206 insertions(+), 177 deletions(-) diff --git a/docs_src/advanced/dependencies/tutorial_001.py b/docs_src/advanced/dependencies/tutorial_001.py index bf2455d3..c9bd1007 100644 --- a/docs_src/advanced/dependencies/tutorial_001.py +++ b/docs_src/advanced/dependencies/tutorial_001.py @@ -1,6 +1,6 @@ import time -from xpresso import App, Depends, Operation, Path +from xpresso import App, Dependant, Operation, Path def slow_dependency() -> None: @@ -19,7 +19,7 @@ def slow_endpoint() -> None: endpoint=slow_endpoint, sync_to_thread=True, dependencies=[ - Depends(slow_dependency, sync_to_thread=True) + Dependant(slow_dependency, sync_to_thread=True) ], ), ) diff --git a/docs_src/advanced/dependencies/tutorial_002.py b/docs_src/advanced/dependencies/tutorial_002.py index c9274671..b51ff7b7 100644 --- a/docs_src/advanced/dependencies/tutorial_002.py +++ b/docs_src/advanced/dependencies/tutorial_002.py @@ -2,7 +2,7 @@ import anyio -from xpresso import App, Depends, Operation, Path +from xpresso import App, Dependant, Operation, Path def slow_dependency_1() -> None: @@ -24,8 +24,8 @@ async def endpoint() -> None: get=Operation( endpoint=endpoint, dependencies=[ - Depends(slow_dependency_1, sync_to_thread=True), - Depends(slow_dependency_2), + Dependant(slow_dependency_1, sync_to_thread=True), + Dependant(slow_dependency_2), ], execute_dependencies_concurrently=True, ), diff --git a/docs_src/advanced/dependencies/tutorial_004.py b/docs_src/advanced/dependencies/tutorial_004.py index d0ea9c2d..ae44dffe 100644 --- a/docs_src/advanced/dependencies/tutorial_004.py +++ b/docs_src/advanced/dependencies/tutorial_004.py @@ -2,7 +2,7 @@ from xpresso import ( App, - Depends, + Dependant, FromPath, HTTPException, Path, @@ -43,7 +43,9 @@ async def read_items(item_name: FromPath[str]) -> str: path="/items/{item_name}", get=read_items, dependencies=[ - Depends(log_response_status_code, scope="connection") + Dependant( + log_response_status_code, scope="connection" + ) ], ), ] diff --git a/docs_src/advanced/dependencies/tutorial_005.py b/docs_src/advanced/dependencies/tutorial_005.py index 68418f31..784cfcd0 100644 --- a/docs_src/advanced/dependencies/tutorial_005.py +++ b/docs_src/advanced/dependencies/tutorial_005.py @@ -3,7 +3,7 @@ from xpresso import ( App, - Depends, + Dependant, FromPath, HTTPException, Path, @@ -44,7 +44,7 @@ async def read_items(item_name: FromPath[str]) -> str: Path( path="/items/{item_name}", get=read_items, - dependencies=[Depends(trace, scope="endpoint")], + dependencies=[Dependant(trace, scope="endpoint")], ), ] ) diff --git a/docs_src/advanced/websockets.py b/docs_src/advanced/websockets.py index c7e0673c..2493e2ad 100644 --- a/docs_src/advanced/websockets.py +++ b/docs_src/advanced/websockets.py @@ -1,6 +1,6 @@ from xpresso import ( App, - Depends, + Dependant, FromHeader, WebSocket, WebSocketRoute, @@ -31,7 +31,7 @@ async def websocket_endpoint( WebSocketRoute( path="/ws", endpoint=websocket_endpoint, - dependencies=[Depends(enforce_header_pattern)], + dependencies=[Dependant(enforce_header_pattern)], ), ] ) diff --git a/docs_src/tutorial/dependencies/tutorial_007.py b/docs_src/tutorial/dependencies/tutorial_007.py index e9dd9ac7..612779e4 100644 --- a/docs_src/tutorial/dependencies/tutorial_007.py +++ b/docs_src/tutorial/dependencies/tutorial_007.py @@ -2,7 +2,7 @@ from xpresso import ( App, - Depends, + Dependant, FromPath, FromQuery, HTTPException, @@ -41,10 +41,12 @@ async def get_item(item_id: FromPath[str]) -> str: get=get_item, # no extra roles required delete=Operation( endpoint=delete_item, - dependencies=[Depends(require_roles("items-admin"))], + dependencies=[ + Dependant(require_roles("items-admin")) + ], ), - dependencies=[Depends(require_roles("items-user"))], + dependencies=[Dependant(require_roles("items-user"))], ) ], - dependencies=[Depends(require_roles("user"))], + dependencies=[Dependant(require_roles("user"))], ) diff --git a/poetry.lock b/poetry.lock index 6ec91c77..471ae782 100644 --- a/poetry.lock +++ b/poetry.lock @@ -123,7 +123,7 @@ python-versions = ">=3.6.1" [[package]] name = "charset-normalizer" -version = "2.0.11" +version = "2.0.12" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." category = "dev" optional = false @@ -134,7 +134,7 @@ unicode_backport = ["unicodedata2"] [[package]] name = "click" -version = "8.0.3" +version = "8.0.4" description = "Composable command line interface toolkit" category = "dev" optional = false @@ -168,18 +168,25 @@ toml = ["tomli"] [[package]] name = "di" -version = "0.56.1" +version = "0.58.0" description = "Autowiring dependency injection" category = "main" optional = false python-versions = ">=3.7,<4" +develop = false [package.dependencies] -anyio = ">=3,<4" +anyio = "~3" graphlib2 = ">=0.2.13" importlib-metadata = {version = ">=3", markers = "python_version < \"3.8\""} typing-extensions = {version = ">=3", markers = "python_version < \"3.9\""} +[package.source] +type = "git" +url = "https://github.com/adriangb/di.git" +reference = "seperate-marker-and-dependant" +resolved_reference = "43babf78fa758c87683256dba6ef616c2dc54c76" + [[package]] name = "distlib" version = "0.3.4" @@ -190,7 +197,7 @@ python-versions = "*" [[package]] name = "fastapi" -version = "0.73.0" +version = "0.74.0" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" category = "dev" optional = false @@ -208,7 +215,7 @@ test = ["pytest (>=6.2.4,<7.0.0)", "pytest-cov (>=2.12.0,<4.0.0)", "mypy (==0.91 [[package]] name = "filelock" -version = "3.4.2" +version = "3.6.0" description = "A platform independent file lock." category = "dev" optional = false @@ -328,7 +335,7 @@ http2 = ["h2 (>=3.0.0,<4.0.0)"] [[package]] name = "identify" -version = "2.4.8" +version = "2.4.10" description = "File identification library for Python" category = "dev" optional = false @@ -347,7 +354,7 @@ python-versions = ">=3.5" [[package]] name = "importlib-metadata" -version = "4.10.1" +version = "4.11.1" description = "Read metadata from Python packages" category = "main" optional = false @@ -360,7 +367,7 @@ zipp = ">=0.5" [package.extras] docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] perf = ["ipython"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)", "importlib-resources (>=1.3)"] [[package]] name = "iniconfig" @@ -414,11 +421,11 @@ testing = ["coverage", "pyyaml"] [[package]] name = "markupsafe" -version = "2.0.1" +version = "2.1.0" description = "Safely add untrusted strings to HTML/XML markup." category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [[package]] name = "mccabe" @@ -487,7 +494,7 @@ i18n = ["babel (>=2.9.0)"] [[package]] name = "mkdocs-material" -version = "8.1.10" +version = "8.2.1" description = "A Material Design theme for MkDocs" category = "dev" optional = false @@ -583,7 +590,7 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [[package]] name = "platformdirs" -version = "2.4.1" +version = "2.5.0" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false @@ -682,11 +689,11 @@ python-versions = ">=3.5" [[package]] name = "pymdown-extensions" -version = "9.1" +version = "9.2" description = "Extension pack for Python Markdown." category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" [package.dependencies] Markdown = ">=3.2" @@ -893,7 +900,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" [[package]] name = "tomli" -version = "2.0.0" +version = "2.0.1" description = "A lil' TOML parser" category = "dev" optional = false @@ -926,7 +933,7 @@ python-versions = ">=3.6" [[package]] name = "typing-extensions" -version = "4.0.1" +version = "4.1.1" description = "Backported and Experimental Type Hints for Python 3.6+" category = "main" optional = false @@ -1054,7 +1061,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = ">=3.7,<4" -content-hash = "d30802e770386a5d389592528b91777675611321c7af37101fae6aec785f02eb" +content-hash = "db8016a325565d1aa91bff84a6a049abf0a58c22b4f89ad983e0bb431ed108dc" [metadata.files] anyio = [ @@ -1167,12 +1174,12 @@ cfgv = [ {file = "cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736"}, ] charset-normalizer = [ - {file = "charset-normalizer-2.0.11.tar.gz", hash = "sha256:98398a9d69ee80548c762ba991a4728bfc3836768ed226b3945908d1a688371c"}, - {file = "charset_normalizer-2.0.11-py3-none-any.whl", hash = "sha256:2842d8f5e82a1f6aa437380934d5e1cd4fcf2003b06fed6940769c164a480a45"}, + {file = "charset-normalizer-2.0.12.tar.gz", hash = "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597"}, + {file = "charset_normalizer-2.0.12-py3-none-any.whl", hash = "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df"}, ] click = [ - {file = "click-8.0.3-py3-none-any.whl", hash = "sha256:353f466495adaeb40b6b5f592f9f91cb22372351c84caeb068132442a4518ef3"}, - {file = "click-8.0.3.tar.gz", hash = "sha256:410e932b050f5eed773c4cda94de75971c89cdb3155a72a0831139a79e5ecb5b"}, + {file = "click-8.0.4-py3-none-any.whl", hash = "sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1"}, + {file = "click-8.0.4.tar.gz", hash = "sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb"}, ] colorama = [ {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, @@ -1221,21 +1228,18 @@ coverage = [ {file = "coverage-6.3.1-pp36.pp37.pp38-none-any.whl", hash = "sha256:463e52616ea687fd323888e86bf25e864a3cc6335a043fad6bbb037dbf49bbe2"}, {file = "coverage-6.3.1.tar.gz", hash = "sha256:6c3f6158b02ac403868eea390930ae64e9a9a2a5bbfafefbb920d29258d9f2f8"}, ] -di = [ - {file = "di-0.56.1-py3-none-any.whl", hash = "sha256:eff78db82e747490e50302eed49641dd7d09ff543f3ab3ad04eb9ba65024a57d"}, - {file = "di-0.56.1.tar.gz", hash = "sha256:d54d1f3a034cd0180b10e600f15aa29acc1b15f2d2ebf3f4f918afa6d5f2ab91"}, -] +di = [] distlib = [ {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, ] fastapi = [ - {file = "fastapi-0.73.0-py3-none-any.whl", hash = "sha256:f0a618aff5f6942862f2d3f20f39b1c037e33314d1b8207fd1c3a2cca76dfd8c"}, - {file = "fastapi-0.73.0.tar.gz", hash = "sha256:dcfee92a7f9a72b5d4b7ca364bd2b009f8fc10d95ed5769be20e94f39f7e5a15"}, + {file = "fastapi-0.74.0-py3-none-any.whl", hash = "sha256:e21d7d0d587c8c2014e8ff61be2626f999cfb8c3cb42f034df9f8589bcb893e1"}, + {file = "fastapi-0.74.0.tar.gz", hash = "sha256:5363a2cd983aa700e5a6c25d63d1b84aee0d4c94358247b4a1a947e39f654ffe"}, ] filelock = [ - {file = "filelock-3.4.2-py3-none-any.whl", hash = "sha256:cf0fc6a2f8d26bd900f19bf33915ca70ba4dd8c56903eeb14e1e7a2fd7590146"}, - {file = "filelock-3.4.2.tar.gz", hash = "sha256:38b4f4c989f9d06d44524df1b24bd19e167d851f19b50bf3e3559952dddc5b80"}, + {file = "filelock-3.6.0-py3-none-any.whl", hash = "sha256:f8314284bfffbdcfa0ff3d7992b023d4c628ced6feb957351d4c48d059f56bc0"}, + {file = "filelock-3.6.0.tar.gz", hash = "sha256:9cd540a9352e432c7246a48fe4e8712b10acb1df2ad1f30e8c070b82ae1fed85"}, ] flake8 = [ {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, @@ -1300,16 +1304,16 @@ httpx = [ {file = "httpx-0.18.1.tar.gz", hash = "sha256:0a2651dd2b9d7662c70d12ada5c290abcf57373b9633515fe4baa9f62566086f"}, ] identify = [ - {file = "identify-2.4.8-py2.py3-none-any.whl", hash = "sha256:a55bdd671b6063eb837af938c250ec00bba6e610454265133b0d2db7ae718d0f"}, - {file = "identify-2.4.8.tar.gz", hash = "sha256:97e839c1779f07011b84c92af183e1883d9745d532d83412cca1ca76d3808c1c"}, + {file = "identify-2.4.10-py2.py3-none-any.whl", hash = "sha256:7d10baf6ba6f1912a0a49f4c1c2c49fa1718765c3a37d72d13b07779567c5b85"}, + {file = "identify-2.4.10.tar.gz", hash = "sha256:e12b2aea3cf108de73ae055c2260783bde6601de09718f6768cf8e9f6f6322a6"}, ] idna = [ {file = "idna-3.3-py3-none-any.whl", hash = "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff"}, {file = "idna-3.3.tar.gz", hash = "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d"}, ] importlib-metadata = [ - {file = "importlib_metadata-4.10.1-py3-none-any.whl", hash = "sha256:899e2a40a8c4a1aec681feef45733de8a6c58f3f6a0dbed2eb6574b4387a77b6"}, - {file = "importlib_metadata-4.10.1.tar.gz", hash = "sha256:951f0d8a5b7260e9db5e41d429285b5f451e928479f19d80818878527d36e95e"}, + {file = "importlib_metadata-4.11.1-py3-none-any.whl", hash = "sha256:e0bc84ff355328a4adfc5240c4f211e0ab386f80aa640d1b11f0618a1d282094"}, + {file = "importlib_metadata-4.11.1.tar.gz", hash = "sha256:175f4ee440a0317f6e8d81b7f8d4869f93316170a65ad2b007d2929186c8052c"}, ] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, @@ -1328,75 +1332,46 @@ markdown = [ {file = "Markdown-3.3.6.tar.gz", hash = "sha256:76df8ae32294ec39dcf89340382882dfa12975f87f45c3ed1ecdb1e8cefc7006"}, ] markupsafe = [ - {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-win32.whl", hash = "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28"}, - {file = "MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"}, - {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"}, - {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"}, - {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"}, - {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"}, - {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:3028252424c72b2602a323f70fbf50aa80a5d3aa616ea6add4ba21ae9cc9da4c"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:290b02bab3c9e216da57c1d11d2ba73a9f73a614bbdcc027d299a60cdfabb11a"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e104c0c2b4cd765b4e83909cde7ec61a1e313f8a75775897db321450e928cce"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:24c3be29abb6b34052fd26fc7a8e0a49b1ee9d282e3665e8ad09a0a68faee5b3"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:204730fd5fe2fe3b1e9ccadb2bd18ba8712b111dcabce185af0b3b5285a7c989"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d3b64c65328cb4cd252c94f83e66e3d7acf8891e60ebf588d7b493a55a1dbf26"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:96de1932237abe0a13ba68b63e94113678c379dca45afa040a17b6e1ad7ed076"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:75bb36f134883fdbe13d8e63b8675f5f12b80bb6627f7714c7d6c5becf22719f"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-win32.whl", hash = "sha256:4056f752015dfa9828dce3140dbadd543b555afb3252507348c493def166d454"}, + {file = "MarkupSafe-2.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:d4e702eea4a2903441f2735799d217f4ac1b55f7d8ad96ab7d4e25417cb0827c"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:f0eddfcabd6936558ec020130f932d479930581171368fd728efcfb6ef0dd357"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5ddea4c352a488b5e1069069f2f501006b1a4362cb906bee9a193ef1245a7a61"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:09c86c9643cceb1d87ca08cdc30160d1b7ab49a8a21564868921959bd16441b8"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a0a0abef2ca47b33fb615b491ce31b055ef2430de52c5b3fb19a4042dbc5cadb"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:736895a020e31b428b3382a7887bfea96102c529530299f426bf2e636aacec9e"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:679cbb78914ab212c49c67ba2c7396dc599a8479de51b9a87b174700abd9ea49"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:84ad5e29bf8bab3ad70fd707d3c05524862bddc54dc040982b0dbcff36481de7"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-win32.whl", hash = "sha256:8da5924cb1f9064589767b0f3fc39d03e3d0fb5aa29e0cb21d43106519bd624a"}, + {file = "MarkupSafe-2.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:454ffc1cbb75227d15667c09f164a0099159da0c1f3d2636aa648f12675491ad"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:142119fb14a1ef6d758912b25c4e803c3ff66920635c44078666fe7cc3f8f759"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b2a5a856019d2833c56a3dcac1b80fe795c95f401818ea963594b345929dffa7"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d1fb9b2eec3c9714dd936860850300b51dbaa37404209c8d4cb66547884b7ed"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:62c0285e91414f5c8f621a17b69fc0088394ccdaa961ef469e833dbff64bd5ea"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fc3150f85e2dbcf99e65238c842d1cfe69d3e7649b19864c1cc043213d9cd730"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f02cf7221d5cd915d7fa58ab64f7ee6dd0f6cddbb48683debf5d04ae9b1c2cc1"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:d5653619b3eb5cbd35bfba3c12d575db2a74d15e0e1c08bf1db788069d410ce8"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7d2f5d97fcbd004c03df8d8fe2b973fe2b14e7bfeb2cfa012eaa8759ce9a762f"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-win32.whl", hash = "sha256:3cace1837bc84e63b3fd2dfce37f08f8c18aeb81ef5cf6bb9b51f625cb4e6cd8"}, + {file = "MarkupSafe-2.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:fabbe18087c3d33c5824cb145ffca52eccd053061df1d79d4b66dafa5ad2a5ea"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:023af8c54fe63530545f70dd2a2a7eed18d07a9a77b94e8bf1e2ff7f252db9a3"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d66624f04de4af8bbf1c7f21cc06649c1c69a7f84109179add573ce35e46d448"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c532d5ab79be0199fa2658e24a02fce8542df196e60665dd322409a03db6a52c"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e67ec74fada3841b8c5f4c4f197bea916025cb9aa3fe5abf7d52b655d042f956"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:30c653fde75a6e5eb814d2a0a89378f83d1d3f502ab710904ee585c38888816c"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:961eb86e5be7d0973789f30ebcf6caab60b844203f4396ece27310295a6082c7"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:598b65d74615c021423bd45c2bc5e9b59539c875a9bdb7e5f2a6b92dfcfc268d"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:599941da468f2cf22bf90a84f6e2a65524e87be2fce844f96f2dd9a6c9d1e635"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-win32.whl", hash = "sha256:e6f7f3f41faffaea6596da86ecc2389672fa949bd035251eab26dc6697451d05"}, + {file = "MarkupSafe-2.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:b8811d48078d1cf2a6863dafb896e68406c5f513048451cd2ded0473133473c7"}, + {file = "MarkupSafe-2.1.0.tar.gz", hash = "sha256:80beaf63ddfbc64a0452b841d8036ca0611e049650e20afcb882f5d3c266d65f"}, ] mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, @@ -1418,8 +1393,8 @@ mkdocs = [ {file = "mkdocs-1.2.3.tar.gz", hash = "sha256:89f5a094764381cda656af4298727c9f53dc3e602983087e1fe96ea1df24f4c1"}, ] mkdocs-material = [ - {file = "mkdocs-material-8.1.10.tar.gz", hash = "sha256:10970bfe2628eaa41c379e9075121b1232f4304cac9876feac8ac9d0d2e9035b"}, - {file = "mkdocs_material-8.1.10-py2.py3-none-any.whl", hash = "sha256:e47ad89b98c32a0832509a72ade2114e0c84727a573018d768f4c6de19886b2f"}, + {file = "mkdocs-material-8.2.1.tar.gz", hash = "sha256:efcb3a24e1ef374268306cb8b4d3ba0db5d2c4ee4aa1fc4bcbd2087571b1d975"}, + {file = "mkdocs_material-8.2.1-py2.py3-none-any.whl", hash = "sha256:9496b26593c8a0f9bb18bda7f1b919c0bc16838217f38212dca47cc9006d7fe0"}, ] mkdocs-material-extensions = [ {file = "mkdocs-material-extensions-1.0.3.tar.gz", hash = "sha256:bfd24dfdef7b41c312ede42648f9eb83476ea168ec163b613f9abd12bbfddba2"}, @@ -1504,8 +1479,8 @@ pathspec = [ {file = "pathspec-0.9.0.tar.gz", hash = "sha256:e564499435a2673d586f6b2130bb5b95f04a3ba06f81b8f895b651a3c76aabb1"}, ] platformdirs = [ - {file = "platformdirs-2.4.1-py3-none-any.whl", hash = "sha256:1d7385c7db91728b83efd0ca99a5afb296cab9d0ed8313a45ed8ba17967ecfca"}, - {file = "platformdirs-2.4.1.tar.gz", hash = "sha256:440633ddfebcc36264232365d7840a970e75e1018d15b4327d11f91909045fda"}, + {file = "platformdirs-2.5.0-py3-none-any.whl", hash = "sha256:30671902352e97b1eafd74ade8e4a694782bd3471685e78c32d0fdfd3aa7e7bb"}, + {file = "platformdirs-2.5.0.tar.gz", hash = "sha256:8ec11dfba28ecc0715eb5fb0147a87b1bf325f349f3da9aab2cd6b50b96b692b"}, ] pluggy = [ {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, @@ -1573,8 +1548,8 @@ pygments = [ {file = "Pygments-2.11.2.tar.gz", hash = "sha256:4e426f72023d88d03b2fa258de560726ce890ff3b630f88c21cbb8b2503b8c6a"}, ] pymdown-extensions = [ - {file = "pymdown-extensions-9.1.tar.gz", hash = "sha256:74247f2c80f1d9e3c7242abe1c16317da36c6f26c7ad4b8a7f457f0ec20f0365"}, - {file = "pymdown_extensions-9.1-py3-none-any.whl", hash = "sha256:b03e66f91f33af4a6e7a0e20c740313522995f69a03d86316b1449766c473d0e"}, + {file = "pymdown-extensions-9.2.tar.gz", hash = "sha256:ed8f69a18bc158f00cbf03abc536b88b6e541b7e699156501e767c48f81d8850"}, + {file = "pymdown_extensions-9.2-py3-none-any.whl", hash = "sha256:f2fa7d9317c672a419868c893c20a28fb7ed7fc60d4ec4774c35e01398ab330c"}, ] pyparsing = [ {file = "pyparsing-3.0.7-py3-none-any.whl", hash = "sha256:a6c06a88f252e6c322f65faf8f418b16213b51bdfaece0524c1c1bc30c63c484"}, @@ -1673,8 +1648,8 @@ toml = [ {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, ] tomli = [ - {file = "tomli-2.0.0-py3-none-any.whl", hash = "sha256:b5bde28da1fed24b9bd1d4d2b8cba62300bfb4ec9a6187a957e8ddb9434c5224"}, - {file = "tomli-2.0.0.tar.gz", hash = "sha256:c292c34f58502a1eb2bbb9f5bbc9a5ebc37bee10ffb8c2d6bbdfa8eb13cc14e1"}, + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] trio = [ {file = "trio-0.19.0-py3-none-any.whl", hash = "sha256:c27c231e66336183c484fbfe080fa6cc954149366c15dc21db8b7290081ec7b8"}, @@ -1707,8 +1682,8 @@ typed-ast = [ {file = "typed_ast-1.5.2.tar.gz", hash = "sha256:525a2d4088e70a9f75b08b3f87a51acc9cde640e19cc523c7e41aa355564ae27"}, ] typing-extensions = [ - {file = "typing_extensions-4.0.1-py3-none-any.whl", hash = "sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b"}, - {file = "typing_extensions-4.0.1.tar.gz", hash = "sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e"}, + {file = "typing_extensions-4.1.1-py3-none-any.whl", hash = "sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2"}, + {file = "typing_extensions-4.1.1.tar.gz", hash = "sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42"}, ] urllib3 = [ {file = "urllib3-1.26.8-py2.py3-none-any.whl", hash = "sha256:000ca7f471a233c2251c6c7023ee85305721bfdf18621ebff4fd17a8653427ed"}, diff --git a/pyproject.toml b/pyproject.toml index 5245576d..d6199c1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.7,<4" -di = "~0.56" +di = {git = "https://github.com/adriangb/di.git", branch = "seperate-marker-and-dependant"} anyio = "~3" starlette = ">=0.16.0,<1" importlib-metadata = {version = ">=3", python = "<3.8"} diff --git a/tests/test_dependency_injection.py b/tests/test_dependency_injection.py index 3b1bf3c2..d8a5a5e1 100644 --- a/tests/test_dependency_injection.py +++ b/tests/test_dependency_injection.py @@ -10,7 +10,7 @@ from starlette.responses import Response from starlette.testclient import TestClient -from xpresso import App, Depends, Operation, Path, WebSocketRoute +from xpresso import App, Dependant, Depends, Operation, Path, WebSocketRoute from xpresso.typing import Annotated @@ -31,8 +31,10 @@ async def endpoint(v: Annotated[None, Depends(endpoint_dep)]) -> Response: return Response() app = App( - routes=[Path("/", get=Operation(endpoint, dependencies=[Depends(route_dep)]))], - dependencies=[Depends(router_dep)], + routes=[ + Path("/", get=Operation(endpoint, dependencies=[Dependant(route_dep)])) + ], + dependencies=[Dependant(router_dep)], ) with TestClient(app=app) as client: diff --git a/tests/test_extractors/body/test_field_extractors.py b/tests/test_extractors/body/test_field_extractors.py index b4dbcdab..fe5239e2 100644 --- a/tests/test_extractors/body/test_field_extractors.py +++ b/tests/test_extractors/body/test_field_extractors.py @@ -6,7 +6,7 @@ else: from typing import Annotated -from di import Dependant +from di import Marker from pydantic import BaseModel from starlette.responses import Response from starlette.testclient import TestClient @@ -18,7 +18,7 @@ def test_non_field_markers_are_ignored() -> None: - class RandomMarker(Dependant[typing.Any]): + class RandomMarker(Marker): pass class FormDataModel(BaseModel): diff --git a/tests/test_responses/test_response_proxy.py b/tests/test_responses/test_response_proxy.py index b9543703..7095b9de 100644 --- a/tests/test_responses/test_response_proxy.py +++ b/tests/test_responses/test_response_proxy.py @@ -13,7 +13,7 @@ else: from typing import Annotated -from xpresso import App, Depends, Path +from xpresso import App, Dependant, Depends, Path from xpresso.exceptions import XpressoError from xpresso.responses import get_response, set_response @@ -83,7 +83,7 @@ async def endpoint() -> Response: Path( "/", get=endpoint, - dependencies=[Depends(dependency, scope="endpoint")], + dependencies=[Dependant(dependency, scope="endpoint")], ) ] ) @@ -107,7 +107,7 @@ async def endpoint() -> Response: Path( "/", get=endpoint, - dependencies=[Depends(dependency, scope="connection")], + dependencies=[Dependant(dependency, scope="connection")], ) ] ) diff --git a/tests/test_routing/test_mounts.py b/tests/test_routing/test_mounts.py index 1819a357..d3f14bc5 100644 --- a/tests/test_routing/test_mounts.py +++ b/tests/test_routing/test_mounts.py @@ -4,7 +4,7 @@ import pytest from di import BaseContainer -from xpresso import App, Depends, FromPath, Path, Request +from xpresso import App, Dependant, FromPath, Path, Request from xpresso.routing.mount import Mount from xpresso.testclient import TestClient @@ -309,7 +309,7 @@ async def endpoint(thing: Thing) -> str: container = BaseContainer(scopes=("app", "connection", "endpoint")) container.bind_by_type( - Depends(lambda: Thing("injected")), + Dependant(lambda: Thing("injected")), Thing, ) diff --git a/xpresso/__init__.py b/xpresso/__init__.py index c664fe21..ba9941af 100644 --- a/xpresso/__init__.py +++ b/xpresso/__init__.py @@ -20,7 +20,7 @@ RepeatedFormField, ) from xpresso.datastructures import UploadFile -from xpresso.dependencies.models import Depends +from xpresso.dependencies.models import Dependant, Depends from xpresso.exceptions import HTTPException from xpresso.parameters import ( CookieParam, @@ -53,6 +53,7 @@ "File", "Multipart", "Depends", + "Dependant", "App", "Router", "UploadFile", diff --git a/xpresso/_utils/overrides.py b/xpresso/_utils/overrides.py index c6c3e4c8..62832db7 100644 --- a/xpresso/_utils/overrides.py +++ b/xpresso/_utils/overrides.py @@ -13,7 +13,7 @@ from di.api.dependencies import DependantBase from di.api.providers import DependencyProvider -from xpresso.dependencies.models import Depends +from xpresso.dependencies.models import Dependant def get_type(param: inspect.Parameter) -> type: @@ -36,9 +36,9 @@ def hook( param: typing.Optional[inspect.Parameter], dependant: DependantBase[typing.Any], ) -> typing.Optional[DependantBase[typing.Any]]: - if not isinstance(dependant, Depends): + if not isinstance(dependant, Dependant): return None - dep = Depends( + dep = Dependant( replacement, scope=dependant.scope, use_cache=dependant.use_cache, diff --git a/xpresso/applications.py b/xpresso/applications.py index c0148716..a852f5a2 100644 --- a/xpresso/applications.py +++ b/xpresso/applications.py @@ -17,7 +17,7 @@ from xpresso._utils.asgi_scope_extension import XpressoASGIExtension from xpresso._utils.overrides import DependencyOverrideManager from xpresso._utils.routing import visit_routes -from xpresso.dependencies.models import Depends +from xpresso.dependencies.models import Dependant from xpresso.exception_handlers import ( http_exception_handler, validation_exception_handler, @@ -65,7 +65,7 @@ def __init__( routes: typing.Optional[typing.Sequence[BaseRoute]] = None, *, container: typing.Optional[BaseContainer] = None, - dependencies: typing.Optional[typing.List[Depends]] = None, + dependencies: typing.Optional[typing.List[DependantBase[typing.Any]]] = None, debug: bool = False, middleware: typing.Optional[typing.Sequence[Middleware]] = None, exception_handlers: typing.Optional[ExceptionHandlers] = None, @@ -103,16 +103,19 @@ async def lifespan_ctx(*_: typing.Any) -> typing.AsyncIterator[None]: async with self.container.enter_scope("app") as container: self.container = container if lifespan is not None: - dep = Depends( + dep = Dependant( _wrap_lifespan_as_async_generator(lifespan), scope="app" ) else: - dep = Depends(lambda: None, scope="app") + dep = Dependant(lambda: None, scope="app") solved = self.container.solve( JoinedDependant( dep, siblings=[ - *(Depends(lifespan, scope="app") for lifespan in lifespans), + *( + Dependant(lifespan, scope="app") + for lifespan in lifespans + ), *lifespan_deps, ], ) @@ -352,11 +355,11 @@ async def gen( def _register_framework_dependencies(container: BaseContainer, app: App): container.bind_by_type( - Depends(Request, scope="connection", wire=False), + Dependant(Request, scope="connection", wire=False), Request, ) container.bind_by_type( - Depends( + Dependant( HTTPConnection, scope="connection", wire=False, @@ -364,7 +367,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): HTTPConnection, ) container.bind_by_type( - Depends( + Dependant( WebSocket, scope="connection", wire=False, @@ -372,7 +375,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): WebSocket, ) container.bind_by_type( - Depends( + Dependant( BackgroundTasks, scope="connection", wire=False, @@ -380,7 +383,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): BackgroundTasks, ) container.bind_by_type( - Depends( + Dependant( lambda: app.container, scope="app", wire=False, @@ -389,7 +392,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): covariant=True, ) container.bind_by_type( - Depends( + Dependant( lambda: app, scope="app", wire=False, diff --git a/xpresso/binders/dependants.py b/xpresso/binders/dependants.py index 01aabe8c..60de5486 100644 --- a/xpresso/binders/dependants.py +++ b/xpresso/binders/dependants.py @@ -1,7 +1,7 @@ import inspect import typing -from di import Dependant +from di import Dependant, Marker from di.api.dependencies import CacheKey, DependantBase from xpresso.binders.api import ( @@ -16,7 +16,7 @@ ) -class ParameterBinderMarker(Dependant[typing.Any]): +class ParameterBinderMarker(Marker): def __init__( self, *, @@ -75,7 +75,7 @@ def __init__( self.extractor = extractor -class BodyBinderMarker(Dependant[typing.Any]): +class BodyBinderMarker(Marker): def __init__( self, *, diff --git a/xpresso/dependencies/models.py b/xpresso/dependencies/models.py index 5064f313..4a3f6924 100644 --- a/xpresso/dependencies/models.py +++ b/xpresso/dependencies/models.py @@ -10,6 +10,7 @@ from typing import Literal import di +from di.api.dependencies import DependantBase from di.api.providers import DependencyProvider T = typing.TypeVar("T") @@ -18,8 +19,7 @@ Scope = Literal["app", "connection", "endpoint"] -class Depends(di.Dependant[typing.Any]): - __slots__ = () +class Depends(di.Marker): scope: Scope def __init__( @@ -38,14 +38,47 @@ def __init__( sync_to_thread=sync_to_thread, ) - def initialize_sub_dependant(self, param: inspect.Parameter) -> Depends: + def from_callable( + self, call: typing.Optional[DependencyProvider] + ) -> DependantBase[typing.Any]: + return Dependant( + call=call, + scope=self.scope, + use_cache=self.use_cache, + wire=self.wire, + sync_to_thread=self.sync_to_thread, + ) + + +class Dependant(di.Dependant[typing.Any]): + scope: Scope + + def __init__( + self, + call: typing.Optional[DependencyProvider] = None, + scope: Scope = "connection", + use_cache: bool = True, + wire: bool = True, + sync_to_thread: bool = False, + ) -> None: + super().__init__( + call=call, + scope=scope, + use_cache=use_cache, + wire=wire, + sync_to_thread=sync_to_thread, + ) + + def initialize_sub_dependant( + self, param: inspect.Parameter + ) -> DependantBase[typing.Any]: if param.default is param.empty: # try to auto-wire return Depends( call=None, scope=self.scope, use_cache=self.use_cache, - ) + ).register_parameter(param) # has a default parameter but we create a dependency anyway just for binds # but do not wire it to make autowiring less brittle and less magic return Depends( @@ -53,4 +86,4 @@ def initialize_sub_dependant(self, param: inspect.Parameter) -> Depends: scope=self.scope, use_cache=self.use_cache, wire=False, - ) + ).register_parameter(param) diff --git a/xpresso/routing/operation.py b/xpresso/routing/operation.py index d492669d..b08098cc 100644 --- a/xpresso/routing/operation.py +++ b/xpresso/routing/operation.py @@ -1,11 +1,10 @@ import typing -from di import AsyncExecutor, BaseContainer, ConcurrentAsyncExecutor +from di import AsyncExecutor, BaseContainer, ConcurrentAsyncExecutor, JoinedDependant from di.api.dependencies import DependantBase from di.api.executor import AsyncExecutorProtocol from di.api.providers import DependencyProvider as Endpoint from di.api.solved import SolvedDependant -from di.dependant import JoinedDependant from starlette.datastructures import URLPath from starlette.requests import HTTPConnection, Request from starlette.responses import JSONResponse, Response @@ -15,7 +14,7 @@ import xpresso._utils.asgi_scope_extension as asgi_scope_extension import xpresso.binders.dependants as param_dependants import xpresso.openapi.models as openapi_models -from xpresso.dependencies.models import Depends +from xpresso.dependencies.models import Dependant from xpresso.encoders.api import Encoder from xpresso.encoders.json import JsonableEncoder from xpresso.responses import Responses @@ -81,7 +80,9 @@ def __init__( responses: typing.Optional[Responses] = None, # xpresso params name: typing.Optional[str] = None, - dependencies: typing.Optional[typing.Sequence[Depends]] = None, + dependencies: typing.Optional[ + typing.Sequence[DependantBase[typing.Any]] + ] = None, execute_dependencies_concurrently: bool = False, response_factory: typing.Callable[[typing.Any], Response] = JSONResponse, response_encoder: Encoder = JsonableEncoder(), @@ -122,7 +123,7 @@ def solve( ) -> None: self.dependant = container.solve( JoinedDependant( - Depends( + Dependant( self.endpoint, scope="endpoint", sync_to_thread=self.sync_to_thread ), siblings=[*dependencies, *(self.dependencies or ())], diff --git a/xpresso/routing/pathitem.py b/xpresso/routing/pathitem.py index e4cfed7a..f8251fe7 100644 --- a/xpresso/routing/pathitem.py +++ b/xpresso/routing/pathitem.py @@ -2,11 +2,11 @@ import starlette.routing import starlette.types +from di.api.dependencies import DependantBase from di.api.providers import DependencyProvider as Endpoint import xpresso.binders.dependants as param_dependants import xpresso.openapi.models as openapi_models -from xpresso.dependencies.models import Depends from xpresso.responses import Responses from xpresso.routing.operation import Operation @@ -45,7 +45,9 @@ def __init__( options: typing.Optional[typing.Union[Operation, Endpoint]] = None, trace: typing.Optional[typing.Union[Operation, Endpoint]] = None, redirect_slashes: bool = True, - dependencies: typing.Optional[typing.Sequence[Depends]] = None, + dependencies: typing.Optional[ + typing.Sequence[DependantBase[typing.Any]] + ] = None, # OpenAPI metadata include_in_schema: bool = True, name: typing.Optional[str] = None, diff --git a/xpresso/routing/router.py b/xpresso/routing/router.py index 5b5d4887..aab1cb8b 100644 --- a/xpresso/routing/router.py +++ b/xpresso/routing/router.py @@ -7,11 +7,11 @@ from typing import Protocol import starlette.middleware +from di.api.dependencies import DependantBase from starlette.routing import BaseRoute from starlette.routing import Router as StarletteRouter from starlette.types import Receive, Scope, Send -from xpresso.dependencies.models import Depends from xpresso.responses import Responses @@ -33,7 +33,7 @@ def __call__( class Router: routes: typing.Sequence[BaseRoute] lifespan: typing.Optional[typing.Callable[..., typing.AsyncContextManager[None]]] - dependencies: typing.Sequence[Depends] + dependencies: typing.Sequence[DependantBase[typing.Any]] tags: typing.Sequence[str] responses: Responses include_in_schema: bool @@ -62,7 +62,9 @@ def __init__( ] = None, redirect_slashes: bool = True, default: typing.Optional[_ASGIApp] = None, - dependencies: typing.Optional[typing.Sequence[Depends]] = None, + dependencies: typing.Optional[ + typing.Sequence[DependantBase[typing.Any]] + ] = None, tags: typing.Optional[typing.List[str]] = None, responses: typing.Optional[Responses] = None, include_in_schema: bool = True, diff --git a/xpresso/routing/websockets.py b/xpresso/routing/websockets.py index 03f5aacb..91caf06c 100644 --- a/xpresso/routing/websockets.py +++ b/xpresso/routing/websockets.py @@ -5,15 +5,19 @@ import starlette.routing import starlette.types import starlette.websockets -from di import AsyncExecutor, BaseContainer, ConcurrentAsyncExecutor +from di import ( + AsyncExecutor, + BaseContainer, + ConcurrentAsyncExecutor, + Dependant, + JoinedDependant, +) from di.api.dependencies import DependantBase from di.api.executor import AsyncExecutorProtocol from di.api.providers import DependencyProvider as Endpoint from di.api.solved import SolvedDependant -from di.dependant import JoinedDependant import xpresso._utils.asgi_scope_extension as asgi_scope_extension -from xpresso.dependencies.models import Depends class _WebSocketRoute: @@ -58,7 +62,9 @@ def __init__( endpoint: Endpoint, *, name: typing.Optional[str] = None, - dependencies: typing.Optional[typing.Sequence[Depends]] = None, + dependencies: typing.Optional[ + typing.Sequence[DependantBase[typing.Any]] + ] = None, execute_dependencies_concurrently: bool = False, ) -> None: super().__init__( # type: ignore @@ -77,7 +83,7 @@ def solve( ) -> None: self.dependant = container.solve( JoinedDependant( - Depends(self.endpoint, scope="endpoint"), + Dependant(self.endpoint, scope="endpoint"), siblings=[*dependencies, *(self.dependencies or ())], ) ) From 903c91c22169d36000120e75e83d8664ecf21f40 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 18:20:31 -0600 Subject: [PATCH 2/6] revert Depends -> Dependant by merging them --- .../advanced/dependencies/tutorial_001.py | 4 ++-- .../advanced/dependencies/tutorial_002.py | 6 ++--- .../advanced/dependencies/tutorial_004.py | 6 ++--- .../advanced/dependencies/tutorial_005.py | 4 ++-- docs_src/advanced/websockets.py | 4 ++-- .../tutorial/dependencies/tutorial_007.py | 10 ++++---- tests/test_dependency_injection.py | 8 +++---- tests/test_responses/test_response_proxy.py | 6 ++--- tests/test_routing/test_mounts.py | 4 ++-- xpresso/__init__.py | 3 +-- xpresso/_utils/overrides.py | 6 ++--- xpresso/applications.py | 23 ++++++++---------- xpresso/dependencies/models.py | 24 ++----------------- xpresso/routing/operation.py | 4 ++-- xpresso/routing/websockets.py | 11 +++------ 15 files changed, 44 insertions(+), 79 deletions(-) diff --git a/docs_src/advanced/dependencies/tutorial_001.py b/docs_src/advanced/dependencies/tutorial_001.py index c9bd1007..bf2455d3 100644 --- a/docs_src/advanced/dependencies/tutorial_001.py +++ b/docs_src/advanced/dependencies/tutorial_001.py @@ -1,6 +1,6 @@ import time -from xpresso import App, Dependant, Operation, Path +from xpresso import App, Depends, Operation, Path def slow_dependency() -> None: @@ -19,7 +19,7 @@ def slow_endpoint() -> None: endpoint=slow_endpoint, sync_to_thread=True, dependencies=[ - Dependant(slow_dependency, sync_to_thread=True) + Depends(slow_dependency, sync_to_thread=True) ], ), ) diff --git a/docs_src/advanced/dependencies/tutorial_002.py b/docs_src/advanced/dependencies/tutorial_002.py index b51ff7b7..c9274671 100644 --- a/docs_src/advanced/dependencies/tutorial_002.py +++ b/docs_src/advanced/dependencies/tutorial_002.py @@ -2,7 +2,7 @@ import anyio -from xpresso import App, Dependant, Operation, Path +from xpresso import App, Depends, Operation, Path def slow_dependency_1() -> None: @@ -24,8 +24,8 @@ async def endpoint() -> None: get=Operation( endpoint=endpoint, dependencies=[ - Dependant(slow_dependency_1, sync_to_thread=True), - Dependant(slow_dependency_2), + Depends(slow_dependency_1, sync_to_thread=True), + Depends(slow_dependency_2), ], execute_dependencies_concurrently=True, ), diff --git a/docs_src/advanced/dependencies/tutorial_004.py b/docs_src/advanced/dependencies/tutorial_004.py index ae44dffe..d0ea9c2d 100644 --- a/docs_src/advanced/dependencies/tutorial_004.py +++ b/docs_src/advanced/dependencies/tutorial_004.py @@ -2,7 +2,7 @@ from xpresso import ( App, - Dependant, + Depends, FromPath, HTTPException, Path, @@ -43,9 +43,7 @@ async def read_items(item_name: FromPath[str]) -> str: path="/items/{item_name}", get=read_items, dependencies=[ - Dependant( - log_response_status_code, scope="connection" - ) + Depends(log_response_status_code, scope="connection") ], ), ] diff --git a/docs_src/advanced/dependencies/tutorial_005.py b/docs_src/advanced/dependencies/tutorial_005.py index 784cfcd0..68418f31 100644 --- a/docs_src/advanced/dependencies/tutorial_005.py +++ b/docs_src/advanced/dependencies/tutorial_005.py @@ -3,7 +3,7 @@ from xpresso import ( App, - Dependant, + Depends, FromPath, HTTPException, Path, @@ -44,7 +44,7 @@ async def read_items(item_name: FromPath[str]) -> str: Path( path="/items/{item_name}", get=read_items, - dependencies=[Dependant(trace, scope="endpoint")], + dependencies=[Depends(trace, scope="endpoint")], ), ] ) diff --git a/docs_src/advanced/websockets.py b/docs_src/advanced/websockets.py index 2493e2ad..c7e0673c 100644 --- a/docs_src/advanced/websockets.py +++ b/docs_src/advanced/websockets.py @@ -1,6 +1,6 @@ from xpresso import ( App, - Dependant, + Depends, FromHeader, WebSocket, WebSocketRoute, @@ -31,7 +31,7 @@ async def websocket_endpoint( WebSocketRoute( path="/ws", endpoint=websocket_endpoint, - dependencies=[Dependant(enforce_header_pattern)], + dependencies=[Depends(enforce_header_pattern)], ), ] ) diff --git a/docs_src/tutorial/dependencies/tutorial_007.py b/docs_src/tutorial/dependencies/tutorial_007.py index 612779e4..e9dd9ac7 100644 --- a/docs_src/tutorial/dependencies/tutorial_007.py +++ b/docs_src/tutorial/dependencies/tutorial_007.py @@ -2,7 +2,7 @@ from xpresso import ( App, - Dependant, + Depends, FromPath, FromQuery, HTTPException, @@ -41,12 +41,10 @@ async def get_item(item_id: FromPath[str]) -> str: get=get_item, # no extra roles required delete=Operation( endpoint=delete_item, - dependencies=[ - Dependant(require_roles("items-admin")) - ], + dependencies=[Depends(require_roles("items-admin"))], ), - dependencies=[Dependant(require_roles("items-user"))], + dependencies=[Depends(require_roles("items-user"))], ) ], - dependencies=[Dependant(require_roles("user"))], + dependencies=[Depends(require_roles("user"))], ) diff --git a/tests/test_dependency_injection.py b/tests/test_dependency_injection.py index d8a5a5e1..3b1bf3c2 100644 --- a/tests/test_dependency_injection.py +++ b/tests/test_dependency_injection.py @@ -10,7 +10,7 @@ from starlette.responses import Response from starlette.testclient import TestClient -from xpresso import App, Dependant, Depends, Operation, Path, WebSocketRoute +from xpresso import App, Depends, Operation, Path, WebSocketRoute from xpresso.typing import Annotated @@ -31,10 +31,8 @@ async def endpoint(v: Annotated[None, Depends(endpoint_dep)]) -> Response: return Response() app = App( - routes=[ - Path("/", get=Operation(endpoint, dependencies=[Dependant(route_dep)])) - ], - dependencies=[Dependant(router_dep)], + routes=[Path("/", get=Operation(endpoint, dependencies=[Depends(route_dep)]))], + dependencies=[Depends(router_dep)], ) with TestClient(app=app) as client: diff --git a/tests/test_responses/test_response_proxy.py b/tests/test_responses/test_response_proxy.py index 7095b9de..b9543703 100644 --- a/tests/test_responses/test_response_proxy.py +++ b/tests/test_responses/test_response_proxy.py @@ -13,7 +13,7 @@ else: from typing import Annotated -from xpresso import App, Dependant, Depends, Path +from xpresso import App, Depends, Path from xpresso.exceptions import XpressoError from xpresso.responses import get_response, set_response @@ -83,7 +83,7 @@ async def endpoint() -> Response: Path( "/", get=endpoint, - dependencies=[Dependant(dependency, scope="endpoint")], + dependencies=[Depends(dependency, scope="endpoint")], ) ] ) @@ -107,7 +107,7 @@ async def endpoint() -> Response: Path( "/", get=endpoint, - dependencies=[Dependant(dependency, scope="connection")], + dependencies=[Depends(dependency, scope="connection")], ) ] ) diff --git a/tests/test_routing/test_mounts.py b/tests/test_routing/test_mounts.py index d3f14bc5..1819a357 100644 --- a/tests/test_routing/test_mounts.py +++ b/tests/test_routing/test_mounts.py @@ -4,7 +4,7 @@ import pytest from di import BaseContainer -from xpresso import App, Dependant, FromPath, Path, Request +from xpresso import App, Depends, FromPath, Path, Request from xpresso.routing.mount import Mount from xpresso.testclient import TestClient @@ -309,7 +309,7 @@ async def endpoint(thing: Thing) -> str: container = BaseContainer(scopes=("app", "connection", "endpoint")) container.bind_by_type( - Dependant(lambda: Thing("injected")), + Depends(lambda: Thing("injected")), Thing, ) diff --git a/xpresso/__init__.py b/xpresso/__init__.py index ba9941af..c664fe21 100644 --- a/xpresso/__init__.py +++ b/xpresso/__init__.py @@ -20,7 +20,7 @@ RepeatedFormField, ) from xpresso.datastructures import UploadFile -from xpresso.dependencies.models import Dependant, Depends +from xpresso.dependencies.models import Depends from xpresso.exceptions import HTTPException from xpresso.parameters import ( CookieParam, @@ -53,7 +53,6 @@ "File", "Multipart", "Depends", - "Dependant", "App", "Router", "UploadFile", diff --git a/xpresso/_utils/overrides.py b/xpresso/_utils/overrides.py index 62832db7..c6c3e4c8 100644 --- a/xpresso/_utils/overrides.py +++ b/xpresso/_utils/overrides.py @@ -13,7 +13,7 @@ from di.api.dependencies import DependantBase from di.api.providers import DependencyProvider -from xpresso.dependencies.models import Dependant +from xpresso.dependencies.models import Depends def get_type(param: inspect.Parameter) -> type: @@ -36,9 +36,9 @@ def hook( param: typing.Optional[inspect.Parameter], dependant: DependantBase[typing.Any], ) -> typing.Optional[DependantBase[typing.Any]]: - if not isinstance(dependant, Dependant): + if not isinstance(dependant, Depends): return None - dep = Dependant( + dep = Depends( replacement, scope=dependant.scope, use_cache=dependant.use_cache, diff --git a/xpresso/applications.py b/xpresso/applications.py index a852f5a2..13e0f724 100644 --- a/xpresso/applications.py +++ b/xpresso/applications.py @@ -17,7 +17,7 @@ from xpresso._utils.asgi_scope_extension import XpressoASGIExtension from xpresso._utils.overrides import DependencyOverrideManager from xpresso._utils.routing import visit_routes -from xpresso.dependencies.models import Dependant +from xpresso.dependencies.models import Depends from xpresso.exception_handlers import ( http_exception_handler, validation_exception_handler, @@ -103,19 +103,16 @@ async def lifespan_ctx(*_: typing.Any) -> typing.AsyncIterator[None]: async with self.container.enter_scope("app") as container: self.container = container if lifespan is not None: - dep = Dependant( + dep = Depends( _wrap_lifespan_as_async_generator(lifespan), scope="app" ) else: - dep = Dependant(lambda: None, scope="app") + dep = Depends(lambda: None, scope="app") solved = self.container.solve( JoinedDependant( dep, siblings=[ - *( - Dependant(lifespan, scope="app") - for lifespan in lifespans - ), + *(Depends(lifespan, scope="app") for lifespan in lifespans), *lifespan_deps, ], ) @@ -355,11 +352,11 @@ async def gen( def _register_framework_dependencies(container: BaseContainer, app: App): container.bind_by_type( - Dependant(Request, scope="connection", wire=False), + Depends(Request, scope="connection", wire=False), Request, ) container.bind_by_type( - Dependant( + Depends( HTTPConnection, scope="connection", wire=False, @@ -367,7 +364,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): HTTPConnection, ) container.bind_by_type( - Dependant( + Depends( WebSocket, scope="connection", wire=False, @@ -375,7 +372,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): WebSocket, ) container.bind_by_type( - Dependant( + Depends( BackgroundTasks, scope="connection", wire=False, @@ -383,7 +380,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): BackgroundTasks, ) container.bind_by_type( - Dependant( + Depends( lambda: app.container, scope="app", wire=False, @@ -392,7 +389,7 @@ def _register_framework_dependencies(container: BaseContainer, app: App): covariant=True, ) container.bind_by_type( - Dependant( + Depends( lambda: app, scope="app", wire=False, diff --git a/xpresso/dependencies/models.py b/xpresso/dependencies/models.py index 4a3f6924..0f99b3f6 100644 --- a/xpresso/dependencies/models.py +++ b/xpresso/dependencies/models.py @@ -19,7 +19,7 @@ Scope = Literal["app", "connection", "endpoint"] -class Depends(di.Marker): +class Depends(di.Marker, di.Dependant[typing.Any]): scope: Scope def __init__( @@ -41,7 +41,7 @@ def __init__( def from_callable( self, call: typing.Optional[DependencyProvider] ) -> DependantBase[typing.Any]: - return Dependant( + return Depends( call=call, scope=self.scope, use_cache=self.use_cache, @@ -49,26 +49,6 @@ def from_callable( sync_to_thread=self.sync_to_thread, ) - -class Dependant(di.Dependant[typing.Any]): - scope: Scope - - def __init__( - self, - call: typing.Optional[DependencyProvider] = None, - scope: Scope = "connection", - use_cache: bool = True, - wire: bool = True, - sync_to_thread: bool = False, - ) -> None: - super().__init__( - call=call, - scope=scope, - use_cache=use_cache, - wire=wire, - sync_to_thread=sync_to_thread, - ) - def initialize_sub_dependant( self, param: inspect.Parameter ) -> DependantBase[typing.Any]: diff --git a/xpresso/routing/operation.py b/xpresso/routing/operation.py index b08098cc..c1b419bf 100644 --- a/xpresso/routing/operation.py +++ b/xpresso/routing/operation.py @@ -14,7 +14,7 @@ import xpresso._utils.asgi_scope_extension as asgi_scope_extension import xpresso.binders.dependants as param_dependants import xpresso.openapi.models as openapi_models -from xpresso.dependencies.models import Dependant +from xpresso.dependencies.models import Depends from xpresso.encoders.api import Encoder from xpresso.encoders.json import JsonableEncoder from xpresso.responses import Responses @@ -123,7 +123,7 @@ def solve( ) -> None: self.dependant = container.solve( JoinedDependant( - Dependant( + Depends( self.endpoint, scope="endpoint", sync_to_thread=self.sync_to_thread ), siblings=[*dependencies, *(self.dependencies or ())], diff --git a/xpresso/routing/websockets.py b/xpresso/routing/websockets.py index 91caf06c..e924fdd8 100644 --- a/xpresso/routing/websockets.py +++ b/xpresso/routing/websockets.py @@ -5,19 +5,14 @@ import starlette.routing import starlette.types import starlette.websockets -from di import ( - AsyncExecutor, - BaseContainer, - ConcurrentAsyncExecutor, - Dependant, - JoinedDependant, -) +from di import AsyncExecutor, BaseContainer, ConcurrentAsyncExecutor, JoinedDependant from di.api.dependencies import DependantBase from di.api.executor import AsyncExecutorProtocol from di.api.providers import DependencyProvider as Endpoint from di.api.solved import SolvedDependant import xpresso._utils.asgi_scope_extension as asgi_scope_extension +from xpresso.dependencies.models import Depends class _WebSocketRoute: @@ -83,7 +78,7 @@ def solve( ) -> None: self.dependant = container.solve( JoinedDependant( - Dependant(self.endpoint, scope="endpoint"), + Depends(self.endpoint, scope="endpoint"), siblings=[*dependencies, *(self.dependencies or ())], ) ) From 0a8a87e1fc3358001d899cae394ae5e477ab697f Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 18:23:39 -0600 Subject: [PATCH 3/6] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cc709192..bace0f81 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.7,<4" -di = {git = "https://github.com/adriangb/di.git", branch = "seperate-marker-and-dependant"} +di = "~0.58" anyio = "~3" starlette = ">=0.16.0,<1" importlib-metadata = {version = ">=3", python = "<3.8"} From 6673dbf6d37fe171fc0bf20bbdad4393fb379ab4 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 18:29:27 -0600 Subject: [PATCH 4/6] udpate version --- poetry.lock | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/poetry.lock b/poetry.lock index 471ae782..b6468b68 100644 --- a/poetry.lock +++ b/poetry.lock @@ -173,20 +173,13 @@ description = "Autowiring dependency injection" category = "main" optional = false python-versions = ">=3.7,<4" -develop = false [package.dependencies] -anyio = "~3" +anyio = ">=3,<4" graphlib2 = ">=0.2.13" importlib-metadata = {version = ">=3", markers = "python_version < \"3.8\""} typing-extensions = {version = ">=3", markers = "python_version < \"3.9\""} -[package.source] -type = "git" -url = "https://github.com/adriangb/di.git" -reference = "seperate-marker-and-dependant" -resolved_reference = "43babf78fa758c87683256dba6ef616c2dc54c76" - [[package]] name = "distlib" version = "0.3.4" @@ -1061,7 +1054,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = ">=3.7,<4" -content-hash = "db8016a325565d1aa91bff84a6a049abf0a58c22b4f89ad983e0bb431ed108dc" +content-hash = "ebc00e866b2e30cd0a88d6a82fb65cbadc824e94670978e49ca2779a4ed64fbc" [metadata.files] anyio = [ @@ -1228,7 +1221,10 @@ coverage = [ {file = "coverage-6.3.1-pp36.pp37.pp38-none-any.whl", hash = "sha256:463e52616ea687fd323888e86bf25e864a3cc6335a043fad6bbb037dbf49bbe2"}, {file = "coverage-6.3.1.tar.gz", hash = "sha256:6c3f6158b02ac403868eea390930ae64e9a9a2a5bbfafefbb920d29258d9f2f8"}, ] -di = [] +di = [ + {file = "di-0.58.0-py3-none-any.whl", hash = "sha256:a0b9dbe9bb20233da87832a991749e65110f55dbb9ba942b8cfdafe75431d2ef"}, + {file = "di-0.58.0.tar.gz", hash = "sha256:98258aae89a7c28e7eaf1f0aec08323d69c4167f92e33d214566c285590a965d"}, +] distlib = [ {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, {file = "distlib-0.3.4.zip", hash = "sha256:e4b58818180336dc9c529bfb9a0b58728ffc09ad92027a3f30b7cd91e3458579"}, From b7d2707bd8108c3a45ca259597a5a072054e2105 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 19:30:50 -0600 Subject: [PATCH 5/6] update dep --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index b6468b68..0752c0a8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -168,7 +168,7 @@ toml = ["tomli"] [[package]] name = "di" -version = "0.58.0" +version = "0.58.1" description = "Autowiring dependency injection" category = "main" optional = false @@ -1054,7 +1054,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest- [metadata] lock-version = "1.1" python-versions = ">=3.7,<4" -content-hash = "ebc00e866b2e30cd0a88d6a82fb65cbadc824e94670978e49ca2779a4ed64fbc" +content-hash = "e8bf5caa8d7a03590de42ebc656d6a1e1a2df5d289159f37554fec0c73806936" [metadata.files] anyio = [ @@ -1222,8 +1222,8 @@ coverage = [ {file = "coverage-6.3.1.tar.gz", hash = "sha256:6c3f6158b02ac403868eea390930ae64e9a9a2a5bbfafefbb920d29258d9f2f8"}, ] di = [ - {file = "di-0.58.0-py3-none-any.whl", hash = "sha256:a0b9dbe9bb20233da87832a991749e65110f55dbb9ba942b8cfdafe75431d2ef"}, - {file = "di-0.58.0.tar.gz", hash = "sha256:98258aae89a7c28e7eaf1f0aec08323d69c4167f92e33d214566c285590a965d"}, + {file = "di-0.58.1-py3-none-any.whl", hash = "sha256:ded89b13f7c4e3549e54d33a6943d2a79a339de992b7136438837d0f0ccc2ef6"}, + {file = "di-0.58.1.tar.gz", hash = "sha256:f31798743fac85bb631283915c4ffbd32a539e2d292f81e270517123d329ecdc"}, ] distlib = [ {file = "distlib-0.3.4-py2.py3-none-any.whl", hash = "sha256:6564fe0a8f51e734df6333d08b8b94d4ea8ee6b99b5ed50613f731fd4089f34b"}, diff --git a/pyproject.toml b/pyproject.toml index bace0f81..4f52bd8d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ classifiers = [ [tool.poetry.dependencies] python = ">=3.7,<4" -di = "~0.58" +di = ">=0.58.1,<0.59.0" anyio = "~3" starlette = ">=0.16.0,<1" importlib-metadata = {version = ">=3", python = "<3.8"} From eb42f76616e26b8264bf278702f10d8418fa3f83 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Fri, 18 Feb 2022 19:35:32 -0600 Subject: [PATCH 6/6] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4f52bd8d..3b0adfb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "xpresso" -version = "0.18.1" +version = "0.19.0" description = "A developer centric, performant Python web framework" authors = ["Adrian Garcia Badaracco "] readme = "README.md"