diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 0731c5ba..37a358dd 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -2,6 +2,7 @@ name: CD on: pull_request: types: [closed] + branches: [main] jobs: Pre-Check: diff --git a/.github/workflows/post-cd.yaml b/.github/workflows/post-cd.yaml index be8e9a3e..d75e0953 100644 --- a/.github/workflows/post-cd.yaml +++ b/.github/workflows/post-cd.yaml @@ -3,12 +3,14 @@ on: # When Pull Request is merged pull_request_target: types: [closed] + branches: [main] jobs: Dev-PR: runs-on: ubuntu-latest if: | github.event.pull_request.user.login == 'github-actions[bot]' && + startsWith(github.event.pull_request.title, '[CD]') github.event.pull_request.merged == true steps: - name: Checkout diff --git a/.gitignore b/.gitignore index 83e6d3d9..9cccc7c0 100644 --- a/.gitignore +++ b/.gitignore @@ -104,9 +104,7 @@ celerybeat.pid # Environments .env .venv -env/ venv/ -ENV/ env.bak/ venv.bak/ diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..7ab672fa --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,43 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # You can also specify other tool versions: + # nodejs: "19" + # rust: "1.64" + # golang: "1.19" + jobs: + post_create_environment: + # Install poetry + # https://python-poetry.org/docs/#installing-manually + - pip install poetry + # Tell poetry to not use a virtual environment + - poetry config virtualenvs.create false + post_install: + # Install dependencies with 'docs' dependency group + # https://python-poetry.org/docs/managing-dependencies/#dependency-groups + - cd docs && poetry install && cd .. + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +# python: +# install: +# - requirements: docs/requirements.txt diff --git a/VERSION b/VERSION index e290171e..ec1ca6a8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0a29 \ No newline at end of file +0.1.0a30 \ No newline at end of file diff --git a/docs/build.sh b/docs/build.sh new file mode 100644 index 00000000..44432917 --- /dev/null +++ b/docs/build.sh @@ -0,0 +1 @@ +sphinx-build source/ build diff --git a/docs/clean.sh b/docs/clean.sh new file mode 100644 index 00000000..e0b9d282 --- /dev/null +++ b/docs/clean.sh @@ -0,0 +1 @@ +rm -Rf ./source/**/*.rst diff --git a/docs/docgen.sh b/docs/docgen.sh new file mode 100644 index 00000000..d8eeb376 --- /dev/null +++ b/docs/docgen.sh @@ -0,0 +1,8 @@ +sphinx-apidoc ../packages/polywrap-msgpack/polywrap_msgpack -o ./source/polywrap-msgpack -e +sphinx-apidoc ../packages/polywrap-manifest/polywrap_manifest -o ./source/polywrap-manifest -e +sphinx-apidoc ../packages/polywrap-core/polywrap_core -o ./source/polywrap-core -e +sphinx-apidoc ../packages/polywrap-wasm/polywrap_wasm -o ./source/polywrap-wasm -e +sphinx-apidoc ../packages/polywrap-plugin/polywrap_plugin -o ./source/polywrap-plugin -e +sphinx-apidoc ../packages/polywrap-uri-resolvers/polywrap_uri_resolvers -o ./source/polywrap-uri-resolvers -e +sphinx-apidoc ../packages/polywrap-client/polywrap_client -o ./source/polywrap-client -e +sphinx-apidoc ../packages/polywrap-client-config-builder/polywrap_client_config_builder -o ./source/polywrap-client-config-builder -e diff --git a/docs/poetry.lock b/docs/poetry.lock index 6474e47e..a0abc76f 100644 --- a/docs/poetry.lock +++ b/docs/poetry.lock @@ -24,28 +24,16 @@ files = [ {file = "Babel-2.12.1.tar.gz", hash = "sha256:cc2d99999cd01d44420ae725a21c9e3711b3aadc7976d6147f622d8581963455"}, ] -[[package]] -name = "backoff" -version = "2.2.1" -description = "Function decoration for backoff and retry" -category = "main" -optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"}, - {file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"}, -] - [[package]] name = "certifi" -version = "2022.12.7" +version = "2023.5.7" description = "Python package for providing Mozilla's CA Bundle." category = "dev" optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, - {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, + {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, + {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, ] [[package]] @@ -157,50 +145,11 @@ files = [ {file = "docutils-0.18.1.tar.gz", hash = "sha256:679987caf361a7539d76e584cbeddc311e3aee937877c87346f31debc63e9d06"}, ] -[[package]] -name = "gql" -version = "3.4.0" -description = "GraphQL client for Python" -category = "main" -optional = false -python-versions = "*" -files = [ - {file = "gql-3.4.0-py2.py3-none-any.whl", hash = "sha256:59c8a0b8f0a2f3b0b2ff970c94de86f82f65cb1da3340bfe57143e5f7ea82f71"}, - {file = "gql-3.4.0.tar.gz", hash = "sha256:ca81aa8314fa88a8c57dd1ce34941278e0c352d762eb721edcba0387829ea7c0"}, -] - -[package.dependencies] -backoff = ">=1.11.1,<3.0" -graphql-core = ">=3.2,<3.3" -yarl = ">=1.6,<2.0" - -[package.extras] -aiohttp = ["aiohttp (>=3.7.1,<3.9.0)"] -all = ["aiohttp (>=3.7.1,<3.9.0)", "botocore (>=1.21,<2)", "requests (>=2.26,<3)", "requests-toolbelt (>=0.9.1,<1)", "urllib3 (>=1.26)", "websockets (>=10,<11)", "websockets (>=9,<10)"] -botocore = ["botocore (>=1.21,<2)"] -dev = ["aiofiles", "aiohttp (>=3.7.1,<3.9.0)", "black (==22.3.0)", "botocore (>=1.21,<2)", "check-manifest (>=0.42,<1)", "flake8 (==3.8.1)", "isort (==4.3.21)", "mock (==4.0.2)", "mypy (==0.910)", "parse (==1.15.0)", "pytest (==6.2.5)", "pytest-asyncio (==0.16.0)", "pytest-console-scripts (==1.3.1)", "pytest-cov (==3.0.0)", "requests (>=2.26,<3)", "requests-toolbelt (>=0.9.1,<1)", "sphinx (>=3.0.0,<4)", "sphinx-argparse (==0.2.5)", "sphinx-rtd-theme (>=0.4,<1)", "types-aiofiles", "types-mock", "types-requests", "urllib3 (>=1.26)", "vcrpy (==4.0.2)", "websockets (>=10,<11)", "websockets (>=9,<10)"] -requests = ["requests (>=2.26,<3)", "requests-toolbelt (>=0.9.1,<1)", "urllib3 (>=1.26)"] -test = ["aiofiles", "aiohttp (>=3.7.1,<3.9.0)", "botocore (>=1.21,<2)", "mock (==4.0.2)", "parse (==1.15.0)", "pytest (==6.2.5)", "pytest-asyncio (==0.16.0)", "pytest-console-scripts (==1.3.1)", "pytest-cov (==3.0.0)", "requests (>=2.26,<3)", "requests-toolbelt (>=0.9.1,<1)", "urllib3 (>=1.26)", "vcrpy (==4.0.2)", "websockets (>=10,<11)", "websockets (>=9,<10)"] -test-no-transport = ["aiofiles", "mock (==4.0.2)", "parse (==1.15.0)", "pytest (==6.2.5)", "pytest-asyncio (==0.16.0)", "pytest-console-scripts (==1.3.1)", "pytest-cov (==3.0.0)", "vcrpy (==4.0.2)"] -websockets = ["websockets (>=10,<11)", "websockets (>=9,<10)"] - -[[package]] -name = "graphql-core" -version = "3.2.3" -description = "GraphQL implementation for Python, a port of GraphQL.js, the JavaScript reference implementation for GraphQL." -category = "main" -optional = false -python-versions = ">=3.6,<4" -files = [ - {file = "graphql-core-3.2.3.tar.gz", hash = "sha256:06d2aad0ac723e35b1cb47885d3e5c45e956a53bc1b209a9fc5369007fe46676"}, - {file = "graphql_core-3.2.3-py3-none-any.whl", hash = "sha256:5766780452bd5ec8ba133f8bf287dc92713e3868ddd83aee4faab9fc3e303dc3"}, -] - [[package]] name = "idna" version = "3.4" description = "Internationalized Domain Names in Applications (IDNA)" -category = "main" +category = "dev" optional = false python-versions = ">=3.5" files = [ @@ -240,62 +189,62 @@ i18n = ["Babel (>=2.7)"] [[package]] name = "markupsafe" -version = "2.1.2" +version = "2.1.3" description = "Safely add untrusted strings to HTML/XML markup." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:665a36ae6f8f20a4676b53224e33d456a6f5a72657d9c83c2aa00765072f31f7"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:340bea174e9761308703ae988e982005aedf427de816d1afe98147668cc03036"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22152d00bf4a9c7c83960521fc558f55a1adbc0631fbb00a9471e097b19d72e1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:28057e985dace2f478e042eaa15606c7efccb700797660629da387eb289b9323"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca244fa73f50a800cf8c3ebf7fd93149ec37f5cb9596aa8873ae2c1d23498601"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:d9d971ec1e79906046aa3ca266de79eac42f1dbf3612a05dc9368125952bd1a1"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:7e007132af78ea9df29495dbf7b5824cb71648d7133cf7848a2a5dd00d36f9ff"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:7313ce6a199651c4ed9d7e4cfb4aa56fe923b1adf9af3b420ee14e6d9a73df65"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win32.whl", hash = "sha256:c4a549890a45f57f1ebf99c067a4ad0cb423a05544accaf2b065246827ed9603"}, - {file = "MarkupSafe-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:835fb5e38fd89328e9c81067fd642b3593c33e1e17e2fdbf77f5676abb14a156"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2ec4f2d48ae59bbb9d1f9d7efb9236ab81429a764dedca114f5fdabbc3788013"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:608e7073dfa9e38a85d38474c082d4281f4ce276ac0010224eaba11e929dd53a"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:65608c35bfb8a76763f37036547f7adfd09270fbdbf96608be2bead319728fcd"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f2bfb563d0211ce16b63c7cb9395d2c682a23187f54c3d79bfec33e6705473c6"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:da25303d91526aac3672ee6d49a2f3db2d9502a4a60b55519feb1a4c7714e07d"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:9cad97ab29dfc3f0249b483412c85c8ef4766d96cdf9dcf5a1e3caa3f3661cf1"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:085fd3201e7b12809f9e6e9bc1e5c96a368c8523fad5afb02afe3c051ae4afcc"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1bea30e9bf331f3fef67e0a3877b2288593c98a21ccb2cf29b74c581a4eb3af0"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win32.whl", hash = "sha256:7df70907e00c970c60b9ef2938d894a9381f38e6b9db73c5be35e59d92e06625"}, - {file = "MarkupSafe-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:e55e40ff0cc8cc5c07996915ad367fa47da6b3fc091fdadca7f5403239c5fec3"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a6e40afa7f45939ca356f348c8e23048e02cb109ced1eb8420961b2f40fb373a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cf877ab4ed6e302ec1d04952ca358b381a882fbd9d1b07cccbfd61783561f98a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:63ba06c9941e46fa389d389644e2d8225e0e3e5ebcc4ff1ea8506dce646f8c8a"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f1cd098434e83e656abf198f103a8207a8187c0fc110306691a2e94a78d0abb2"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:55f44b440d491028addb3b88f72207d71eeebfb7b5dbf0643f7c023ae1fba619"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:a6f2fcca746e8d5910e18782f976489939d54a91f9411c32051b4aab2bd7c513"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:0b462104ba25f1ac006fdab8b6a01ebbfbce9ed37fd37fd4acd70c67c973e460"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win32.whl", hash = "sha256:7668b52e102d0ed87cb082380a7e2e1e78737ddecdde129acadb0eccc5423859"}, - {file = "MarkupSafe-2.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:6d6607f98fcf17e534162f0709aaad3ab7a96032723d8ac8750ffe17ae5a0666"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:a806db027852538d2ad7555b203300173dd1b77ba116de92da9afbc3a3be3eed"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:a4abaec6ca3ad8660690236d11bfe28dfd707778e2442b45addd2f086d6ef094"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f03a532d7dee1bed20bc4884194a16160a2de9ffc6354b3878ec9682bb623c54"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4cf06cdc1dda95223e9d2d3c58d3b178aa5dacb35ee7e3bbac10e4e1faacb419"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:22731d79ed2eb25059ae3df1dfc9cb1546691cc41f4e3130fe6bfbc3ecbbecfa"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:f8ffb705ffcf5ddd0e80b65ddf7bed7ee4f5a441ea7d3419e861a12eaf41af58"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:8db032bf0ce9022a8e41a22598eefc802314e81b879ae093f36ce9ddf39ab1ba"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:2298c859cfc5463f1b64bd55cb3e602528db6fa0f3cfd568d3605c50678f8f03"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win32.whl", hash = "sha256:50c42830a633fa0cf9e7d27664637532791bfc31c731a87b202d2d8ac40c3ea2"}, - {file = "MarkupSafe-2.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:bb06feb762bade6bf3c8b844462274db0c76acc95c52abe8dbed28ae3d44a147"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:99625a92da8229df6d44335e6fcc558a5037dd0a760e11d84be2260e6f37002f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:8bca7e26c1dd751236cfb0c6c72d4ad61d986e9a41bbf76cb445f69488b2a2bd"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40627dcf047dadb22cd25ea7ecfe9cbf3bbbad0482ee5920b582f3809c97654f"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40dfd3fefbef579ee058f139733ac336312663c6706d1163b82b3003fb1925c4"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:090376d812fb6ac5f171e5938e82e7f2d7adc2b629101cec0db8b267815c85e2"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:2e7821bffe00aa6bd07a23913b7f4e01328c3d5cc0b40b36c0bd81d362faeb65"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:c0a33bc9f02c2b17c3ea382f91b4db0e6cde90b63b296422a939886a7a80de1c"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b8526c6d437855442cdd3d87eede9c425c4445ea011ca38d937db299382e6fa3"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win32.whl", hash = "sha256:137678c63c977754abe9086a3ec011e8fd985ab90631145dfb9294ad09c102a7"}, - {file = "MarkupSafe-2.1.2-cp39-cp39-win_amd64.whl", hash = "sha256:0576fe974b40a400449768941d5d0858cc624e3249dfd1e0c33674e5c7ca7aed"}, - {file = "MarkupSafe-2.1.2.tar.gz", hash = "sha256:abcabc8c2b26036d62d4c746381a6f7cf60aafcc653198ad678306986b09450d"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cd0f502fe016460680cd20aaa5a76d241d6f35a1c3350c474bac1273803893fa"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e09031c87a1e51556fdcb46e5bd4f59dfb743061cf93c4d6831bf894f125eb57"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:68e78619a61ecf91e76aa3e6e8e33fc4894a2bebe93410754bd28fce0a8a4f9f"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c1a9bcdadc6c28eecee2c119465aebff8f7a584dd719facdd9e825ec61ab52"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:525808b8019e36eb524b8c68acdd63a37e75714eac50e988180b169d64480a00"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:962f82a3086483f5e5f64dbad880d31038b698494799b097bc59c2edf392fce6"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:aa7bd130efab1c280bed0f45501b7c8795f9fdbeb02e965371bbef3523627779"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:c9c804664ebe8f83a211cace637506669e7890fec1b4195b505c214e50dd4eb7"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win32.whl", hash = "sha256:10bbfe99883db80bdbaff2dcf681dfc6533a614f700da1287707e8a5d78a8431"}, + {file = "MarkupSafe-2.1.3-cp310-cp310-win_amd64.whl", hash = "sha256:1577735524cdad32f9f694208aa75e422adba74f1baee7551620e43a3141f559"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:ad9e82fb8f09ade1c3e1b996a6337afac2b8b9e365f926f5a61aacc71adc5b3c"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:3c0fae6c3be832a0a0473ac912810b2877c8cb9d76ca48de1ed31e1c68386575"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b076b6226fb84157e3f7c971a47ff3a679d837cf338547532ab866c57930dbee"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bfce63a9e7834b12b87c64d6b155fdd9b3b96191b6bd334bf37db7ff1fe457f2"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:338ae27d6b8745585f87218a3f23f1512dbf52c26c28e322dbe54bcede54ccb9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e4dd52d80b8c83fdce44e12478ad2e85c64ea965e75d66dbeafb0a3e77308fcc"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:df0be2b576a7abbf737b1575f048c23fb1d769f267ec4358296f31c2479db8f9"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, + {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca379055a47383d02a5400cb0d110cef0a776fc644cda797db0c5696cfd7e18e"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b7ff0f54cb4ff66dd38bebd335a38e2c22c41a8ee45aa608efc890ac3e3931bc"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:c011a4149cfbcf9f03994ec2edffcb8b1dc2d2aede7ca243746df97a5d41ce48"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:56d9f2ecac662ca1611d183feb03a3fa4406469dafe241673d521dd5ae92a155"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win32.whl", hash = "sha256:8758846a7e80910096950b67071243da3e5a20ed2546e6392603c096778d48e0"}, + {file = "MarkupSafe-2.1.3-cp37-cp37m-win_amd64.whl", hash = "sha256:787003c0ddb00500e49a10f2844fac87aa6ce977b90b0feaaf9de23c22508b24"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:2ef12179d3a291be237280175b542c07a36e7f60718296278d8593d21ca937d4"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2c1b19b3aaacc6e57b7e25710ff571c24d6c3613a45e905b1fde04d691b98ee0"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8afafd99945ead6e075b973fefa56379c5b5c53fd8937dad92c662da5d8fd5ee"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c41976a29d078bb235fea9b2ecd3da465df42a562910f9022f1a03107bd02be"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d080e0a5eb2529460b30190fcfcc4199bd7f827663f858a226a81bc27beaa97e"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:69c0f17e9f5a7afdf2cc9fb2d1ce6aabdb3bafb7f38017c0b77862bcec2bbad8"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:504b320cd4b7eff6f968eddf81127112db685e81f7e36e75f9f84f0df46041c3"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:42de32b22b6b804f42c5d98be4f7e5e977ecdd9ee9b660fda1a3edf03b11792d"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win32.whl", hash = "sha256:ceb01949af7121f9fc39f7d27f91be8546f3fb112c608bc4029aef0bab86a2a5"}, + {file = "MarkupSafe-2.1.3-cp38-cp38-win_amd64.whl", hash = "sha256:1b40069d487e7edb2676d3fbdb2b0829ffa2cd63a2ec26c4938b2d34391b4ecc"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8023faf4e01efadfa183e863fefde0046de576c6f14659e8782065bcece22198"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:6b2b56950d93e41f33b4223ead100ea0fe11f8e6ee5f641eb753ce4b77a7042b"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9dcdfd0eaf283af041973bff14a2e143b8bd64e069f4c383416ecd79a81aab58"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:05fb21170423db021895e1ea1e1f3ab3adb85d1c2333cbc2310f2a26bc77272e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:282c2cb35b5b673bbcadb33a585408104df04f14b2d9b01d4c345a3b92861c2c"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:ab4a0df41e7c16a1392727727e7998a467472d0ad65f3ad5e6e765015df08636"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7ef3cb2ebbf91e330e3bb937efada0edd9003683db6b57bb108c4001f37a02ea"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0a4e4a1aff6c7ac4cd55792abf96c915634c2b97e3cc1c7129578aa68ebd754e"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win32.whl", hash = "sha256:fec21693218efe39aa7f8599346e90c705afa52c5b31ae019b2e57e8f6542bb2"}, + {file = "MarkupSafe-2.1.3-cp39-cp39-win_amd64.whl", hash = "sha256:3fd4abcb888d15a94f32b75d8fd18ee162ca0c064f35b11134be77050296d6ba"}, + {file = "MarkupSafe-2.1.3.tar.gz", hash = "sha256:af598ed32d6ae86f1b747b82783958b1a4ab8f617b06fe68795c7f026abbdcad"}, ] [[package]] @@ -371,105 +320,21 @@ files = [ {file = "msgpack-1.0.5.tar.gz", hash = "sha256:c075544284eadc5cddc70f4757331d99dcbc16b2bbd4849d15f8aae4cf36d31c"}, ] -[[package]] -name = "multidict" -version = "6.0.4" -description = "multidict implementation" -category = "main" -optional = false -python-versions = ">=3.7" -files = [ - {file = "multidict-6.0.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:0b1a97283e0c85772d613878028fec909f003993e1007eafa715b24b377cb9b8"}, - {file = "multidict-6.0.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:eeb6dcc05e911516ae3d1f207d4b0520d07f54484c49dfc294d6e7d63b734171"}, - {file = "multidict-6.0.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d6d635d5209b82a3492508cf5b365f3446afb65ae7ebd755e70e18f287b0adf7"}, - {file = "multidict-6.0.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c048099e4c9e9d615545e2001d3d8a4380bd403e1a0578734e0d31703d1b0c0b"}, - {file = "multidict-6.0.4-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ea20853c6dbbb53ed34cb4d080382169b6f4554d394015f1bef35e881bf83547"}, - {file = "multidict-6.0.4-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:16d232d4e5396c2efbbf4f6d4df89bfa905eb0d4dc5b3549d872ab898451f569"}, - {file = "multidict-6.0.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:36c63aaa167f6c6b04ef2c85704e93af16c11d20de1d133e39de6a0e84582a93"}, - {file = "multidict-6.0.4-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:64bdf1086b6043bf519869678f5f2757f473dee970d7abf6da91ec00acb9cb98"}, - {file = "multidict-6.0.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:43644e38f42e3af682690876cff722d301ac585c5b9e1eacc013b7a3f7b696a0"}, - {file = "multidict-6.0.4-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:7582a1d1030e15422262de9f58711774e02fa80df0d1578995c76214f6954988"}, - {file = "multidict-6.0.4-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:ddff9c4e225a63a5afab9dd15590432c22e8057e1a9a13d28ed128ecf047bbdc"}, - {file = "multidict-6.0.4-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:ee2a1ece51b9b9e7752e742cfb661d2a29e7bcdba2d27e66e28a99f1890e4fa0"}, - {file = "multidict-6.0.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a2e4369eb3d47d2034032a26c7a80fcb21a2cb22e1173d761a162f11e562caa5"}, - {file = "multidict-6.0.4-cp310-cp310-win32.whl", hash = "sha256:574b7eae1ab267e5f8285f0fe881f17efe4b98c39a40858247720935b893bba8"}, - {file = "multidict-6.0.4-cp310-cp310-win_amd64.whl", hash = "sha256:4dcbb0906e38440fa3e325df2359ac6cb043df8e58c965bb45f4e406ecb162cc"}, - {file = "multidict-6.0.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0dfad7a5a1e39c53ed00d2dd0c2e36aed4650936dc18fd9a1826a5ae1cad6f03"}, - {file = "multidict-6.0.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:64da238a09d6039e3bd39bb3aee9c21a5e34f28bfa5aa22518581f910ff94af3"}, - {file = "multidict-6.0.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ff959bee35038c4624250473988b24f846cbeb2c6639de3602c073f10410ceba"}, - {file = "multidict-6.0.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:01a3a55bd90018c9c080fbb0b9f4891db37d148a0a18722b42f94694f8b6d4c9"}, - {file = "multidict-6.0.4-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c5cb09abb18c1ea940fb99360ea0396f34d46566f157122c92dfa069d3e0e982"}, - {file = "multidict-6.0.4-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:666daae833559deb2d609afa4490b85830ab0dfca811a98b70a205621a6109fe"}, - {file = "multidict-6.0.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:11bdf3f5e1518b24530b8241529d2050014c884cf18b6fc69c0c2b30ca248710"}, - {file = "multidict-6.0.4-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d18748f2d30f94f498e852c67d61261c643b349b9d2a581131725595c45ec6c"}, - {file = "multidict-6.0.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:458f37be2d9e4c95e2d8866a851663cbc76e865b78395090786f6cd9b3bbf4f4"}, - {file = "multidict-6.0.4-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:b1a2eeedcead3a41694130495593a559a668f382eee0727352b9a41e1c45759a"}, - {file = "multidict-6.0.4-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:7d6ae9d593ef8641544d6263c7fa6408cc90370c8cb2bbb65f8d43e5b0351d9c"}, - {file = "multidict-6.0.4-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:5979b5632c3e3534e42ca6ff856bb24b2e3071b37861c2c727ce220d80eee9ed"}, - {file = "multidict-6.0.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:dcfe792765fab89c365123c81046ad4103fcabbc4f56d1c1997e6715e8015461"}, - {file = "multidict-6.0.4-cp311-cp311-win32.whl", hash = "sha256:3601a3cece3819534b11d4efc1eb76047488fddd0c85a3948099d5da4d504636"}, - {file = "multidict-6.0.4-cp311-cp311-win_amd64.whl", hash = "sha256:81a4f0b34bd92df3da93315c6a59034df95866014ac08535fc819f043bfd51f0"}, - {file = "multidict-6.0.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:67040058f37a2a51ed8ea8f6b0e6ee5bd78ca67f169ce6122f3e2ec80dfe9b78"}, - {file = "multidict-6.0.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:853888594621e6604c978ce2a0444a1e6e70c8d253ab65ba11657659dcc9100f"}, - {file = "multidict-6.0.4-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:39ff62e7d0f26c248b15e364517a72932a611a9b75f35b45be078d81bdb86603"}, - {file = "multidict-6.0.4-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:af048912e045a2dc732847d33821a9d84ba553f5c5f028adbd364dd4765092ac"}, - {file = "multidict-6.0.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1e8b901e607795ec06c9e42530788c45ac21ef3aaa11dbd0c69de543bfb79a9"}, - {file = "multidict-6.0.4-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:62501642008a8b9871ddfccbf83e4222cf8ac0d5aeedf73da36153ef2ec222d2"}, - {file = "multidict-6.0.4-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:99b76c052e9f1bc0721f7541e5e8c05db3941eb9ebe7b8553c625ef88d6eefde"}, - {file = "multidict-6.0.4-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:509eac6cf09c794aa27bcacfd4d62c885cce62bef7b2c3e8b2e49d365b5003fe"}, - {file = "multidict-6.0.4-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:21a12c4eb6ddc9952c415f24eef97e3e55ba3af61f67c7bc388dcdec1404a067"}, - {file = "multidict-6.0.4-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:5cad9430ab3e2e4fa4a2ef4450f548768400a2ac635841bc2a56a2052cdbeb87"}, - {file = "multidict-6.0.4-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ab55edc2e84460694295f401215f4a58597f8f7c9466faec545093045476327d"}, - {file = "multidict-6.0.4-cp37-cp37m-win32.whl", hash = "sha256:5a4dcf02b908c3b8b17a45fb0f15b695bf117a67b76b7ad18b73cf8e92608775"}, - {file = "multidict-6.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:6ed5f161328b7df384d71b07317f4d8656434e34591f20552c7bcef27b0ab88e"}, - {file = "multidict-6.0.4-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5fc1b16f586f049820c5c5b17bb4ee7583092fa0d1c4e28b5239181ff9532e0c"}, - {file = "multidict-6.0.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1502e24330eb681bdaa3eb70d6358e818e8e8f908a22a1851dfd4e15bc2f8161"}, - {file = "multidict-6.0.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b692f419760c0e65d060959df05f2a531945af31fda0c8a3b3195d4efd06de11"}, - {file = "multidict-6.0.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45e1ecb0379bfaab5eef059f50115b54571acfbe422a14f668fc8c27ba410e7e"}, - {file = "multidict-6.0.4-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ddd3915998d93fbcd2566ddf9cf62cdb35c9e093075f862935573d265cf8f65d"}, - {file = "multidict-6.0.4-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:59d43b61c59d82f2effb39a93c48b845efe23a3852d201ed2d24ba830d0b4cf2"}, - {file = "multidict-6.0.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cc8e1d0c705233c5dd0c5e6460fbad7827d5d36f310a0fadfd45cc3029762258"}, - {file = "multidict-6.0.4-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d6aa0418fcc838522256761b3415822626f866758ee0bc6632c9486b179d0b52"}, - {file = "multidict-6.0.4-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:6748717bb10339c4760c1e63da040f5f29f5ed6e59d76daee30305894069a660"}, - {file = "multidict-6.0.4-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:4d1a3d7ef5e96b1c9e92f973e43aa5e5b96c659c9bc3124acbbd81b0b9c8a951"}, - {file = "multidict-6.0.4-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4372381634485bec7e46718edc71528024fcdc6f835baefe517b34a33c731d60"}, - {file = "multidict-6.0.4-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:fc35cb4676846ef752816d5be2193a1e8367b4c1397b74a565a9d0389c433a1d"}, - {file = "multidict-6.0.4-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:4b9d9e4e2b37daddb5c23ea33a3417901fa7c7b3dee2d855f63ee67a0b21e5b1"}, - {file = "multidict-6.0.4-cp38-cp38-win32.whl", hash = "sha256:e41b7e2b59679edfa309e8db64fdf22399eec4b0b24694e1b2104fb789207779"}, - {file = "multidict-6.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:d6c254ba6e45d8e72739281ebc46ea5eb5f101234f3ce171f0e9f5cc86991480"}, - {file = "multidict-6.0.4-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:16ab77bbeb596e14212e7bab8429f24c1579234a3a462105cda4a66904998664"}, - {file = "multidict-6.0.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:bc779e9e6f7fda81b3f9aa58e3a6091d49ad528b11ed19f6621408806204ad35"}, - {file = "multidict-6.0.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ceef517eca3e03c1cceb22030a3e39cb399ac86bff4e426d4fc6ae49052cc60"}, - {file = "multidict-6.0.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:281af09f488903fde97923c7744bb001a9b23b039a909460d0f14edc7bf59706"}, - {file = "multidict-6.0.4-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:52f2dffc8acaba9a2f27174c41c9e57f60b907bb9f096b36b1a1f3be71c6284d"}, - {file = "multidict-6.0.4-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b41156839806aecb3641f3208c0dafd3ac7775b9c4c422d82ee2a45c34ba81ca"}, - {file = "multidict-6.0.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d5e3fc56f88cc98ef8139255cf8cd63eb2c586531e43310ff859d6bb3a6b51f1"}, - {file = "multidict-6.0.4-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8316a77808c501004802f9beebde51c9f857054a0c871bd6da8280e718444449"}, - {file = "multidict-6.0.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:f70b98cd94886b49d91170ef23ec5c0e8ebb6f242d734ed7ed677b24d50c82cf"}, - {file = "multidict-6.0.4-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bf6774e60d67a9efe02b3616fee22441d86fab4c6d335f9d2051d19d90a40063"}, - {file = "multidict-6.0.4-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:e69924bfcdda39b722ef4d9aa762b2dd38e4632b3641b1d9a57ca9cd18f2f83a"}, - {file = "multidict-6.0.4-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:6b181d8c23da913d4ff585afd1155a0e1194c0b50c54fcfe286f70cdaf2b7176"}, - {file = "multidict-6.0.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:52509b5be062d9eafc8170e53026fbc54cf3b32759a23d07fd935fb04fc22d95"}, - {file = "multidict-6.0.4-cp39-cp39-win32.whl", hash = "sha256:27c523fbfbdfd19c6867af7346332b62b586eed663887392cff78d614f9ec313"}, - {file = "multidict-6.0.4-cp39-cp39-win_amd64.whl", hash = "sha256:33029f5734336aa0d4c0384525da0387ef89148dc7191aae00ca5fb23d7aafc2"}, - {file = "multidict-6.0.4.tar.gz", hash = "sha256:3666906492efb76453c0e7b97f2cf459b0682e7402c0489a95484965dbc1da49"}, -] - [[package]] name = "packaging" -version = "23.0" +version = "23.1" description = "Core utilities for Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "packaging-23.0-py3-none-any.whl", hash = "sha256:714ac14496c3e68c99c29b00845f7a2b85f3bb6f1078fd9f72fd20f0570002b2"}, - {file = "packaging-23.0.tar.gz", hash = "sha256:b6ad297f8907de0fa2fe1ccbd26fdaf387f5f47c7275fedf8cce89f99446cf97"}, + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, ] [[package]] name = "polywrap-client" -version = "0.1.0" +version = "0.1.0a29" description = "" category = "main" optional = false @@ -481,7 +346,6 @@ develop = true polywrap-core = {path = "../polywrap-core", develop = true} polywrap-manifest = {path = "../polywrap-manifest", develop = true} polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} -polywrap-uri-resolvers = {path = "../polywrap-uri-resolvers", develop = true} [package.source] type = "directory" @@ -489,7 +353,7 @@ url = "../packages/polywrap-client" [[package]] name = "polywrap-client-config-builder" -version = "0.1.0" +version = "0.1.0a29" description = "" category = "main" optional = false @@ -499,6 +363,7 @@ develop = true [package.dependencies] polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-uri-resolvers = {path = "../polywrap-uri-resolvers", develop = true} [package.source] type = "directory" @@ -506,7 +371,7 @@ url = "../packages/polywrap-client-config-builder" [[package]] name = "polywrap-core" -version = "0.1.0" +version = "0.1.0a29" description = "" category = "main" optional = false @@ -515,11 +380,8 @@ files = [] develop = true [package.dependencies] -gql = "3.4.0" -graphql-core = "^3.2.1" polywrap-manifest = {path = "../polywrap-manifest", develop = true} polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} -pydantic = "^1.10.2" [package.source] type = "directory" @@ -527,7 +389,7 @@ url = "../packages/polywrap-core" [[package]] name = "polywrap-manifest" -version = "0.1.0" +version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false @@ -545,7 +407,7 @@ url = "../packages/polywrap-manifest" [[package]] name = "polywrap-msgpack" -version = "0.1.0" +version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false @@ -562,7 +424,7 @@ url = "../packages/polywrap-msgpack" [[package]] name = "polywrap-plugin" -version = "0.1.0" +version = "0.1.0a29" description = "Plugin package" category = "main" optional = false @@ -571,9 +433,9 @@ files = [] develop = true [package.dependencies] -polywrap_core = {path = "../polywrap-core"} -polywrap_manifest = {path = "../polywrap-manifest"} -polywrap_msgpack = {path = "../polywrap-msgpack"} +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} [package.source] type = "directory" @@ -581,7 +443,7 @@ url = "../packages/polywrap-plugin" [[package]] name = "polywrap-uri-resolvers" -version = "0.1.0" +version = "0.1.0a29" description = "" category = "main" optional = false @@ -599,7 +461,7 @@ url = "../packages/polywrap-uri-resolvers" [[package]] name = "polywrap-wasm" -version = "0.1.0" +version = "0.1.0a29" description = "" category = "main" optional = false @@ -621,48 +483,48 @@ url = "../packages/polywrap-wasm" [[package]] name = "pydantic" -version = "1.10.7" +version = "1.10.9" description = "Data validation and settings management using python type hints" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "pydantic-1.10.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e79e999e539872e903767c417c897e729e015872040e56b96e67968c3b918b2d"}, - {file = "pydantic-1.10.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:01aea3a42c13f2602b7ecbbea484a98169fb568ebd9e247593ea05f01b884b2e"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:516f1ed9bc2406a0467dd777afc636c7091d71f214d5e413d64fef45174cfc7a"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae150a63564929c675d7f2303008d88426a0add46efd76c3fc797cd71cb1b46f"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ecbbc51391248116c0a055899e6c3e7ffbb11fb5e2a4cd6f2d0b93272118a209"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f4a2b50e2b03d5776e7f21af73e2070e1b5c0d0df255a827e7c632962f8315af"}, - {file = "pydantic-1.10.7-cp310-cp310-win_amd64.whl", hash = "sha256:a7cd2251439988b413cb0a985c4ed82b6c6aac382dbaff53ae03c4b23a70e80a"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:68792151e174a4aa9e9fc1b4e653e65a354a2fa0fed169f7b3d09902ad2cb6f1"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe2507b8ef209da71b6fb5f4e597b50c5a34b78d7e857c4f8f3115effaef5fe"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10a86d8c8db68086f1e30a530f7d5f83eb0685e632e411dbbcf2d5c0150e8dcd"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d75ae19d2a3dbb146b6f324031c24f8a3f52ff5d6a9f22f0683694b3afcb16fb"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:464855a7ff7f2cc2cf537ecc421291b9132aa9c79aef44e917ad711b4a93163b"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:193924c563fae6ddcb71d3f06fa153866423ac1b793a47936656e806b64e24ca"}, - {file = "pydantic-1.10.7-cp311-cp311-win_amd64.whl", hash = "sha256:b4a849d10f211389502059c33332e91327bc154acc1845f375a99eca3afa802d"}, - {file = "pydantic-1.10.7-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cc1dde4e50a5fc1336ee0581c1612215bc64ed6d28d2c7c6f25d2fe3e7c3e918"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0cfe895a504c060e5d36b287ee696e2fdad02d89e0d895f83037245218a87fe"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:670bb4683ad1e48b0ecb06f0cfe2178dcf74ff27921cdf1606e527d2617a81ee"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:950ce33857841f9a337ce07ddf46bc84e1c4946d2a3bba18f8280297157a3fd1"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:c15582f9055fbc1bfe50266a19771bbbef33dd28c45e78afbe1996fd70966c2a"}, - {file = "pydantic-1.10.7-cp37-cp37m-win_amd64.whl", hash = "sha256:82dffb306dd20bd5268fd6379bc4bfe75242a9c2b79fec58e1041fbbdb1f7914"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8c7f51861d73e8b9ddcb9916ae7ac39fb52761d9ea0df41128e81e2ba42886cd"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6434b49c0b03a51021ade5c4daa7d70c98f7a79e95b551201fff682fc1661245"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64d34ab766fa056df49013bb6e79921a0265204c071984e75a09cbceacbbdd5d"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:701daea9ffe9d26f97b52f1d157e0d4121644f0fcf80b443248434958fd03dc3"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf135c46099ff3f919d2150a948ce94b9ce545598ef2c6c7bf55dca98a304b52"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b0f85904f73161817b80781cc150f8b906d521fa11e3cdabae19a581c3606209"}, - {file = "pydantic-1.10.7-cp38-cp38-win_amd64.whl", hash = "sha256:9f6f0fd68d73257ad6685419478c5aece46432f4bdd8d32c7345f1986496171e"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c230c0d8a322276d6e7b88c3f7ce885f9ed16e0910354510e0bae84d54991143"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:976cae77ba6a49d80f461fd8bba183ff7ba79f44aa5cfa82f1346b5626542f8e"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d45fc99d64af9aaf7e308054a0067fdcd87ffe974f2442312372dfa66e1001d"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d2a5ebb48958754d386195fe9e9c5106f11275867051bf017a8059410e9abf1f"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:abfb7d4a7cd5cc4e1d1887c43503a7c5dd608eadf8bc615413fc498d3e4645cd"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:80b1fab4deb08a8292d15e43a6edccdffa5377a36a4597bb545b93e79c5ff0a5"}, - {file = "pydantic-1.10.7-cp39-cp39-win_amd64.whl", hash = "sha256:d71e69699498b020ea198468e2480a2f1e7433e32a3a99760058c6520e2bea7e"}, - {file = "pydantic-1.10.7-py3-none-any.whl", hash = "sha256:0cd181f1d0b1d00e2b705f1bf1ac7799a2d938cce3376b8007df62b29be3c2c6"}, - {file = "pydantic-1.10.7.tar.gz", hash = "sha256:cfc83c0678b6ba51b0532bea66860617c4cd4251ecf76e9846fa5a9f3454e97e"}, + {file = "pydantic-1.10.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e692dec4a40bfb40ca530e07805b1208c1de071a18d26af4a2a0d79015b352ca"}, + {file = "pydantic-1.10.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3c52eb595db83e189419bf337b59154bdcca642ee4b2a09e5d7797e41ace783f"}, + {file = "pydantic-1.10.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:939328fd539b8d0edf244327398a667b6b140afd3bf7e347cf9813c736211896"}, + {file = "pydantic-1.10.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b48d3d634bca23b172f47f2335c617d3fcb4b3ba18481c96b7943a4c634f5c8d"}, + {file = "pydantic-1.10.9-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:f0b7628fb8efe60fe66fd4adadd7ad2304014770cdc1f4934db41fe46cc8825f"}, + {file = "pydantic-1.10.9-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e1aa5c2410769ca28aa9a7841b80d9d9a1c5f223928ca8bec7e7c9a34d26b1d4"}, + {file = "pydantic-1.10.9-cp310-cp310-win_amd64.whl", hash = "sha256:eec39224b2b2e861259d6f3c8b6290d4e0fbdce147adb797484a42278a1a486f"}, + {file = "pydantic-1.10.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d111a21bbbfd85c17248130deac02bbd9b5e20b303338e0dbe0faa78330e37e0"}, + {file = "pydantic-1.10.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2e9aec8627a1a6823fc62fb96480abe3eb10168fd0d859ee3d3b395105ae19a7"}, + {file = "pydantic-1.10.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07293ab08e7b4d3c9d7de4949a0ea571f11e4557d19ea24dd3ae0c524c0c334d"}, + {file = "pydantic-1.10.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7ee829b86ce984261d99ff2fd6e88f2230068d96c2a582f29583ed602ef3fc2c"}, + {file = "pydantic-1.10.9-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:4b466a23009ff5cdd7076eb56aca537c745ca491293cc38e72bf1e0e00de5b91"}, + {file = "pydantic-1.10.9-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:7847ca62e581e6088d9000f3c497267868ca2fa89432714e21a4fb33a04d52e8"}, + {file = "pydantic-1.10.9-cp311-cp311-win_amd64.whl", hash = "sha256:7845b31959468bc5b78d7b95ec52fe5be32b55d0d09983a877cca6aedc51068f"}, + {file = "pydantic-1.10.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:517a681919bf880ce1dac7e5bc0c3af1e58ba118fd774da2ffcd93c5f96eaece"}, + {file = "pydantic-1.10.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:67195274fd27780f15c4c372f4ba9a5c02dad6d50647b917b6a92bf00b3d301a"}, + {file = "pydantic-1.10.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2196c06484da2b3fded1ab6dbe182bdabeb09f6318b7fdc412609ee2b564c49a"}, + {file = "pydantic-1.10.9-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:6257bb45ad78abacda13f15bde5886efd6bf549dd71085e64b8dcf9919c38b60"}, + {file = "pydantic-1.10.9-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3283b574b01e8dbc982080d8287c968489d25329a463b29a90d4157de4f2baaf"}, + {file = "pydantic-1.10.9-cp37-cp37m-win_amd64.whl", hash = "sha256:5f8bbaf4013b9a50e8100333cc4e3fa2f81214033e05ac5aa44fa24a98670a29"}, + {file = "pydantic-1.10.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b9cd67fb763248cbe38f0593cd8611bfe4b8ad82acb3bdf2b0898c23415a1f82"}, + {file = "pydantic-1.10.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:f50e1764ce9353be67267e7fd0da08349397c7db17a562ad036aa7c8f4adfdb6"}, + {file = "pydantic-1.10.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73ef93e5e1d3c8e83f1ff2e7fdd026d9e063c7e089394869a6e2985696693766"}, + {file = "pydantic-1.10.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:128d9453d92e6e81e881dd7e2484e08d8b164da5507f62d06ceecf84bf2e21d3"}, + {file = "pydantic-1.10.9-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ad428e92ab68798d9326bb3e5515bc927444a3d71a93b4a2ca02a8a5d795c572"}, + {file = "pydantic-1.10.9-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:fab81a92f42d6d525dd47ced310b0c3e10c416bbfae5d59523e63ea22f82b31e"}, + {file = "pydantic-1.10.9-cp38-cp38-win_amd64.whl", hash = "sha256:963671eda0b6ba6926d8fc759e3e10335e1dc1b71ff2a43ed2efd6996634dafb"}, + {file = "pydantic-1.10.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:970b1bdc6243ef663ba5c7e36ac9ab1f2bfecb8ad297c9824b542d41a750b298"}, + {file = "pydantic-1.10.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:7e1d5290044f620f80cf1c969c542a5468f3656de47b41aa78100c5baa2b8276"}, + {file = "pydantic-1.10.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:83fcff3c7df7adff880622a98022626f4f6dbce6639a88a15a3ce0f96466cb60"}, + {file = "pydantic-1.10.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0da48717dc9495d3a8f215e0d012599db6b8092db02acac5e0d58a65248ec5bc"}, + {file = "pydantic-1.10.9-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:0a2aabdc73c2a5960e87c3ffebca6ccde88665616d1fd6d3db3178ef427b267a"}, + {file = "pydantic-1.10.9-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:9863b9420d99dfa9c064042304868e8ba08e89081428a1c471858aa2af6f57c4"}, + {file = "pydantic-1.10.9-cp39-cp39-win_amd64.whl", hash = "sha256:e7c9900b43ac14110efa977be3da28931ffc74c27e96ee89fbcaaf0b0fe338e1"}, + {file = "pydantic-1.10.9-py3-none-any.whl", hash = "sha256:6cafde02f6699ce4ff643417d1a9223716ec25e228ddc3b436fe7e2d25a1f305"}, + {file = "pydantic-1.10.9.tar.gz", hash = "sha256:95c70da2cd3b6ddf3b9645ecaa8d98f3d80c606624b6d245558d202cd23ea3be"}, ] [package.dependencies] @@ -674,14 +536,14 @@ email = ["email-validator (>=1.0.3)"] [[package]] name = "pygments" -version = "2.14.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false -python-versions = ">=3.6" +python-versions = ">=3.7" files = [ - {file = "Pygments-2.14.0-py3-none-any.whl", hash = "sha256:fa7bd7bd2771287c0de303af8bfdfc731f51bd2c6a47ab69d117138893b82717"}, - {file = "Pygments-2.14.0.tar.gz", hash = "sha256:b3ed06a9e8ac9a9aae5a6f5dbe78a8a58655d17b43b93c078f094ddc476ae297"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -689,21 +551,21 @@ plugins = ["importlib-metadata"] [[package]] name = "requests" -version = "2.28.2" +version = "2.31.0" description = "Python HTTP for Humans." category = "dev" optional = false -python-versions = ">=3.7, <4" +python-versions = ">=3.7" files = [ - {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, - {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, ] [package.dependencies] certifi = ">=2017.4.17" charset-normalizer = ">=2,<4" idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<1.27" +urllib3 = ">=1.21.1,<3" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] @@ -723,21 +585,21 @@ files = [ [[package]] name = "sphinx" -version = "6.1.3" +version = "6.2.1" description = "Python documentation generator" category = "dev" optional = false python-versions = ">=3.8" files = [ - {file = "Sphinx-6.1.3.tar.gz", hash = "sha256:0dac3b698538ffef41716cf97ba26c1c7788dba73ce6f150c1ff5b4720786dd2"}, - {file = "sphinx-6.1.3-py3-none-any.whl", hash = "sha256:807d1cb3d6be87eb78a381c3e70ebd8d346b9a25f3753e9947e866b2786865fc"}, + {file = "Sphinx-6.2.1.tar.gz", hash = "sha256:6d56a34697bb749ffa0152feafc4b19836c755d90a7c59b72bc7dfd371b9cc6b"}, + {file = "sphinx-6.2.1-py3-none-any.whl", hash = "sha256:97787ff1fa3256a3eef9eda523a63dbf299f7b47e053cfcf684a1c2a8380c912"}, ] [package.dependencies] alabaster = ">=0.7,<0.8" babel = ">=2.9" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} -docutils = ">=0.18,<0.20" +docutils = ">=0.18.1,<0.20" imagesize = ">=1.3" Jinja2 = ">=3.0" packaging = ">=21.0" @@ -754,24 +616,24 @@ sphinxcontrib-serializinghtml = ">=1.1.5" [package.extras] docs = ["sphinxcontrib-websupport"] lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"] -test = ["cython", "html5lib", "pytest (>=4.6)"] +test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"] [[package]] name = "sphinx-rtd-theme" -version = "1.2.0" +version = "1.2.2" description = "Read the Docs theme for Sphinx" category = "dev" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" files = [ - {file = "sphinx_rtd_theme-1.2.0-py2.py3-none-any.whl", hash = "sha256:f823f7e71890abe0ac6aaa6013361ea2696fc8d3e1fa798f463e82bdb77eeff2"}, - {file = "sphinx_rtd_theme-1.2.0.tar.gz", hash = "sha256:a0d8bd1a2ed52e0b338cbe19c4b2eef3c5e7a048769753dac6a9f059c7b641b8"}, + {file = "sphinx_rtd_theme-1.2.2-py2.py3-none-any.whl", hash = "sha256:6a7e7d8af34eb8fc57d52a09c6b6b9c46ff44aea5951bc831eeb9245378f3689"}, + {file = "sphinx_rtd_theme-1.2.2.tar.gz", hash = "sha256:01c5c5a72e2d025bd23d1f06c59a4831b06e6ce6c01fdd5ebfe9986c0a880fc7"}, ] [package.dependencies] docutils = "<0.19" sphinx = ">=1.6,<7" -sphinxcontrib-jquery = {version = ">=2.0.0,<3.0.0 || >3.0.0", markers = "python_version > \"3\""} +sphinxcontrib-jquery = ">=4,<5" [package.extras] dev = ["bump2version", "sphinxcontrib-httpdomain", "transifex-client", "wheel"] @@ -888,14 +750,14 @@ test = ["pytest"] [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.3" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"}, + {file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"}, ] [[package]] @@ -923,20 +785,21 @@ files = [ [[package]] name = "urllib3" -version = "1.26.15" +version = "2.0.3" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.7" files = [ - {file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"}, - {file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"}, + {file = "urllib3-2.0.3-py3-none-any.whl", hash = "sha256:48e7fafa40319d358848e1bc6809b208340fafe2096f1725d05d67443d0483d1"}, + {file = "urllib3-2.0.3.tar.gz", hash = "sha256:bee28b5e56addb8226c96f7f13ac28cb4c301dd5ea8a6ca179c0b9835e032825"}, ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] -secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] [[package]] name = "wasmtime" @@ -957,94 +820,6 @@ files = [ [package.extras] testing = ["coverage", "flake8 (==4.0.1)", "pycparser", "pytest", "pytest-flake8", "pytest-mypy"] -[[package]] -name = "yarl" -version = "1.8.2" -description = "Yet another URL library" -category = "main" -optional = false -python-versions = ">=3.7" -files = [ - {file = "yarl-1.8.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:bb81f753c815f6b8e2ddd2eef3c855cf7da193b82396ac013c661aaa6cc6b0a5"}, - {file = "yarl-1.8.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:47d49ac96156f0928f002e2424299b2c91d9db73e08c4cd6742923a086f1c863"}, - {file = "yarl-1.8.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3fc056e35fa6fba63248d93ff6e672c096f95f7836938241ebc8260e062832fe"}, - {file = "yarl-1.8.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:58a3c13d1c3005dbbac5c9f0d3210b60220a65a999b1833aa46bd6677c69b08e"}, - {file = "yarl-1.8.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:10b08293cda921157f1e7c2790999d903b3fd28cd5c208cf8826b3b508026996"}, - {file = "yarl-1.8.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:de986979bbd87272fe557e0a8fcb66fd40ae2ddfe28a8b1ce4eae22681728fef"}, - {file = "yarl-1.8.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c4fcfa71e2c6a3cb568cf81aadc12768b9995323186a10827beccf5fa23d4f8"}, - {file = "yarl-1.8.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae4d7ff1049f36accde9e1ef7301912a751e5bae0a9d142459646114c70ecba6"}, - {file = "yarl-1.8.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bf071f797aec5b96abfc735ab97da9fd8f8768b43ce2abd85356a3127909d146"}, - {file = "yarl-1.8.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:74dece2bfc60f0f70907c34b857ee98f2c6dd0f75185db133770cd67300d505f"}, - {file = "yarl-1.8.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:df60a94d332158b444301c7f569659c926168e4d4aad2cfbf4bce0e8fb8be826"}, - {file = "yarl-1.8.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:63243b21c6e28ec2375f932a10ce7eda65139b5b854c0f6b82ed945ba526bff3"}, - {file = "yarl-1.8.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:cfa2bbca929aa742b5084fd4663dd4b87c191c844326fcb21c3afd2d11497f80"}, - {file = "yarl-1.8.2-cp310-cp310-win32.whl", hash = "sha256:b05df9ea7496df11b710081bd90ecc3a3db6adb4fee36f6a411e7bc91a18aa42"}, - {file = "yarl-1.8.2-cp310-cp310-win_amd64.whl", hash = "sha256:24ad1d10c9db1953291f56b5fe76203977f1ed05f82d09ec97acb623a7976574"}, - {file = "yarl-1.8.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2a1fca9588f360036242f379bfea2b8b44cae2721859b1c56d033adfd5893634"}, - {file = "yarl-1.8.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f37db05c6051eff17bc832914fe46869f8849de5b92dc4a3466cd63095d23dfd"}, - {file = "yarl-1.8.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:77e913b846a6b9c5f767b14dc1e759e5aff05502fe73079f6f4176359d832581"}, - {file = "yarl-1.8.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0978f29222e649c351b173da2b9b4665ad1feb8d1daa9d971eb90df08702668a"}, - {file = "yarl-1.8.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:388a45dc77198b2460eac0aca1efd6a7c09e976ee768b0d5109173e521a19daf"}, - {file = "yarl-1.8.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2305517e332a862ef75be8fad3606ea10108662bc6fe08509d5ca99503ac2aee"}, - {file = "yarl-1.8.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42430ff511571940d51e75cf42f1e4dbdded477e71c1b7a17f4da76c1da8ea76"}, - {file = "yarl-1.8.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3150078118f62371375e1e69b13b48288e44f6691c1069340081c3fd12c94d5b"}, - {file = "yarl-1.8.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c15163b6125db87c8f53c98baa5e785782078fbd2dbeaa04c6141935eb6dab7a"}, - {file = "yarl-1.8.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:4d04acba75c72e6eb90745447d69f84e6c9056390f7a9724605ca9c56b4afcc6"}, - {file = "yarl-1.8.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:e7fd20d6576c10306dea2d6a5765f46f0ac5d6f53436217913e952d19237efc4"}, - {file = "yarl-1.8.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:75c16b2a900b3536dfc7014905a128a2bea8fb01f9ee26d2d7d8db0a08e7cb2c"}, - {file = "yarl-1.8.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:6d88056a04860a98341a0cf53e950e3ac9f4e51d1b6f61a53b0609df342cc8b2"}, - {file = "yarl-1.8.2-cp311-cp311-win32.whl", hash = "sha256:fb742dcdd5eec9f26b61224c23baea46c9055cf16f62475e11b9b15dfd5c117b"}, - {file = "yarl-1.8.2-cp311-cp311-win_amd64.whl", hash = "sha256:8c46d3d89902c393a1d1e243ac847e0442d0196bbd81aecc94fcebbc2fd5857c"}, - {file = "yarl-1.8.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:ceff9722e0df2e0a9e8a79c610842004fa54e5b309fe6d218e47cd52f791d7ef"}, - {file = "yarl-1.8.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f6b4aca43b602ba0f1459de647af954769919c4714706be36af670a5f44c9c1"}, - {file = "yarl-1.8.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1684a9bd9077e922300ecd48003ddae7a7474e0412bea38d4631443a91d61077"}, - {file = "yarl-1.8.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ebb78745273e51b9832ef90c0898501006670d6e059f2cdb0e999494eb1450c2"}, - {file = "yarl-1.8.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3adeef150d528ded2a8e734ebf9ae2e658f4c49bf413f5f157a470e17a4a2e89"}, - {file = "yarl-1.8.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:57a7c87927a468e5a1dc60c17caf9597161d66457a34273ab1760219953f7f4c"}, - {file = "yarl-1.8.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:efff27bd8cbe1f9bd127e7894942ccc20c857aa8b5a0327874f30201e5ce83d0"}, - {file = "yarl-1.8.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:a783cd344113cb88c5ff7ca32f1f16532a6f2142185147822187913eb989f739"}, - {file = "yarl-1.8.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:705227dccbe96ab02c7cb2c43e1228e2826e7ead880bb19ec94ef279e9555b5b"}, - {file = "yarl-1.8.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:34c09b43bd538bf6c4b891ecce94b6fa4f1f10663a8d4ca589a079a5018f6ed7"}, - {file = "yarl-1.8.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:a48f4f7fea9a51098b02209d90297ac324241bf37ff6be6d2b0149ab2bd51b37"}, - {file = "yarl-1.8.2-cp37-cp37m-win32.whl", hash = "sha256:0414fd91ce0b763d4eadb4456795b307a71524dbacd015c657bb2a39db2eab89"}, - {file = "yarl-1.8.2-cp37-cp37m-win_amd64.whl", hash = "sha256:d881d152ae0007809c2c02e22aa534e702f12071e6b285e90945aa3c376463c5"}, - {file = "yarl-1.8.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5df5e3d04101c1e5c3b1d69710b0574171cc02fddc4b23d1b2813e75f35a30b1"}, - {file = "yarl-1.8.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:7a66c506ec67eb3159eea5096acd05f5e788ceec7b96087d30c7d2865a243918"}, - {file = "yarl-1.8.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2b4fa2606adf392051d990c3b3877d768771adc3faf2e117b9de7eb977741229"}, - {file = "yarl-1.8.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e21fb44e1eff06dd6ef971d4bdc611807d6bd3691223d9c01a18cec3677939e"}, - {file = "yarl-1.8.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:93202666046d9edadfe9f2e7bf5e0782ea0d497b6d63da322e541665d65a044e"}, - {file = "yarl-1.8.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:fc77086ce244453e074e445104f0ecb27530d6fd3a46698e33f6c38951d5a0f1"}, - {file = "yarl-1.8.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64dd68a92cab699a233641f5929a40f02a4ede8c009068ca8aa1fe87b8c20ae3"}, - {file = "yarl-1.8.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1b372aad2b5f81db66ee7ec085cbad72c4da660d994e8e590c997e9b01e44901"}, - {file = "yarl-1.8.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:e6f3515aafe0209dd17fb9bdd3b4e892963370b3de781f53e1746a521fb39fc0"}, - {file = "yarl-1.8.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:dfef7350ee369197106805e193d420b75467b6cceac646ea5ed3049fcc950a05"}, - {file = "yarl-1.8.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:728be34f70a190566d20aa13dc1f01dc44b6aa74580e10a3fb159691bc76909d"}, - {file = "yarl-1.8.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:ff205b58dc2929191f68162633d5e10e8044398d7a45265f90a0f1d51f85f72c"}, - {file = "yarl-1.8.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:baf211dcad448a87a0d9047dc8282d7de59473ade7d7fdf22150b1d23859f946"}, - {file = "yarl-1.8.2-cp38-cp38-win32.whl", hash = "sha256:272b4f1599f1b621bf2aabe4e5b54f39a933971f4e7c9aa311d6d7dc06965165"}, - {file = "yarl-1.8.2-cp38-cp38-win_amd64.whl", hash = "sha256:326dd1d3caf910cd26a26ccbfb84c03b608ba32499b5d6eeb09252c920bcbe4f"}, - {file = "yarl-1.8.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:f8ca8ad414c85bbc50f49c0a106f951613dfa5f948ab69c10ce9b128d368baf8"}, - {file = "yarl-1.8.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:418857f837347e8aaef682679f41e36c24250097f9e2f315d39bae3a99a34cbf"}, - {file = "yarl-1.8.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ae0eec05ab49e91a78700761777f284c2df119376e391db42c38ab46fd662b77"}, - {file = "yarl-1.8.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:009a028127e0a1755c38b03244c0bea9d5565630db9c4cf9572496e947137a87"}, - {file = "yarl-1.8.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3edac5d74bb3209c418805bda77f973117836e1de7c000e9755e572c1f7850d0"}, - {file = "yarl-1.8.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:da65c3f263729e47351261351b8679c6429151ef9649bba08ef2528ff2c423b2"}, - {file = "yarl-1.8.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ef8fb25e52663a1c85d608f6dd72e19bd390e2ecaf29c17fb08f730226e3a08"}, - {file = "yarl-1.8.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bcd7bb1e5c45274af9a1dd7494d3c52b2be5e6bd8d7e49c612705fd45420b12d"}, - {file = "yarl-1.8.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:44ceac0450e648de86da8e42674f9b7077d763ea80c8ceb9d1c3e41f0f0a9951"}, - {file = "yarl-1.8.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:97209cc91189b48e7cfe777237c04af8e7cc51eb369004e061809bcdf4e55220"}, - {file = "yarl-1.8.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:48dd18adcf98ea9cd721a25313aef49d70d413a999d7d89df44f469edfb38a06"}, - {file = "yarl-1.8.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:e59399dda559688461762800d7fb34d9e8a6a7444fd76ec33220a926c8be1516"}, - {file = "yarl-1.8.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d617c241c8c3ad5c4e78a08429fa49e4b04bedfc507b34b4d8dceb83b4af3588"}, - {file = "yarl-1.8.2-cp39-cp39-win32.whl", hash = "sha256:cb6d48d80a41f68de41212f3dfd1a9d9898d7841c8f7ce6696cf2fd9cb57ef83"}, - {file = "yarl-1.8.2-cp39-cp39-win_amd64.whl", hash = "sha256:6604711362f2dbf7160df21c416f81fac0de6dbcf0b5445a2ef25478ecc4c778"}, - {file = "yarl-1.8.2.tar.gz", hash = "sha256:49d43402c6e3013ad0978602bf6bf5328535c48d192304b91b97a3c6790b1562"}, -] - -[package.dependencies] -idna = ">=2.0" -multidict = ">=4.0" - [metadata] lock-version = "2.0" python-versions = "^3.10" diff --git a/docs/pyproject.toml b/docs/pyproject.toml index a768f043..da55d67d 100644 --- a/docs/pyproject.toml +++ b/docs/pyproject.toml @@ -7,7 +7,6 @@ name = "docs" version = "0.1.0" description = "" authors = ["Niraj "] -readme = "README.md" [tool.poetry.dependencies] python = "^3.10" @@ -22,5 +21,4 @@ polywrap-client-config-builder = { path = "../packages/polywrap-client-config-bu [tool.poetry.group.dev.dependencies] sphinx = "^6.1.3" -sphinx-rtd-theme = "^1.2.0" - +sphinx-rtd-theme = "^1.2.0" \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 807e75a0..e8923b1f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,7 +7,7 @@ Welcome to polywrap-client's documentation! =========================================== .. toctree:: - :maxdepth: 2 + :maxdepth: 1 :caption: Contents: polywrap-msgpack/modules.rst @@ -20,7 +20,6 @@ Welcome to polywrap-client's documentation! polywrap-client-config-builder/modules.rst - Indices and tables ================== diff --git a/docs/source/polywrap-core/polywrap_core.types.invoke_args.rst b/docs/source/polywrap-core/polywrap_core.types.invoke_args.rst deleted file mode 100644 index 60dd0555..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.invoke_args.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.invoke\_args module -======================================== - -.. automodule:: polywrap_core.types.invoke_args - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.invoke_options.rst b/docs/source/polywrap-core/polywrap_core.types.invoke_options.rst new file mode 100644 index 00000000..0b1f0cc6 --- /dev/null +++ b/docs/source/polywrap-core/polywrap_core.types.invoke_options.rst @@ -0,0 +1,7 @@ +polywrap\_core.types.invoke\_options module +=========================================== + +.. automodule:: polywrap_core.types.invoke_options + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.options.file_options.rst b/docs/source/polywrap-core/polywrap_core.types.options.file_options.rst deleted file mode 100644 index 129a7ba2..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.options.file_options.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.options.file\_options module -================================================= - -.. automodule:: polywrap_core.types.options.file_options - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.options.invoke_options.rst b/docs/source/polywrap-core/polywrap_core.types.options.invoke_options.rst deleted file mode 100644 index b625e1c6..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.options.invoke_options.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.options.invoke\_options module -=================================================== - -.. automodule:: polywrap_core.types.options.invoke_options - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.options.manifest_options.rst b/docs/source/polywrap-core/polywrap_core.types.options.manifest_options.rst deleted file mode 100644 index 5919f120..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.options.manifest_options.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.options.manifest\_options module -===================================================== - -.. automodule:: polywrap_core.types.options.manifest_options - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.options.rst b/docs/source/polywrap-core/polywrap_core.types.options.rst deleted file mode 100644 index b23ed796..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.options.rst +++ /dev/null @@ -1,21 +0,0 @@ -polywrap\_core.types.options package -==================================== - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - polywrap_core.types.options.file_options - polywrap_core.types.options.invoke_options - polywrap_core.types.options.manifest_options - polywrap_core.types.options.uri_resolver_options - -Module contents ---------------- - -.. automodule:: polywrap_core.types.options - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.options.uri_resolver_options.rst b/docs/source/polywrap-core/polywrap_core.types.options.uri_resolver_options.rst deleted file mode 100644 index 3ee58897..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.options.uri_resolver_options.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.options.uri\_resolver\_options module -========================================================== - -.. automodule:: polywrap_core.types.options.uri_resolver_options - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.types.rst b/docs/source/polywrap-core/polywrap_core.types.rst index ceaf51db..b17083c9 100644 --- a/docs/source/polywrap-core/polywrap_core.types.rst +++ b/docs/source/polywrap-core/polywrap_core.types.rst @@ -1,14 +1,6 @@ polywrap\_core.types package ============================ -Subpackages ------------ - -.. toctree:: - :maxdepth: 4 - - polywrap_core.types.options - Submodules ---------- @@ -17,15 +9,13 @@ Submodules polywrap_core.types.client polywrap_core.types.config - polywrap_core.types.env polywrap_core.types.errors polywrap_core.types.file_reader polywrap_core.types.invocable - polywrap_core.types.invoke_args + polywrap_core.types.invoke_options polywrap_core.types.invoker polywrap_core.types.invoker_client polywrap_core.types.uri - polywrap_core.types.uri_like polywrap_core.types.uri_package polywrap_core.types.uri_package_wrapper polywrap_core.types.uri_resolution_context diff --git a/docs/source/polywrap-core/polywrap_core.types.uri_like.rst b/docs/source/polywrap-core/polywrap_core.types.uri_like.rst deleted file mode 100644 index bef58a58..00000000 --- a/docs/source/polywrap-core/polywrap_core.types.uri_like.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.types.uri\_like module -===================================== - -.. automodule:: polywrap_core.types.uri_like - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.build_clean_uri_history.rst b/docs/source/polywrap-core/polywrap_core.utils.build_clean_uri_history.rst new file mode 100644 index 00000000..c37becef --- /dev/null +++ b/docs/source/polywrap-core/polywrap_core.utils.build_clean_uri_history.rst @@ -0,0 +1,7 @@ +polywrap\_core.utils.build\_clean\_uri\_history module +====================================================== + +.. automodule:: polywrap_core.utils.build_clean_uri_history + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.get_env_from_resolution_path.rst b/docs/source/polywrap-core/polywrap_core.utils.get_env_from_resolution_path.rst new file mode 100644 index 00000000..7ef6d385 --- /dev/null +++ b/docs/source/polywrap-core/polywrap_core.utils.get_env_from_resolution_path.rst @@ -0,0 +1,7 @@ +polywrap\_core.utils.get\_env\_from\_resolution\_path module +============================================================ + +.. automodule:: polywrap_core.utils.get_env_from_resolution_path + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.get_implementations.rst b/docs/source/polywrap-core/polywrap_core.utils.get_implementations.rst new file mode 100644 index 00000000..debcead7 --- /dev/null +++ b/docs/source/polywrap-core/polywrap_core.utils.get_implementations.rst @@ -0,0 +1,7 @@ +polywrap\_core.utils.get\_implementations module +================================================ + +.. automodule:: polywrap_core.utils.get_implementations + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.instance_of.rst b/docs/source/polywrap-core/polywrap_core.utils.instance_of.rst deleted file mode 100644 index e742eb66..00000000 --- a/docs/source/polywrap-core/polywrap_core.utils.instance_of.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.utils.instance\_of module -======================================== - -.. automodule:: polywrap_core.utils.instance_of - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.maybe_async.rst b/docs/source/polywrap-core/polywrap_core.utils.maybe_async.rst deleted file mode 100644 index b0bb88c0..00000000 --- a/docs/source/polywrap-core/polywrap_core.utils.maybe_async.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_core.utils.maybe\_async module -======================================== - -.. automodule:: polywrap_core.utils.maybe_async - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-core/polywrap_core.utils.rst b/docs/source/polywrap-core/polywrap_core.utils.rst index 32d08123..803ce5ec 100644 --- a/docs/source/polywrap-core/polywrap_core.utils.rst +++ b/docs/source/polywrap-core/polywrap_core.utils.rst @@ -7,8 +7,9 @@ Submodules .. toctree:: :maxdepth: 4 - polywrap_core.utils.instance_of - polywrap_core.utils.maybe_async + polywrap_core.utils.build_clean_uri_history + polywrap_core.utils.get_env_from_resolution_path + polywrap_core.utils.get_implementations Module contents --------------- diff --git a/docs/source/polywrap-manifest/polywrap_manifest.errors.rst b/docs/source/polywrap-manifest/polywrap_manifest.errors.rst new file mode 100644 index 00000000..6e4530c3 --- /dev/null +++ b/docs/source/polywrap-manifest/polywrap_manifest.errors.rst @@ -0,0 +1,7 @@ +polywrap\_manifest.errors module +================================ + +.. automodule:: polywrap_manifest.errors + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-manifest/polywrap_manifest.rst b/docs/source/polywrap-manifest/polywrap_manifest.rst index 3e16dae8..0e754aa4 100644 --- a/docs/source/polywrap-manifest/polywrap_manifest.rst +++ b/docs/source/polywrap-manifest/polywrap_manifest.rst @@ -8,6 +8,7 @@ Submodules :maxdepth: 4 polywrap_manifest.deserialize + polywrap_manifest.errors polywrap_manifest.manifest polywrap_manifest.wrap_0_1 diff --git a/docs/source/polywrap-core/polywrap_core.types.env.rst b/docs/source/polywrap-msgpack/polywrap_msgpack.errors.rst similarity index 54% rename from docs/source/polywrap-core/polywrap_core.types.env.rst rename to docs/source/polywrap-msgpack/polywrap_msgpack.errors.rst index 0b30f8c2..e96e074b 100644 --- a/docs/source/polywrap-core/polywrap_core.types.env.rst +++ b/docs/source/polywrap-msgpack/polywrap_msgpack.errors.rst @@ -1,7 +1,7 @@ -polywrap\_core.types.env module +polywrap\_msgpack.errors module =============================== -.. automodule:: polywrap_core.types.env +.. automodule:: polywrap_msgpack.errors :members: :undoc-members: :show-inheritance: diff --git a/docs/source/polywrap-msgpack/polywrap_msgpack.rst b/docs/source/polywrap-msgpack/polywrap_msgpack.rst index 7e00f143..56cce48c 100644 --- a/docs/source/polywrap-msgpack/polywrap_msgpack.rst +++ b/docs/source/polywrap-msgpack/polywrap_msgpack.rst @@ -17,6 +17,7 @@ Submodules polywrap_msgpack.decoder polywrap_msgpack.encoder + polywrap_msgpack.errors polywrap_msgpack.sanitize Module contents diff --git a/docs/source/polywrap-plugin/polywrap_plugin.resolution_context_override_client.rst b/docs/source/polywrap-plugin/polywrap_plugin.resolution_context_override_client.rst new file mode 100644 index 00000000..a3d865bc --- /dev/null +++ b/docs/source/polywrap-plugin/polywrap_plugin.resolution_context_override_client.rst @@ -0,0 +1,7 @@ +polywrap\_plugin.resolution\_context\_override\_client module +============================================================= + +.. automodule:: polywrap_plugin.resolution_context_override_client + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-plugin/polywrap_plugin.rst b/docs/source/polywrap-plugin/polywrap_plugin.rst index 211a3be5..2b94eb4c 100644 --- a/docs/source/polywrap-plugin/polywrap_plugin.rst +++ b/docs/source/polywrap-plugin/polywrap_plugin.rst @@ -9,6 +9,7 @@ Submodules polywrap_plugin.module polywrap_plugin.package + polywrap_plugin.resolution_context_override_client polywrap_plugin.wrapper Module contents diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.rst index ae02c87c..fe3e9fa9 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.rst @@ -8,6 +8,7 @@ Submodules :maxdepth: 4 polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator + polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator_base Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator_base.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator_base.rst new file mode 100644 index 00000000..c960ea16 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator_base.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.resolvers.aggregator.uri\_resolver\_aggregator\_base module +==================================================================================== + +.. automodule:: polywrap_uri_resolvers.resolvers.aggregator.uri_resolver_aggregator_base + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.cache_resolver.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.cache_resolver.rst deleted file mode 100644 index a094efff..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.cache_resolver.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.resolvers.cache.cache\_resolver module -=============================================================== - -.. automodule:: polywrap_uri_resolvers.resolvers.cache.cache_resolver - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.resolution_result_cache_resolver.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.resolution_result_cache_resolver.rst new file mode 100644 index 00000000..741007da --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.resolution_result_cache_resolver.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.resolvers.cache.resolution\_result\_cache\_resolver module +=================================================================================== + +.. automodule:: polywrap_uri_resolvers.resolvers.cache.resolution_result_cache_resolver + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.rst index fd8a3c05..ddabb0e6 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.rst @@ -7,8 +7,7 @@ Submodules .. toctree:: :maxdepth: 4 - polywrap_uri_resolvers.resolvers.cache.cache_resolver - polywrap_uri_resolvers.resolvers.cache.request_synchronizer_resolver + polywrap_uri_resolvers.resolvers.cache.resolution_result_cache_resolver Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.request_synchronizer_resolver.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.package_to_wrapper_resolver.rst similarity index 50% rename from docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.request_synchronizer_resolver.rst rename to docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.package_to_wrapper_resolver.rst index 9aa31026..87287791 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.cache.request_synchronizer_resolver.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.package_to_wrapper_resolver.rst @@ -1,7 +1,7 @@ -polywrap\_uri\_resolvers.resolvers.cache.request\_synchronizer\_resolver module +polywrap\_uri\_resolvers.resolvers.legacy.package\_to\_wrapper\_resolver module =============================================================================== -.. automodule:: polywrap_uri_resolvers.resolvers.cache.request_synchronizer_resolver +.. automodule:: polywrap_uri_resolvers.resolvers.legacy.package_to_wrapper_resolver :members: :undoc-members: :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.rst index 6783e920..6635f853 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.rst @@ -1,6 +1,14 @@ polywrap\_uri\_resolvers.resolvers.legacy package ================================================= +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + polywrap_uri_resolvers.resolvers.legacy.wrapper_cache + Submodules ---------- @@ -9,7 +17,9 @@ Submodules polywrap_uri_resolvers.resolvers.legacy.base_resolver polywrap_uri_resolvers.resolvers.legacy.fs_resolver + polywrap_uri_resolvers.resolvers.legacy.package_to_wrapper_resolver polywrap_uri_resolvers.resolvers.legacy.redirect_resolver + polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.in_memory_wrapper_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.in_memory_wrapper_cache.rst new file mode 100644 index 00000000..00418271 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.in_memory_wrapper_cache.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.resolvers.legacy.wrapper\_cache.in\_memory\_wrapper\_cache module +========================================================================================== + +.. automodule:: polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.in_memory_wrapper_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.rst new file mode 100644 index 00000000..f2483595 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.rst @@ -0,0 +1,19 @@ +polywrap\_uri\_resolvers.resolvers.legacy.wrapper\_cache package +================================================================ + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.in_memory_wrapper_cache + polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.wrapper_cache + +Module contents +--------------- + +.. automodule:: polywrap_uri_resolvers.resolvers.legacy.wrapper_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.wrapper_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.wrapper_cache.rst new file mode 100644 index 00000000..50295264 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.wrapper_cache.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.resolvers.legacy.wrapper\_cache.wrapper\_cache module +============================================================================== + +.. automodule:: polywrap_uri_resolvers.resolvers.legacy.wrapper_cache.wrapper_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver.rst new file mode 100644 index 00000000..3b8f9000 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.resolvers.legacy.wrapper\_cache\_resolver module +========================================================================= + +.. automodule:: polywrap_uri_resolvers.resolvers.legacy.wrapper_cache_resolver + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.package_to_wrapper_resolver.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.package_to_wrapper_resolver.rst deleted file mode 100644 index 26c46951..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.package_to_wrapper_resolver.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.resolvers.package.package\_to\_wrapper\_resolver module -================================================================================ - -.. automodule:: polywrap_uri_resolvers.resolvers.package.package_to_wrapper_resolver - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.rst index 028fbabd..0355c124 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.resolvers.package.rst @@ -8,7 +8,6 @@ Submodules :maxdepth: 4 polywrap_uri_resolvers.resolvers.package.package_resolver - polywrap_uri_resolvers.resolvers.package.package_to_wrapper_resolver Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.rst index 325c2026..0681ef4c 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.rst @@ -9,7 +9,6 @@ Subpackages polywrap_uri_resolvers.resolvers polywrap_uri_resolvers.types - polywrap_uri_resolvers.utils Submodules ---------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.in_memory_wrapper_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.in_memory_wrapper_cache.rst deleted file mode 100644 index 68ce2d79..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.in_memory_wrapper_cache.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.cache.in\_memory\_wrapper\_cache module -====================================================================== - -.. automodule:: polywrap_uri_resolvers.types.cache.in_memory_wrapper_cache - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.in_memory_resolution_result_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.in_memory_resolution_result_cache.rst new file mode 100644 index 00000000..62251c5d --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.in_memory_resolution_result_cache.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.types.cache.resolution\_result\_cache.in\_memory\_resolution\_result\_cache module +=========================================================================================================== + +.. automodule:: polywrap_uri_resolvers.types.cache.resolution_result_cache.in_memory_resolution_result_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.resolution_result_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.resolution_result_cache.rst new file mode 100644 index 00000000..fbe1f990 --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.resolution_result_cache.rst @@ -0,0 +1,7 @@ +polywrap\_uri\_resolvers.types.cache.resolution\_result\_cache.resolution\_result\_cache module +=============================================================================================== + +.. automodule:: polywrap_uri_resolvers.types.cache.resolution_result_cache.resolution_result_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.rst new file mode 100644 index 00000000..5fc52a7c --- /dev/null +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.resolution_result_cache.rst @@ -0,0 +1,19 @@ +polywrap\_uri\_resolvers.types.cache.resolution\_result\_cache package +====================================================================== + +Submodules +---------- + +.. toctree:: + :maxdepth: 4 + + polywrap_uri_resolvers.types.cache.resolution_result_cache.in_memory_resolution_result_cache + polywrap_uri_resolvers.types.cache.resolution_result_cache.resolution_result_cache + +Module contents +--------------- + +.. automodule:: polywrap_uri_resolvers.types.cache.resolution_result_cache + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.rst index ebc84ccd..10d242c6 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.rst @@ -1,14 +1,13 @@ polywrap\_uri\_resolvers.types.cache package ============================================ -Submodules ----------- +Subpackages +----------- .. toctree:: :maxdepth: 4 - polywrap_uri_resolvers.types.cache.in_memory_wrapper_cache - polywrap_uri_resolvers.types.cache.wrapper_cache + polywrap_uri_resolvers.types.cache.resolution_result_cache Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.wrapper_cache.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.wrapper_cache.rst deleted file mode 100644 index 552de53a..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.cache.wrapper_cache.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.cache.wrapper\_cache module -========================================================== - -.. automodule:: polywrap_uri_resolvers.types.cache.wrapper_cache - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.rst index 5d186106..35b270a8 100644 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.rst +++ b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.rst @@ -8,7 +8,6 @@ Subpackages :maxdepth: 4 polywrap_uri_resolvers.types.cache - polywrap_uri_resolvers.types.uri_resolution_context Submodules ---------- @@ -17,8 +16,6 @@ Submodules :maxdepth: 4 polywrap_uri_resolvers.types.static_resolver_like - polywrap_uri_resolvers.types.uri_redirect - polywrap_uri_resolvers.types.uri_resolver_like Module contents --------------- diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_redirect.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_redirect.rst deleted file mode 100644 index ad6f2d20..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_redirect.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.uri\_redirect module -=================================================== - -.. automodule:: polywrap_uri_resolvers.types.uri_redirect - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.rst deleted file mode 100644 index 413cf7e9..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.rst +++ /dev/null @@ -1,19 +0,0 @@ -polywrap\_uri\_resolvers.types.uri\_resolution\_context package -=============================================================== - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_context - polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_step - -Module contents ---------------- - -.. automodule:: polywrap_uri_resolvers.types.uri_resolution_context - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_context.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_context.rst deleted file mode 100644 index 6b5887ce..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_context.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.uri\_resolution\_context.uri\_resolution\_context module -======================================================================================= - -.. automodule:: polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_context - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_step.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_step.rst deleted file mode 100644 index b6c68a07..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_step.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.uri\_resolution\_context.uri\_resolution\_step module -==================================================================================== - -.. automodule:: polywrap_uri_resolvers.types.uri_resolution_context.uri_resolution_step - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolver_like.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolver_like.rst deleted file mode 100644 index e5c0fcf0..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.types.uri_resolver_like.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.types.uri\_resolver\_like module -========================================================= - -.. automodule:: polywrap_uri_resolvers.types.uri_resolver_like - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.build_clean_uri_history.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.build_clean_uri_history.rst deleted file mode 100644 index 0d210b38..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.build_clean_uri_history.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.utils.build\_clean\_uri\_history module -================================================================ - -.. automodule:: polywrap_uri_resolvers.utils.build_clean_uri_history - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_env_from_uri_history.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_env_from_uri_history.rst deleted file mode 100644 index 276e1cba..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_env_from_uri_history.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.utils.get\_env\_from\_uri\_history module -================================================================== - -.. automodule:: polywrap_uri_resolvers.utils.get_env_from_uri_history - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_uri_resolution_path.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_uri_resolution_path.rst deleted file mode 100644 index 1e90a114..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.get_uri_resolution_path.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_uri\_resolvers.utils.get\_uri\_resolution\_path module -================================================================ - -.. automodule:: polywrap_uri_resolvers.utils.get_uri_resolution_path - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.rst b/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.rst deleted file mode 100644 index bedd0f05..00000000 --- a/docs/source/polywrap-uri-resolvers/polywrap_uri_resolvers.utils.rst +++ /dev/null @@ -1,20 +0,0 @@ -polywrap\_uri\_resolvers.utils package -====================================== - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - polywrap_uri_resolvers.utils.build_clean_uri_history - polywrap_uri_resolvers.utils.get_env_from_uri_history - polywrap_uri_resolvers.utils.get_uri_resolution_path - -Module contents ---------------- - -.. automodule:: polywrap_uri_resolvers.utils - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-wasm/polywrap_wasm.imports.rst b/docs/source/polywrap-wasm/polywrap_wasm.imports.rst index 5e814e8d..535cc5f0 100644 --- a/docs/source/polywrap-wasm/polywrap_wasm.imports.rst +++ b/docs/source/polywrap-wasm/polywrap_wasm.imports.rst @@ -8,7 +8,6 @@ Subpackages :maxdepth: 4 polywrap_wasm.imports.types - polywrap_wasm.imports.utils Submodules ---------- diff --git a/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.rst b/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.rst deleted file mode 100644 index 7a040966..00000000 --- a/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.rst +++ /dev/null @@ -1,18 +0,0 @@ -polywrap\_wasm.imports.utils package -==================================== - -Submodules ----------- - -.. toctree:: - :maxdepth: 4 - - polywrap_wasm.imports.utils.unsync_invoke - -Module contents ---------------- - -.. automodule:: polywrap_wasm.imports.utils - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.unsync_invoke.rst b/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.unsync_invoke.rst deleted file mode 100644 index 34db2358..00000000 --- a/docs/source/polywrap-wasm/polywrap_wasm.imports.utils.unsync_invoke.rst +++ /dev/null @@ -1,7 +0,0 @@ -polywrap\_wasm.imports.utils.unsync\_invoke module -================================================== - -.. automodule:: polywrap_wasm.imports.utils.unsync_invoke - :members: - :undoc-members: - :show-inheritance: diff --git a/docs/source/polywrap-wasm/polywrap_wasm.types.invoke_result.rst b/docs/source/polywrap-wasm/polywrap_wasm.types.invoke_result.rst new file mode 100644 index 00000000..07b07c8b --- /dev/null +++ b/docs/source/polywrap-wasm/polywrap_wasm.types.invoke_result.rst @@ -0,0 +1,7 @@ +polywrap\_wasm.types.invoke\_result module +========================================== + +.. automodule:: polywrap_wasm.types.invoke_result + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/polywrap-wasm/polywrap_wasm.types.rst b/docs/source/polywrap-wasm/polywrap_wasm.types.rst index 0e2faa7a..842a37de 100644 --- a/docs/source/polywrap-wasm/polywrap_wasm.types.rst +++ b/docs/source/polywrap-wasm/polywrap_wasm.types.rst @@ -7,7 +7,9 @@ Submodules .. toctree:: :maxdepth: 4 + polywrap_wasm.types.invoke_result polywrap_wasm.types.state + polywrap_wasm.types.wasm_invoke_options Module contents --------------- diff --git a/docs/source/polywrap-wasm/polywrap_wasm.types.wasm_invoke_options.rst b/docs/source/polywrap-wasm/polywrap_wasm.types.wasm_invoke_options.rst new file mode 100644 index 00000000..d7504249 --- /dev/null +++ b/docs/source/polywrap-wasm/polywrap_wasm.types.wasm_invoke_options.rst @@ -0,0 +1,7 @@ +polywrap\_wasm.types.wasm\_invoke\_options module +================================================= + +.. automodule:: polywrap_wasm.types.wasm_invoke_options + :members: + :undoc-members: + :show-inheritance: diff --git a/packages/polywrap-client-config-builder/README.md b/packages/polywrap-client-config-builder/README.md index 44c4d6ce..2022a1db 100644 --- a/packages/polywrap-client-config-builder/README.md +++ b/packages/polywrap-client-config-builder/README.md @@ -54,11 +54,11 @@ config = builder.build() # build with a custom cache config = builder.build({ - wrapperCache: WrapperCache(), + resolution_result_cache: ResolutionResultCache(), }) # or build with a custom resolver -coreClientConfig = builder.build({ +config = builder.build({ resolver: RecursiveResolver(...), }) ``` diff --git a/packages/polywrap-client-config-builder/poetry.lock b/packages/polywrap-client-config-builder/poetry.lock index 2f338195..4446378c 100644 --- a/packages/polywrap-client-config-builder/poetry.lock +++ b/packages/polywrap-client-config-builder/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.5" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.5-py3-none-any.whl", hash = "sha256:078e5212f9885fa85fbb0cf0101978a336190aadea6e13305409d099f71b2324"}, + {file = "astroid-2.15.5.tar.gz", hash = "sha256:1039262575027b441137ab4a62a793a9b43defb42c32d5670f38686207cd780f"}, ] [package.dependencies] @@ -20,6 +20,25 @@ wrapt = [ {version = ">=1.14,<2", markers = "python_version >= \"3.11\""}, ] +[[package]] +name = "attrs" +version = "23.1.0" +description = "Classes Without Boilerplate" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "attrs-23.1.0-py3-none-any.whl", hash = "sha256:1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04"}, + {file = "attrs-23.1.0.tar.gz", hash = "sha256:6279836d581513a26f1bf235f9acd333bc9115683f14f7e8fae46c98fc50e015"}, +] + +[package.extras] +cov = ["attrs[tests]", "coverage[toml] (>=5.3)"] +dev = ["attrs[docs,tests]", "pre-commit"] +docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope-interface"] +tests = ["attrs[tests-no-zope]", "zope-interface"] +tests-no-zope = ["cloudpickle", "hypothesis", "mypy (>=1.1.1)", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-xdist[psutil]"] + [[package]] name = "bandit" version = "1.7.5" @@ -151,19 +170,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -195,6 +214,39 @@ files = [ [package.dependencies] gitdb = ">=4.0.1,<5" +[[package]] +name = "hypothesis" +version = "6.76.0" +description = "A library for property-based testing" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "hypothesis-6.76.0-py3-none-any.whl", hash = "sha256:034f73dd485933b0f4c319d7c3c58230492fdd7b16e821d67d150a78138adb93"}, + {file = "hypothesis-6.76.0.tar.gz", hash = "sha256:526657eb3e4f2076b0383f722b2e6a92fd15d1d42db532decae8c41b14cab801"}, +] + +[package.dependencies] +attrs = ">=19.2.0" +exceptiongroup = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +sortedcontainers = ">=2.1.0,<3.0.0" + +[package.extras] +all = ["backports.zoneinfo (>=0.2.1)", "black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "importlib-metadata (>=3.6)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.16.0)", "pandas (>=1.1)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2023.3)"] +cli = ["black (>=19.10b0)", "click (>=7.0)", "rich (>=9.0.0)"] +codemods = ["libcst (>=0.3.16)"] +dateutil = ["python-dateutil (>=1.4)"] +django = ["django (>=3.2)"] +dpcontracts = ["dpcontracts (>=0.4)"] +ghostwriter = ["black (>=19.10b0)"] +lark = ["lark (>=0.10.1)"] +numpy = ["numpy (>=1.16.0)"] +pandas = ["pandas (>=1.1)"] +pytest = ["pytest (>=4.6)"] +pytz = ["pytz (>=2014.1)"] +redis = ["redis (>=3.0.0)"] +zoneinfo = ["backports.zoneinfo (>=0.2.1)", "tzdata (>=2023.3)"] + [[package]] name = "iniconfig" version = "2.0.0" @@ -407,14 +459,14 @@ files = [ [[package]] name = "nodeenv" -version = "1.7.0" +version = "1.8.0" description = "Node.js virtual environment builder" category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ - {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, - {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, ] [package.dependencies] @@ -458,19 +510,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, + {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -494,15 +546,17 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_core-0.1.0a29-py3-none-any.whl", hash = "sha256:ea3111a0a2a4287c0f7a180fd7bb024530e720cd5ec97767b52502679d42a097"}, - {file = "polywrap_core-0.1.0a29.tar.gz", hash = "sha256:b879c8b621eaa4ae5ad1cc48a6b304596fe9586163395782584207886e793eba"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-core" [[package]] name = "polywrap-manifest" @@ -510,15 +564,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -526,14 +582,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "polywrap-uri-resolvers" @@ -541,15 +599,17 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_uri_resolvers-0.1.0a29-py3-none-any.whl", hash = "sha256:d8e1eb8284640dbcff754ef81d7558d241d4b7c23334be93596bd924cc1ab502"}, - {file = "polywrap_uri_resolvers-0.1.0a29.tar.gz", hash = "sha256:0c1784f03ad54000b3caf46ebeaaeae50cfb4070134e66ce67e270977e99e80c"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-core = ">=0.1.0a29,<0.2.0" -polywrap-wasm = ">=0.1.0a29,<0.2.0" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-wasm = {path = "../polywrap-wasm", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-uri-resolvers" [[package]] name = "polywrap-wasm" @@ -557,19 +617,21 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_wasm-0.1.0a29-py3-none-any.whl", hash = "sha256:462ae2d043abbed45f94b9615339834029af7d503d2f8e6037959fef953edd7b"}, - {file = "polywrap_wasm-0.1.0a29.tar.gz", hash = "sha256:97c2bb2c057e260376a99e5cea44ce2a78097c1ee670be1b6f0269f233f772fe"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-core = ">=0.1.0a29,<0.2.0" -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -unsync = ">=1.4.0,<2.0.0" -unsync-stubs = ">=0.1.2,<0.2.0" -wasmtime = ">=6.0.0,<7.0.0" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +unsync = "^1.4.0" +unsync-stubs = "^0.1.2" +wasmtime = "^6.0.0" + +[package.source] +type = "directory" +url = "../polywrap-wasm" [[package]] name = "py" @@ -585,48 +647,48 @@ files = [ [[package]] name = "pydantic" -version = "1.10.7" +version = "1.10.8" description = "Data validation and settings management using python type hints" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "pydantic-1.10.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e79e999e539872e903767c417c897e729e015872040e56b96e67968c3b918b2d"}, - {file = "pydantic-1.10.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:01aea3a42c13f2602b7ecbbea484a98169fb568ebd9e247593ea05f01b884b2e"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:516f1ed9bc2406a0467dd777afc636c7091d71f214d5e413d64fef45174cfc7a"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae150a63564929c675d7f2303008d88426a0add46efd76c3fc797cd71cb1b46f"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ecbbc51391248116c0a055899e6c3e7ffbb11fb5e2a4cd6f2d0b93272118a209"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f4a2b50e2b03d5776e7f21af73e2070e1b5c0d0df255a827e7c632962f8315af"}, - {file = "pydantic-1.10.7-cp310-cp310-win_amd64.whl", hash = "sha256:a7cd2251439988b413cb0a985c4ed82b6c6aac382dbaff53ae03c4b23a70e80a"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:68792151e174a4aa9e9fc1b4e653e65a354a2fa0fed169f7b3d09902ad2cb6f1"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe2507b8ef209da71b6fb5f4e597b50c5a34b78d7e857c4f8f3115effaef5fe"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10a86d8c8db68086f1e30a530f7d5f83eb0685e632e411dbbcf2d5c0150e8dcd"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d75ae19d2a3dbb146b6f324031c24f8a3f52ff5d6a9f22f0683694b3afcb16fb"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:464855a7ff7f2cc2cf537ecc421291b9132aa9c79aef44e917ad711b4a93163b"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:193924c563fae6ddcb71d3f06fa153866423ac1b793a47936656e806b64e24ca"}, - {file = "pydantic-1.10.7-cp311-cp311-win_amd64.whl", hash = "sha256:b4a849d10f211389502059c33332e91327bc154acc1845f375a99eca3afa802d"}, - {file = "pydantic-1.10.7-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cc1dde4e50a5fc1336ee0581c1612215bc64ed6d28d2c7c6f25d2fe3e7c3e918"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0cfe895a504c060e5d36b287ee696e2fdad02d89e0d895f83037245218a87fe"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:670bb4683ad1e48b0ecb06f0cfe2178dcf74ff27921cdf1606e527d2617a81ee"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:950ce33857841f9a337ce07ddf46bc84e1c4946d2a3bba18f8280297157a3fd1"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:c15582f9055fbc1bfe50266a19771bbbef33dd28c45e78afbe1996fd70966c2a"}, - {file = "pydantic-1.10.7-cp37-cp37m-win_amd64.whl", hash = "sha256:82dffb306dd20bd5268fd6379bc4bfe75242a9c2b79fec58e1041fbbdb1f7914"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8c7f51861d73e8b9ddcb9916ae7ac39fb52761d9ea0df41128e81e2ba42886cd"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6434b49c0b03a51021ade5c4daa7d70c98f7a79e95b551201fff682fc1661245"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64d34ab766fa056df49013bb6e79921a0265204c071984e75a09cbceacbbdd5d"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:701daea9ffe9d26f97b52f1d157e0d4121644f0fcf80b443248434958fd03dc3"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf135c46099ff3f919d2150a948ce94b9ce545598ef2c6c7bf55dca98a304b52"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b0f85904f73161817b80781cc150f8b906d521fa11e3cdabae19a581c3606209"}, - {file = "pydantic-1.10.7-cp38-cp38-win_amd64.whl", hash = "sha256:9f6f0fd68d73257ad6685419478c5aece46432f4bdd8d32c7345f1986496171e"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c230c0d8a322276d6e7b88c3f7ce885f9ed16e0910354510e0bae84d54991143"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:976cae77ba6a49d80f461fd8bba183ff7ba79f44aa5cfa82f1346b5626542f8e"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d45fc99d64af9aaf7e308054a0067fdcd87ffe974f2442312372dfa66e1001d"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d2a5ebb48958754d386195fe9e9c5106f11275867051bf017a8059410e9abf1f"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:abfb7d4a7cd5cc4e1d1887c43503a7c5dd608eadf8bc615413fc498d3e4645cd"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:80b1fab4deb08a8292d15e43a6edccdffa5377a36a4597bb545b93e79c5ff0a5"}, - {file = "pydantic-1.10.7-cp39-cp39-win_amd64.whl", hash = "sha256:d71e69699498b020ea198468e2480a2f1e7433e32a3a99760058c6520e2bea7e"}, - {file = "pydantic-1.10.7-py3-none-any.whl", hash = "sha256:0cd181f1d0b1d00e2b705f1bf1ac7799a2d938cce3376b8007df62b29be3c2c6"}, - {file = "pydantic-1.10.7.tar.gz", hash = "sha256:cfc83c0678b6ba51b0532bea66860617c4cd4251ecf76e9846fa5a9f3454e97e"}, + {file = "pydantic-1.10.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1243d28e9b05003a89d72e7915fdb26ffd1d39bdd39b00b7dbe4afae4b557f9d"}, + {file = "pydantic-1.10.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c0ab53b609c11dfc0c060d94335993cc2b95b2150e25583bec37a49b2d6c6c3f"}, + {file = "pydantic-1.10.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9613fadad06b4f3bc5db2653ce2f22e0de84a7c6c293909b48f6ed37b83c61f"}, + {file = "pydantic-1.10.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:df7800cb1984d8f6e249351139667a8c50a379009271ee6236138a22a0c0f319"}, + {file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:0c6fafa0965b539d7aab0a673a046466d23b86e4b0e8019d25fd53f4df62c277"}, + {file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e82d4566fcd527eae8b244fa952d99f2ca3172b7e97add0b43e2d97ee77f81ab"}, + {file = "pydantic-1.10.8-cp310-cp310-win_amd64.whl", hash = "sha256:ab523c31e22943713d80d8d342d23b6f6ac4b792a1e54064a8d0cf78fd64e800"}, + {file = "pydantic-1.10.8-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:666bdf6066bf6dbc107b30d034615d2627e2121506c555f73f90b54a463d1f33"}, + {file = "pydantic-1.10.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:35db5301b82e8661fa9c505c800d0990bc14e9f36f98932bb1d248c0ac5cada5"}, + {file = "pydantic-1.10.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f90c1e29f447557e9e26afb1c4dbf8768a10cc676e3781b6a577841ade126b85"}, + {file = "pydantic-1.10.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93e766b4a8226e0708ef243e843105bf124e21331694367f95f4e3b4a92bbb3f"}, + {file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:88f195f582851e8db960b4a94c3e3ad25692c1c1539e2552f3df7a9e972ef60e"}, + {file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:34d327c81e68a1ecb52fe9c8d50c8a9b3e90d3c8ad991bfc8f953fb477d42fb4"}, + {file = "pydantic-1.10.8-cp311-cp311-win_amd64.whl", hash = "sha256:d532bf00f381bd6bc62cabc7d1372096b75a33bc197a312b03f5838b4fb84edd"}, + {file = "pydantic-1.10.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:7d5b8641c24886d764a74ec541d2fc2c7fb19f6da2a4001e6d580ba4a38f7878"}, + {file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7b1f6cb446470b7ddf86c2e57cd119a24959af2b01e552f60705910663af09a4"}, + {file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c33b60054b2136aef8cf190cd4c52a3daa20b2263917c49adad20eaf381e823b"}, + {file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1952526ba40b220b912cdc43c1c32bcf4a58e3f192fa313ee665916b26befb68"}, + {file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bb14388ec45a7a0dc429e87def6396f9e73c8c77818c927b6a60706603d5f2ea"}, + {file = "pydantic-1.10.8-cp37-cp37m-win_amd64.whl", hash = "sha256:16f8c3e33af1e9bb16c7a91fc7d5fa9fe27298e9f299cff6cb744d89d573d62c"}, + {file = "pydantic-1.10.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1ced8375969673929809d7f36ad322934c35de4af3b5e5b09ec967c21f9f7887"}, + {file = "pydantic-1.10.8-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93e6bcfccbd831894a6a434b0aeb1947f9e70b7468f274154d03d71fabb1d7c6"}, + {file = "pydantic-1.10.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:191ba419b605f897ede9892f6c56fb182f40a15d309ef0142212200a10af4c18"}, + {file = "pydantic-1.10.8-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:052d8654cb65174d6f9490cc9b9a200083a82cf5c3c5d3985db765757eb3b375"}, + {file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ceb6a23bf1ba4b837d0cfe378329ad3f351b5897c8d4914ce95b85fba96da5a1"}, + {file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f2e754d5566f050954727c77f094e01793bcb5725b663bf628fa6743a5a9108"}, + {file = "pydantic-1.10.8-cp38-cp38-win_amd64.whl", hash = "sha256:6a82d6cda82258efca32b40040228ecf43a548671cb174a1e81477195ed3ed56"}, + {file = "pydantic-1.10.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e59417ba8a17265e632af99cc5f35ec309de5980c440c255ab1ca3ae96a3e0e"}, + {file = "pydantic-1.10.8-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:84d80219c3f8d4cad44575e18404099c76851bc924ce5ab1c4c8bb5e2a2227d0"}, + {file = "pydantic-1.10.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e4148e635994d57d834be1182a44bdb07dd867fa3c2d1b37002000646cc5459"}, + {file = "pydantic-1.10.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:12f7b0bf8553e310e530e9f3a2f5734c68699f42218bf3568ef49cd9b0e44df4"}, + {file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:42aa0c4b5c3025483240a25b09f3c09a189481ddda2ea3a831a9d25f444e03c1"}, + {file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:17aef11cc1b997f9d574b91909fed40761e13fac438d72b81f902226a69dac01"}, + {file = "pydantic-1.10.8-cp39-cp39-win_amd64.whl", hash = "sha256:66a703d1983c675a6e0fed8953b0971c44dba48a929a2000a493c3772eb61a5a"}, + {file = "pydantic-1.10.8-py3-none-any.whl", hash = "sha256:7456eb22ed9aaa24ff3e7b4757da20d9e5ce2a81018c1b3ebd81a0b88a18f3b2"}, + {file = "pydantic-1.10.8.tar.gz", hash = "sha256:1410275520dfa70effadf4c21811d755e7ef9bb1f1d077a21958153a92c8d9ca"}, ] [package.dependencies] @@ -656,14 +718,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -671,18 +733,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -700,14 +762,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.311" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.311-py3-none-any.whl", hash = "sha256:04df30c6b31d05068effe5563411291c876f5e4221d0af225a267b61dce1ca85"}, + {file = "pyright-1.1.311.tar.gz", hash = "sha256:554b555d3f770e8da2e76d6bb94e2ac63b3edc7dcd5fb8de202f9dd53e36689a"}, ] [package.dependencies] @@ -810,14 +872,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.4.1" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.4.1-py3-none-any.whl", hash = "sha256:d204aadb50b936bf6b1a695385429d192bc1fdaf3e8b907e8e26f4c4e4b5bf75"}, + {file = "rich-13.4.1.tar.gz", hash = "sha256:76f6b65ea7e5c5d924ba80e322231d7cb5b5981aa60bfc1e694f1bc097fe6fe1"}, ] [package.dependencies] @@ -829,19 +891,19 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.8.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] @@ -880,16 +942,28 @@ files = [ {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, ] +[[package]] +name = "sortedcontainers" +version = "2.4.0" +description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, + {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, +] + [[package]] name = "stevedore" -version = "5.0.0" +version = "5.1.0" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false python-versions = ">=3.8" files = [ - {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, - {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, + {file = "stevedore-5.1.0-py3-none-any.whl", hash = "sha256:8cc040628f3cea5d7128f2e76cf486b2251a4e543c7b938f58d9a377f6694a2d"}, + {file = "stevedore-5.1.0.tar.gz", hash = "sha256:a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c"}, ] [package.dependencies] @@ -921,14 +995,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -979,14 +1053,14 @@ test = ["coverage", "pycodestyle", "pylint", "pytest"] [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.3" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.3-py3-none-any.whl", hash = "sha256:88a4153d8505aabbb4e13aacb7c486c2b4a33ca3b3f807914a9b4c844c471c26"}, + {file = "typing_extensions-4.6.3.tar.gz", hash = "sha256:d91d5919357fe7f681a9f2b5b4cb2a5f1ef0a1e9f59c4d8ff0d3491e05c0ffd5"}, ] [[package]] @@ -1014,24 +1088,24 @@ files = [ [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wasmtime" @@ -1140,4 +1214,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "49644c642295eecdf5b7c4cf107f7cbd05d5dd195a4585e4762a6105fd9a831a" +content-hash = "4c83da528593354cc45f8379300b60bdd5322f1507ce0e1d8c4a8c3329e003c2" diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/__init__.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/__init__.py index 3cadfb7d..80579769 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/__init__.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/__init__.py @@ -1,3 +1,4 @@ """This package contains modules related to client config builder.""" from .polywrap_client_config_builder import * +from .types import * diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/base_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/base_configure.py index 867a7310..2cd2109f 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/base_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/base_configure.py @@ -1,13 +1,11 @@ """This module contains the base configure class for the client config builder.""" -from ..types import BuilderConfig, ClientConfigBuilder +from typing import cast +from ..types import BuilderConfig, ClientConfigBuilder -class BaseConfigure(ClientConfigBuilder): - """BaseConfigure is the base configure class for the client config builder. - Attributes: - config (BuilderConfig): The internal configuration. - """ +class BaseConfigure: + """BaseConfigure is the base configure class for the client config builder.""" config: BuilderConfig @@ -25,4 +23,4 @@ def add(self, config: BuilderConfig) -> ClientConfigBuilder: self.config.wrappers.update(config.wrappers) if config.packages: self.config.packages.update(config.packages) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/env_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/env_configure.py index daf2e7c2..dc97a60f 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/env_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/env_configure.py @@ -1,57 +1,75 @@ """This module contains the env configure class for the client config builder.""" -from typing import Dict, List, Union +from typing import Any, Dict, List, Union, cast -from polywrap_core import Env, Uri +from polywrap_core import Uri -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class EnvConfigure(ClientConfigBuilder): +class EnvConfigure: """Allows configuring the environment variables.""" - def get_env(self, uri: Uri) -> Union[Env, None]: + config: BuilderConfig + + def get_env(self, uri: Uri) -> Union[Any, None]: """Return the env for the given uri.""" return self.config.envs.get(uri) - def get_envs(self) -> Dict[Uri, Env]: + def get_envs(self) -> Dict[Uri, Any]: """Return the envs from the builder's config.""" return self.config.envs - def set_env(self, uri: Uri, env: Env) -> ClientConfigBuilder: + def set_env(self, uri: Uri, env: Any) -> ClientConfigBuilder: """Set the env by uri in the builder's config, overiding any existing values.""" self.config.envs[uri] = env - return self + return cast(ClientConfigBuilder, self) - def set_envs(self, uri_envs: Dict[Uri, Env]) -> ClientConfigBuilder: + def set_envs(self, uri_envs: Dict[Uri, Any]) -> ClientConfigBuilder: """Set the envs in the builder's config, overiding any existing values.""" self.config.envs.update(uri_envs) - return self + return cast(ClientConfigBuilder, self) - def add_env(self, uri: Uri, env: Env) -> ClientConfigBuilder: + def add_env(self, uri: Uri, env: Any) -> ClientConfigBuilder: """Add an env for the given uri. - If an Env is already associated with the uri, it is modified. + If an Any is already associated with the uri, it is modified. """ - if self.config.envs.get(uri): - for key in self.config.envs[uri]: - self.config.envs[uri][key] = env[key] + if old_env := self.config.envs.get(uri): + new_env = self._merge_envs(old_env, env) + self.config.envs[uri] = new_env else: self.config.envs[uri] = env - return self + return cast(ClientConfigBuilder, self) - def add_envs(self, uri_envs: Dict[Uri, Env]) -> ClientConfigBuilder: + def add_envs(self, uri_envs: Dict[Uri, Any]) -> ClientConfigBuilder: """Add a list of envs to the builder's config.""" for uri, env in uri_envs.items(): self.add_env(uri, env) - return self + return cast(ClientConfigBuilder, self) def remove_env(self, uri: Uri) -> ClientConfigBuilder: """Remove the env for the given uri.""" self.config.envs.pop(uri, None) - return self + return cast(ClientConfigBuilder, self) def remove_envs(self, uris: List[Uri]) -> ClientConfigBuilder: """Remove the envs for the given uris.""" for uri in uris: self.remove_env(uri) - return self + return cast(ClientConfigBuilder, self) + + @staticmethod + def _merge_envs(env1: Dict[str, Any], env2: Dict[str, Any]) -> Dict[str, Any]: + for key, val in env2.items(): + if key not in env1: + env1[key] = val + continue + + if isinstance(val, dict): + old_val = cast(Dict[str, Any], env1[key]) + new_val = cast(Dict[str, Any], val) + + EnvConfigure._merge_envs(old_val, new_val) + else: + env1[key] = val + return env1 diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/interface_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/interface_configure.py index 5144a53c..a3087b54 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/interface_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/interface_configure.py @@ -1,14 +1,16 @@ """This module contains the interface configure class for the client config builder.""" -from typing import Dict, List, Union +from typing import Dict, List, Union, cast from polywrap_core import Uri -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class InterfaceConfigure(ClientConfigBuilder): +class InterfaceConfigure: """Allows configuring the interface-implementations.""" + config: BuilderConfig + def get_interfaces(self) -> Dict[Uri, List[Uri]]: """Return all registered interface and its implementations\ from the builder's config.""" @@ -23,10 +25,13 @@ def add_interface_implementations( ) -> ClientConfigBuilder: """Add a list of implementation URIs for the given interface URI to the builder's config.""" if interface_uri in self.config.interfaces.keys(): - self.config.interfaces[interface_uri].extend(implementations_uris) + existing_implementations = set(self.config.interfaces[interface_uri]) + for implementation_uri in implementations_uris: + if implementation_uri not in existing_implementations: + self.config.interfaces[interface_uri].append(implementation_uri) else: self.config.interfaces[interface_uri] = implementations_uris - return self + return cast(ClientConfigBuilder, self) def remove_interface_implementations( self, interface_uri: Uri, implementations_uris: List[Uri] @@ -37,9 +42,9 @@ def remove_interface_implementations( for uri in self.config.interfaces[interface_uri] if uri not in implementations_uris ] - return self + return cast(ClientConfigBuilder, self) def remove_interface(self, interface_uri: Uri) -> ClientConfigBuilder: """Remove the interface for the given uri.""" self.config.interfaces.pop(interface_uri, None) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/package_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/package_configure.py index f6c6f832..1568538a 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/package_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/package_configure.py @@ -1,43 +1,41 @@ """This module contains the package configure class for the client config builder.""" -from typing import Dict, List, Union +from typing import Dict, List, Union, cast -from polywrap_core import Uri, UriPackageOrWrapper, WrapPackage +from polywrap_core import Uri, WrapPackage -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class PackageConfigure(ClientConfigBuilder): +class PackageConfigure: """Allows configuring the WRAP packages.""" - def get_package(self, uri: Uri) -> Union[WrapPackage[UriPackageOrWrapper], None]: + config: BuilderConfig + + def get_package(self, uri: Uri) -> Union[WrapPackage, None]: """Return the package for the given uri.""" return self.config.packages.get(uri) - def get_packages(self) -> Dict[Uri, WrapPackage[UriPackageOrWrapper]]: + def get_packages(self) -> Dict[Uri, WrapPackage]: """Return the packages from the builder's config.""" return self.config.packages - def set_package( - self, uri: Uri, package: WrapPackage[UriPackageOrWrapper] - ) -> ClientConfigBuilder: + def set_package(self, uri: Uri, package: WrapPackage) -> ClientConfigBuilder: """Set the package by uri in the builder's config, overiding any existing values.""" self.config.packages[uri] = package - return self + return cast(ClientConfigBuilder, self) - def set_packages( - self, uri_packages: Dict[Uri, WrapPackage[UriPackageOrWrapper]] - ) -> ClientConfigBuilder: + def set_packages(self, uri_packages: Dict[Uri, WrapPackage]) -> ClientConfigBuilder: """Set the packages in the builder's config, overiding any existing values.""" self.config.packages.update(uri_packages) - return self + return cast(ClientConfigBuilder, self) def remove_package(self, uri: Uri) -> ClientConfigBuilder: """Remove the package for the given uri.""" self.config.packages.pop(uri, None) - return self + return cast(ClientConfigBuilder, self) def remove_packages(self, uris: List[Uri]) -> ClientConfigBuilder: """Remove the packages for the given uris.""" for uri in uris: self.remove_package(uri) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/redirect_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/redirect_configure.py index d143f74e..dd5f989f 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/redirect_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/redirect_configure.py @@ -1,14 +1,16 @@ """This module contains the redirect configure class for the client config builder.""" -from typing import Dict, List, Union +from typing import Dict, List, Union, cast from polywrap_core import Uri -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class RedirectConfigure(ClientConfigBuilder): +class RedirectConfigure: """Allows configuring the URI redirects.""" + config: BuilderConfig + def get_redirect(self, uri: Uri) -> Union[Uri, None]: """Return the redirect for the given uri.""" return self.config.redirects.get(uri) @@ -21,20 +23,20 @@ def set_redirect(self, from_uri: Uri, to_uri: Uri) -> ClientConfigBuilder: """Set the redirect from a URI to another URI in the builder's config,\ overiding any existing values.""" self.config.redirects[from_uri] = to_uri - return self + return cast(ClientConfigBuilder, self) def set_redirects(self, uri_redirects: Dict[Uri, Uri]) -> ClientConfigBuilder: """Set the redirects in the builder's config, overiding any existing values.""" self.config.redirects.update(uri_redirects) - return self + return cast(ClientConfigBuilder, self) def remove_redirect(self, uri: Uri) -> ClientConfigBuilder: """Remove the redirect for the given uri.""" self.config.redirects.pop(uri, None) - return self + return cast(ClientConfigBuilder, self) def remove_redirects(self, uris: List[Uri]) -> ClientConfigBuilder: """Remove the redirects for the given uris.""" for uri in uris: self.remove_redirect(uri) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/resolver_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/resolver_configure.py index 7b0b90ba..9a6401f1 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/resolver_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/resolver_configure.py @@ -1,14 +1,16 @@ """This module contains the resolver configure class for the client config builder.""" -from typing import List +from typing import List, cast from polywrap_core import UriResolver -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class ResolverConfigure(ClientConfigBuilder): +class ResolverConfigure: """Allows configuring the URI resolvers.""" + config: BuilderConfig + def get_resolvers(self) -> List[UriResolver]: """Return the resolvers from the builder's config.""" return self.config.resolvers @@ -16,10 +18,10 @@ def get_resolvers(self) -> List[UriResolver]: def add_resolver(self, resolver: UriResolver) -> ClientConfigBuilder: """Add a resolver to the builder's config.""" self.config.resolvers.append(resolver) - return self + return cast(ClientConfigBuilder, self) def add_resolvers(self, resolvers_list: List[UriResolver]) -> ClientConfigBuilder: """Add a list of resolvers to the builder's config.""" for resolver in resolvers_list: self.add_resolver(resolver) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/wrapper_configure.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/wrapper_configure.py index 90fad354..1abd86c1 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/wrapper_configure.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/configures/wrapper_configure.py @@ -1,43 +1,41 @@ """This module contains the wrapper configure class for the client config builder.""" -from typing import Dict, List, Union +from typing import Dict, List, Union, cast -from polywrap_core import Uri, UriPackageOrWrapper, Wrapper +from polywrap_core import Uri, Wrapper -from ..types import ClientConfigBuilder +from ..types import BuilderConfig, ClientConfigBuilder -class WrapperConfigure(ClientConfigBuilder): +class WrapperConfigure: """Allows configuring the wrappers.""" - def get_wrapper(self, uri: Uri) -> Union[Wrapper[UriPackageOrWrapper], None]: + config: BuilderConfig + + def get_wrapper(self, uri: Uri) -> Union[Wrapper, None]: """Return the set wrapper for the given uri.""" return self.config.wrappers.get(uri) - def get_wrappers(self) -> Dict[Uri, Wrapper[UriPackageOrWrapper]]: + def get_wrappers(self) -> Dict[Uri, Wrapper]: """Return the wrappers from the builder's config.""" return self.config.wrappers - def set_wrapper( - self, uri: Uri, wrapper: Wrapper[UriPackageOrWrapper] - ) -> ClientConfigBuilder: + def set_wrapper(self, uri: Uri, wrapper: Wrapper) -> ClientConfigBuilder: """Set the wrapper by uri in the builder's config, overiding any existing values.""" self.config.wrappers[uri] = wrapper - return self + return cast(ClientConfigBuilder, self) - def set_wrappers( - self, uri_wrappers: Dict[Uri, Wrapper[UriPackageOrWrapper]] - ) -> ClientConfigBuilder: + def set_wrappers(self, uri_wrappers: Dict[Uri, Wrapper]) -> ClientConfigBuilder: """Set the wrappers in the builder's config, overiding any existing values.""" self.config.wrappers.update(uri_wrappers) - return self + return cast(ClientConfigBuilder, self) def remove_wrapper(self, uri: Uri) -> ClientConfigBuilder: """Remove the wrapper for the given uri.""" self.config.wrappers.pop(uri, None) - return self + return cast(ClientConfigBuilder, self) def remove_wrappers(self, uris: List[Uri]) -> ClientConfigBuilder: """Remove the wrappers for the given uris.""" for uri in uris: self.remove_wrapper(uri) - return self + return cast(ClientConfigBuilder, self) diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/polywrap_client_config_builder.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/polywrap_client_config_builder.py index a155fb7e..edf3bb29 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/polywrap_client_config_builder.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/polywrap_client_config_builder.py @@ -1,18 +1,17 @@ """This module provides a simple builder for building a ClientConfig object.""" # pylint: disable=too-many-ancestors -from typing import Optional +from typing import Optional, cast -from polywrap_core import ClientConfig +from polywrap_core import ClientConfig, UriPackage, UriWrapper from polywrap_uri_resolvers import ( ExtendableUriResolver, - InMemoryWrapperCache, - PackageToWrapperResolver, + InMemoryResolutionResultCache, RecursiveResolver, - RequestSynchronizerResolver, + ResolutionResultCacheResolver, StaticResolver, + StaticResolverLike, UriResolverAggregator, - WrapperCacheResolver, ) from .configures import ( @@ -24,7 +23,7 @@ ResolverConfigure, WrapperConfigure, ) -from .types import BuilderConfig, BuildOptions +from .types import BuilderConfig, BuildOptions, ClientConfigBuilder class PolywrapClientConfigBuilder( @@ -35,6 +34,7 @@ class PolywrapClientConfigBuilder( RedirectConfigure, ResolverConfigure, WrapperConfigure, + ClientConfigBuilder, ): """Defines the default polywrap client config builder for\ building a ClientConfig object for the Polywrap Client. @@ -44,6 +44,28 @@ class PolywrapClientConfigBuilder( PolywrapClientConfigBuilder provides a simple interface for setting\ the redirects, wrappers, packages, and other configuration options\ for the Polywrap Client. + + Examples: + >>> from polywrap_client_config_builder import PolywrapClientConfigBuilder + >>> from polywrap_uri_resolvers import RecursiveResolver + >>> from polywrap_core import Uri + >>> config = ( + ... PolywrapClientConfigBuilder() + ... .set_env(Uri.from_str("test/uri"), {"hello": "world"}) + ... .add_interface_implementations( + ... Uri.from_str("test/interface"), + ... [Uri.from_str("test/impl1"), Uri.from_str("test/impl2")], + ... ) + ... .set_redirect(Uri("test", "from"), Uri("test", "to")) + ... .set_env(Uri("test", "to"), {"foo": "bar"}) + ... .build() + ... ) + >>> config.envs + {Uri("test", "uri"): {'hello': 'world'}, Uri("test", "to"): {'foo': 'bar'}} + >>> config.interfaces + {Uri("test", "interface"): [Uri("test", "impl1"), Uri("test", "impl2")]} + >>> isinstance(config.resolver, RecursiveResolver) + True """ def __init__(self): @@ -51,30 +73,27 @@ def __init__(self): self.config = BuilderConfig( envs={}, interfaces={}, resolvers=[], wrappers={}, packages={}, redirects={} ) + super().__init__() def build(self, options: Optional[BuildOptions] = None) -> ClientConfig: """Build the ClientConfig object from the builder's config.""" + static_resolver_like = self._build_static_resolver_like() + resolver = ( options.resolver if options and options.resolver else RecursiveResolver( - RequestSynchronizerResolver( - WrapperCacheResolver( - PackageToWrapperResolver( - UriResolverAggregator( - [ - StaticResolver(self.config.redirects), - StaticResolver(self.config.wrappers), - StaticResolver(self.config.packages), - *self.config.resolvers, - ExtendableUriResolver(), - ] - ) - ), - options.wrapper_cache - if options and options.wrapper_cache - else InMemoryWrapperCache(), - ) + ResolutionResultCacheResolver( + UriResolverAggregator( + [ + StaticResolver(static_resolver_like), + *self.config.resolvers, + ExtendableUriResolver(), + ] + ), + options.resolution_result_cache + if options and options.resolution_result_cache + else InMemoryResolutionResultCache(), ) ) ) @@ -84,3 +103,17 @@ def build(self, options: Optional[BuildOptions] = None) -> ClientConfig: interfaces=self.config.interfaces, resolver=resolver, ) + + def _build_static_resolver_like(self) -> StaticResolverLike: + static_resolver_like = cast(StaticResolverLike, self.config.redirects) + + for uri, wrapper in self.config.wrappers.items(): + static_resolver_like[uri] = UriWrapper(uri=uri, wrapper=wrapper) + + for uri, package in self.config.packages.items(): + static_resolver_like[uri] = UriPackage(uri=uri, package=package) + + return static_resolver_like + + +__all__ = ["PolywrapClientConfigBuilder"] diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/build_options.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/build_options.py index 1533c36c..d146483e 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/build_options.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/build_options.py @@ -3,17 +3,20 @@ from typing import Optional from polywrap_core import UriResolver -from polywrap_uri_resolvers import WrapperCache +from polywrap_uri_resolvers import ResolutionResultCache @dataclass(slots=True, kw_only=True) class BuildOptions: """BuildOptions defines the options for build method of the client config builder. - Attributes: - wrapper_cache: The wrapper cache. + Args: + resolution_result_cache: The Resolution Result Cache. resolver: The URI resolver. """ - wrapper_cache: Optional[WrapperCache] = None + resolution_result_cache: Optional[ResolutionResultCache] = None resolver: Optional[UriResolver] = None + + +__all__ = ["BuildOptions"] diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/builder_config.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/builder_config.py index 62bba8a3..3f671c06 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/builder_config.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/builder_config.py @@ -1,33 +1,29 @@ """This module contains the BuilderConfig class.""" -from dataclasses import dataclass -from typing import Dict, List +from dataclasses import dataclass, field +from typing import Any, Dict, List -from polywrap_core import ( - Env, - Uri, - UriPackageOrWrapper, - UriResolver, - WrapPackage, - Wrapper, -) +from polywrap_core import Uri, UriResolver, WrapPackage, Wrapper @dataclass(slots=True, kw_only=True) class BuilderConfig: """BuilderConfig defines the internal configuration for the client config builder. - Attributes: - envs (Dict[Uri, Env]): The environment variables for the wrappers. + Args: + envs (Dict[Uri, Any]): The environment variables for the wrappers. interfaces (Dict[Uri, List[Uri]]): The interfaces and their implementations. - wrappers (Dict[Uri, Wrapper[UriPackageOrWrapper]]): The wrappers. - packages (Dict[Uri, WrapPackage[UriPackageOrWrapper]]): The WRAP packages. + wrappers (Dict[Uri, Wrapper]): The wrappers. + packages (Dict[Uri, WrapPackage]): The WRAP packages. resolvers (List[UriResolver]): The URI resolvers. redirects (Dict[Uri, Uri]): The URI redirects. """ - envs: Dict[Uri, Env] - interfaces: Dict[Uri, List[Uri]] - wrappers: Dict[Uri, Wrapper[UriPackageOrWrapper]] - packages: Dict[Uri, WrapPackage[UriPackageOrWrapper]] - resolvers: List[UriResolver] - redirects: Dict[Uri, Uri] + envs: Dict[Uri, Any] = field(default_factory=dict) + interfaces: Dict[Uri, List[Uri]] = field(default_factory=dict) + wrappers: Dict[Uri, Wrapper] = field(default_factory=dict) + packages: Dict[Uri, WrapPackage] = field(default_factory=dict) + resolvers: List[UriResolver] = field(default_factory=list) + redirects: Dict[Uri, Uri] = field(default_factory=dict) + + +__all__ = ["BuilderConfig"] diff --git a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/client_config_builder.py b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/client_config_builder.py index d109fce7..b13d2c40 100644 --- a/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/client_config_builder.py +++ b/packages/polywrap-client-config-builder/polywrap_client_config_builder/types/client_config_builder.py @@ -1,195 +1,183 @@ """This module contains the client config builder class.""" # pylint: disable=too-many-public-methods -from abc import ABC, abstractmethod -from typing import Dict, List, Optional, Union - -from polywrap_core import ( - ClientConfig, - Env, - Uri, - UriPackageOrWrapper, - UriResolver, - WrapPackage, - Wrapper, -) +from typing import Any, Dict, List, Optional, Protocol, Union + +from polywrap_core import ClientConfig, Uri, UriResolver, WrapPackage, Wrapper from .build_options import BuildOptions from .builder_config import BuilderConfig -class ClientConfigBuilder(ABC): +class ClientConfigBuilder(Protocol): """Defines the interface for the client config builder.""" config: BuilderConfig - @abstractmethod def build(self, options: Optional[BuildOptions] = None) -> ClientConfig: """Build the ClientConfig object from the builder's config.""" + ... - @abstractmethod def add(self, config: BuilderConfig) -> "ClientConfigBuilder": """Add the values from the given config to the builder's config.""" + ... # ENV CONFIGURE - @abstractmethod - def get_env(self, uri: Uri) -> Union[Env, None]: + def get_env(self, uri: Uri) -> Union[Any, None]: """Return the env for the given uri.""" + ... - @abstractmethod - def get_envs(self) -> Dict[Uri, Env]: + def get_envs(self) -> Dict[Uri, Any]: """Return the envs from the builder's config.""" + ... - @abstractmethod - def set_env(self, uri: Uri, env: Env) -> "ClientConfigBuilder": + def set_env(self, uri: Uri, env: Any) -> "ClientConfigBuilder": """Set the env by uri in the builder's config, overiding any existing values.""" + ... - @abstractmethod - def set_envs(self, uri_envs: Dict[Uri, Env]) -> "ClientConfigBuilder": + def set_envs(self, uri_envs: Dict[Uri, Any]) -> "ClientConfigBuilder": """Set the envs in the builder's config, overiding any existing values.""" + ... - @abstractmethod - def add_env(self, uri: Uri, env: Env) -> "ClientConfigBuilder": + def add_env(self, uri: Uri, env: Any) -> "ClientConfigBuilder": """Add an env for the given uri. - If an Env is already associated with the uri, it is modified. + If an Any is already associated with the uri, it is modified. """ + ... - @abstractmethod - def add_envs(self, uri_envs: Dict[Uri, Env]) -> "ClientConfigBuilder": + def add_envs(self, uri_envs: Dict[Uri, Any]) -> "ClientConfigBuilder": """Add a list of envs to the builder's config.""" + ... - @abstractmethod def remove_env(self, uri: Uri) -> "ClientConfigBuilder": """Remove the env for the given uri.""" + ... - @abstractmethod def remove_envs(self, uris: List[Uri]) -> "ClientConfigBuilder": """Remove the envs for the given uris.""" + ... # INTERFACE IMPLEMENTATIONS CONFIGURE - @abstractmethod def get_interfaces(self) -> Dict[Uri, List[Uri]]: """Return all registered interface and its implementations from the builder's config.""" + ... - @abstractmethod def get_interface_implementations(self, uri: Uri) -> Union[List[Uri], None]: """Return the interface for the given uri.""" + ... - @abstractmethod def add_interface_implementations( self, interface_uri: Uri, implementations_uris: List[Uri] ) -> "ClientConfigBuilder": """Add a list of implementation URIs for the given interface URI to the builder's config.""" + ... - @abstractmethod def remove_interface_implementations( self, interface_uri: Uri, implementations_uris: List[Uri] ) -> "ClientConfigBuilder": """Remove the implementations for the given interface uri.""" + ... - @abstractmethod def remove_interface(self, interface_uri: Uri) -> "ClientConfigBuilder": """Remove the interface for the given uri.""" + ... # PACKAGE CONFIGURE - @abstractmethod - def get_package(self, uri: Uri) -> Union[WrapPackage[UriPackageOrWrapper], None]: + def get_package(self, uri: Uri) -> Union[WrapPackage, None]: """Return the package for the given uri.""" + ... - @abstractmethod - def get_packages(self) -> Dict[Uri, WrapPackage[UriPackageOrWrapper]]: + def get_packages(self) -> Dict[Uri, WrapPackage]: """Return the packages from the builder's config.""" + ... - @abstractmethod - def set_package( - self, uri: Uri, package: WrapPackage[UriPackageOrWrapper] - ) -> "ClientConfigBuilder": + def set_package(self, uri: Uri, package: WrapPackage) -> "ClientConfigBuilder": """Set the package by uri in the builder's config, overiding any existing values.""" + ... - @abstractmethod def set_packages( - self, uri_packages: Dict[Uri, WrapPackage[UriPackageOrWrapper]] + self, uri_packages: Dict[Uri, WrapPackage] ) -> "ClientConfigBuilder": """Set the packages in the builder's config, overiding any existing values.""" + ... - @abstractmethod def remove_package(self, uri: Uri) -> "ClientConfigBuilder": """Remove the package for the given uri.""" + ... - @abstractmethod def remove_packages(self, uris: List[Uri]) -> "ClientConfigBuilder": """Remove the packages for the given uris.""" + ... # REDIRECT CONFIGURE - @abstractmethod def get_redirect(self, uri: Uri) -> Union[Uri, None]: """Return the redirect for the given uri.""" + ... - @abstractmethod def get_redirects(self) -> Dict[Uri, Uri]: """Return the redirects from the builder's config.""" + ... - @abstractmethod def set_redirect(self, from_uri: Uri, to_uri: Uri) -> "ClientConfigBuilder": """Set the redirect from a URI to another URI in the builder's config,\ overiding any existing values.""" + ... - @abstractmethod def set_redirects(self, uri_redirects: Dict[Uri, Uri]) -> "ClientConfigBuilder": """Set the redirects in the builder's config, overiding any existing values.""" + ... - @abstractmethod def remove_redirect(self, uri: Uri) -> "ClientConfigBuilder": """Remove the redirect for the given uri.""" + ... - @abstractmethod def remove_redirects(self, uris: List[Uri]) -> "ClientConfigBuilder": """Remove the redirects for the given uris.""" + ... # RESOLVER CONFIGURE - @abstractmethod def get_resolvers(self) -> List[UriResolver]: """Return the resolvers from the builder's config.""" + ... - @abstractmethod def add_resolver(self, resolver: UriResolver) -> "ClientConfigBuilder": """Add a resolver to the builder's config.""" + ... - @abstractmethod def add_resolvers(self, resolvers_list: List[UriResolver]) -> "ClientConfigBuilder": """Add a list of resolvers to the builder's config.""" + ... # WRAPPER CONFIGURE - @abstractmethod - def get_wrapper(self, uri: Uri) -> Union[Wrapper[UriPackageOrWrapper], None]: + def get_wrapper(self, uri: Uri) -> Union[Wrapper, None]: """Return the set wrapper for the given uri.""" + ... - @abstractmethod - def get_wrappers(self) -> Dict[Uri, Wrapper[UriPackageOrWrapper]]: + def get_wrappers(self) -> Dict[Uri, Wrapper]: """Return the wrappers from the builder's config.""" + ... - @abstractmethod - def set_wrapper( - self, uri: Uri, wrapper: Wrapper[UriPackageOrWrapper] - ) -> "ClientConfigBuilder": + def set_wrapper(self, uri: Uri, wrapper: Wrapper) -> "ClientConfigBuilder": """Set the wrapper by uri in the builder's config, overiding any existing values.""" + ... - @abstractmethod - def set_wrappers( - self, uri_wrappers: Dict[Uri, Wrapper[UriPackageOrWrapper]] - ) -> "ClientConfigBuilder": + def set_wrappers(self, uri_wrappers: Dict[Uri, Wrapper]) -> "ClientConfigBuilder": """Set the wrappers in the builder's config, overiding any existing values.""" + ... - @abstractmethod def remove_wrapper(self, uri: Uri) -> "ClientConfigBuilder": """Remove the wrapper for the given uri.""" + ... - @abstractmethod def remove_wrappers(self, uris: List[Uri]) -> "ClientConfigBuilder": """Remove the wrappers for the given uris.""" + ... + + +__all__ = ["ClientConfigBuilder"] diff --git a/packages/polywrap-client-config-builder/pyproject.toml b/packages/polywrap-client-config-builder/pyproject.toml index a1aeb055..c7ada229 100644 --- a/packages/polywrap-client-config-builder/pyproject.toml +++ b/packages/polywrap-client-config-builder/pyproject.toml @@ -11,8 +11,8 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -polywrap-uri-resolvers = "^0.1.0a29" -polywrap-core = "^0.1.0a29" +polywrap-uri-resolvers = {path = "../polywrap-uri-resolvers", develop = true} +polywrap-core = {path = "../polywrap-core", develop = true} [tool.poetry.dev-dependencies] pytest = "^7.1.2" pytest-asyncio = "^0.19.0" @@ -25,6 +25,9 @@ isort = "^5.10.1" pyright = "^1.1.275" pydocstyle = "^6.1.1" +[tool.poetry.group.dev.dependencies] +hypothesis = "^6.76.0" + [tool.bandit] exclude_dirs = ["tests"] @@ -42,7 +45,8 @@ testpaths = [ [tool.pylint] disable = [ - + "unnecessary-ellipsis", + "too-few-public-methods" ] ignore = [ "tests/" diff --git a/packages/polywrap-client-config-builder/tests/.gitignore b/packages/polywrap-client-config-builder/tests/.gitignore new file mode 100644 index 00000000..becd6eb0 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/.gitignore @@ -0,0 +1 @@ +!env/ \ No newline at end of file diff --git a/packages/polywrap-client-config-builder/tests/__init__.py b/packages/polywrap-client-config-builder/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/consts.py b/packages/polywrap-client-config-builder/tests/consts.py new file mode 100644 index 00000000..24e79cc8 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/consts.py @@ -0,0 +1,2 @@ +C_LONG_MIN = -9223372036854775808 +C_LONG_MAX = 9223372036854775807 diff --git a/packages/polywrap-client-config-builder/tests/env/__init__.py b/packages/polywrap-client-config-builder/tests/env/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/env/test_add_env.py b/packages/polywrap-client-config-builder/tests/env/test_add_env.py new file mode 100644 index 00000000..05b91dd1 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/env/test_add_env.py @@ -0,0 +1,27 @@ +from typing import Any +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import uri_strategy, env_strategy + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_env=env_strategy, new_env=env_strategy) +def test_add_env(uri: Uri, old_env: Any, new_env: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {uri: {"common": old_env, "unique_1": "unique_env_1"}} + + builder.add_env(uri, {"common": new_env, "unique_2": "unique_env_2"}) + + updated_env = {**old_env, **new_env} + + assert builder.config.envs[uri] == { + "common": updated_env, + "unique_1": "unique_env_1", + "unique_2": "unique_env_2", + } diff --git a/packages/polywrap-client-config-builder/tests/env/test_get_env.py b/packages/polywrap-client-config-builder/tests/env/test_get_env.py new file mode 100644 index 00000000..ffd0f8ad --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/env/test_get_env.py @@ -0,0 +1,40 @@ +from typing import Any, Dict +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import envs_strategy + + +@settings(max_examples=100) +@given(envs=envs_strategy) +def test_get_env_exists( + envs: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = envs + + for uri in envs: + assert builder.get_env(uri) == envs[uri] + assert builder.get_env(Uri.from_str("test/not-exists")) is None + + +def test_get_env_not_exists(): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_env(Uri.from_str("test/not-exists")) is None + + +@settings(max_examples=100) +@given(envs=envs_strategy) +def test_get_envs( + envs: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_envs() == {} + + builder.config.envs = envs + assert builder.get_envs() == envs diff --git a/packages/polywrap-client-config-builder/tests/env/test_remove_env.py b/packages/polywrap-client-config-builder/tests/env/test_remove_env.py new file mode 100644 index 00000000..75d074e3 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/env/test_remove_env.py @@ -0,0 +1,59 @@ +from typing import Any, Dict +from random import randint +from hypothesis import assume, event, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import envs_strategy + + +@settings(max_examples=100) +@given(envs=envs_strategy) +def test_remove_env(envs: Dict[Uri, Any]): + assume(envs) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {**envs} + + uris = list(envs.keys()) + uri_index = randint(0, len(uris) - 1) + remove_uri = uris[uri_index] + event(f"Uri to remove: {remove_uri}") + + builder.remove_env(remove_uri) + assert len(builder.config.envs) == len(envs) - 1 + assert remove_uri not in builder.config.envs + + +@settings(max_examples=100) +@given(envs=envs_strategy) +def test_remove_non_existent_env(envs: Dict[Uri, Any]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {**envs} + + builder.remove_env(Uri("test", "non-existent")) + assert builder.config.envs == envs + + +@settings(max_examples=100) +@given(envs=envs_strategy) +def test_remove_envs(envs: Dict[Uri, Any]): + assume(envs) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {**envs} + + uris = list(envs.keys()) + uri_indices = [ + randint(0, len(uris) - 1) for _ in range(randint(0, len(uris) - 1)) + ] + remove_uris = list({uris[uri_index] for uri_index in uri_indices}) + event(f"Uris to remove: {remove_uris}") + + builder.remove_envs(remove_uris) + assert len(builder.config.envs) == len(envs) - len(remove_uris) + assert set(remove_uris) & set(builder.config.envs.keys()) == set() + + diff --git a/packages/polywrap-client-config-builder/tests/env/test_set_env.py b/packages/polywrap-client-config-builder/tests/env/test_set_env.py new file mode 100644 index 00000000..f6753550 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/env/test_set_env.py @@ -0,0 +1,50 @@ +from typing import Any, Dict +from hypothesis import assume, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import envs_strategy, uri_strategy, env_strategy + + +@settings(max_examples=100) +@given(envs=envs_strategy, new_uri=uri_strategy, new_env=env_strategy) +def test_set_env(envs: Dict[Uri, Any], new_uri: Uri, new_env: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {**envs} + + existing_uris = set(builder.config.envs.keys()) + assume(new_uri not in existing_uris) + + builder.set_env(new_uri, new_env) + + assert len(builder.config.envs) == len(existing_uris) + 1 + assert builder.config.envs[new_uri] == new_env + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_env=env_strategy, new_env=env_strategy) +def test_set_env_overwrite(uri: Uri, old_env: Any, new_env: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {uri: old_env} + + builder.set_env(uri, new_env) + + assert builder.config.envs == {uri: new_env} + + +@settings(max_examples=100) +@given(initial_envs=envs_strategy, new_envs=envs_strategy) +def test_set_envs( + initial_envs: Dict[Uri, Any], + new_envs: Dict[Uri, Any], +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.envs = {**initial_envs} + + builder.set_envs(new_envs) + + assert len(builder.config.envs) <= len(initial_envs) + len(new_envs) diff --git a/packages/polywrap-client-config-builder/tests/interface/__init__.py b/packages/polywrap-client-config-builder/tests/interface/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/interface/test_add_interface.py b/packages/polywrap-client-config-builder/tests/interface/test_add_interface.py new file mode 100644 index 00000000..23662e8b --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/interface/test_add_interface.py @@ -0,0 +1,25 @@ +from typing import List +from hypothesis import given, settings, strategies as st + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import uri_strategy + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_impls=st.lists(uri_strategy), new_impls=st.lists(uri_strategy)) +def test_add_implementations_to_existing_interface(uri: Uri, old_impls: List[Uri], new_impls: List[Uri]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.interfaces = {uri: old_impls} + + builder.add_interface_implementations(uri, new_impls) + + updated_impls = {*old_impls, *new_impls} + + assert set(builder.config.interfaces[uri]) == updated_impls + + diff --git a/packages/polywrap-client-config-builder/tests/interface/test_get_interface.py b/packages/polywrap-client-config-builder/tests/interface/test_get_interface.py new file mode 100644 index 00000000..e9e704b5 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/interface/test_get_interface.py @@ -0,0 +1,40 @@ +from typing import Dict, List +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import interfaces_strategy + + +@settings(max_examples=100) +@given(interfaces=interfaces_strategy) +def test_get_interface_implementations( + interfaces: Dict[Uri, List[Uri]] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.interfaces = interfaces + + for uri in interfaces: + assert builder.get_interface_implementations(uri) == interfaces[uri] + assert builder.get_interface_implementations(Uri.from_str("test/not-exists")) is None + + +def test_get_implementations_not_exists(): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_interface_implementations(Uri.from_str("test/not-exists")) is None + + +@settings(max_examples=100) +@given(interfaces=interfaces_strategy) +def test_get_interfaces( + interfaces: Dict[Uri, List[Uri]] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_interfaces() == {} + + builder.config.interfaces = interfaces + assert builder.get_interfaces() == interfaces diff --git a/packages/polywrap-client-config-builder/tests/interface/test_remove_interface.py b/packages/polywrap-client-config-builder/tests/interface/test_remove_interface.py new file mode 100644 index 00000000..26e932c8 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/interface/test_remove_interface.py @@ -0,0 +1,61 @@ +from typing import Dict, List +from random import randint +from hypothesis import event, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import interfaces_strategy, non_empty_interfaces_strategy + + +@settings(max_examples=50) +@given(interfaces=non_empty_interfaces_strategy) +def test_remove_interface(interfaces: Dict[Uri, List[Uri]]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.interfaces = {**interfaces} + + uris = list(interfaces.keys()) + uri_index = randint(0, len(uris) - 1) + remove_uri = uris[uri_index] + event(f"Uri to remove: {remove_uri}") + + builder.remove_interface(remove_uri) + assert len(builder.config.interfaces) == len(interfaces) - 1 + assert remove_uri not in builder.config.interfaces + + +@settings(max_examples=50) +@given(interfaces=interfaces_strategy) +def test_remove_non_existent_interface(interfaces: Dict[Uri, List[Uri]]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.interfaces = {**interfaces} + + builder.remove_interface(Uri("test", "non-existent")) + assert builder.config.interfaces == interfaces + + +@settings(max_examples=50) +@given(interfaces=non_empty_interfaces_strategy) +def test_remove_interface_implementations(interfaces: Dict[Uri, List[Uri]]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.interfaces = {**interfaces} + + uris = list(interfaces.keys()) + uri_index = randint(0, len(uris) - 1) + remove_interface_uri = uris[uri_index] + event(f"Interface Uri to remove: {remove_interface_uri}") + + impls_uris = list(interfaces[remove_interface_uri]) + impl_uri_indices = [ + randint(0, len(impls_uris) - 1) for _ in range(randint(0, len(impls_uris) - 1)) + ] + remove_uris = list({impls_uris[uri_index] for uri_index in impl_uri_indices}) + event(f"Implementations Uri to remove: {remove_uris}") + + builder.remove_interface_implementations(remove_interface_uri, remove_uris) + assert ( + set(remove_uris) & set(builder.config.interfaces[remove_interface_uri]) == set() + ) diff --git a/packages/polywrap-client-config-builder/tests/package/__init__.py b/packages/polywrap-client-config-builder/tests/package/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/package/test_get_package.py b/packages/polywrap-client-config-builder/tests/package/test_get_package.py new file mode 100644 index 00000000..26b7b993 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/package/test_get_package.py @@ -0,0 +1,40 @@ +from typing import Any, Dict +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import packages_strategy + + +@settings(max_examples=100) +@given(packages=packages_strategy) +def test_get_package_exists( + packages: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = packages + + for uri in packages: + assert builder.get_package(uri) == packages[uri] + assert builder.get_package(Uri.from_str("test/not-exists")) is None + + +def test_get_package_not_exists(): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_package(Uri.from_str("test/not-exists")) is None + + +@settings(max_examples=100) +@given(packages=packages_strategy) +def test_get_packages( + packages: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_packages() == {} + + builder.config.packages = packages + assert builder.get_packages() == packages diff --git a/packages/polywrap-client-config-builder/tests/package/test_remove_package.py b/packages/polywrap-client-config-builder/tests/package/test_remove_package.py new file mode 100644 index 00000000..341f6368 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/package/test_remove_package.py @@ -0,0 +1,59 @@ +from typing import Any, Dict +from random import randint +from hypothesis import assume, event, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import packages_strategy + + +@settings(max_examples=100) +@given(packages=packages_strategy) +def test_remove_package(packages: Dict[Uri, Any]): + assume(packages) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {**packages} + + uris = list(packages.keys()) + uri_index = randint(0, len(uris) - 1) + remove_uri = uris[uri_index] + event(f"Uri to remove: {remove_uri}") + + builder.remove_package(remove_uri) + assert len(builder.config.packages) == len(packages) - 1 + assert remove_uri not in builder.config.packages + + +@settings(max_examples=100) +@given(packages=packages_strategy) +def test_remove_non_existent_package(packages: Dict[Uri, Any]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {**packages} + + builder.remove_package(Uri("test", "non-existent")) + assert builder.config.packages == packages + + +@settings(max_examples=100) +@given(packages=packages_strategy) +def test_remove_packages(packages: Dict[Uri, Any]): + assume(packages) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {**packages} + + uris = list(packages.keys()) + uri_indices = [ + randint(0, len(uris) - 1) for _ in range(randint(0, len(uris) - 1)) + ] + remove_uris = list({uris[uri_index] for uri_index in uri_indices}) + event(f"Uris to remove: {remove_uris}") + + builder.remove_packages(remove_uris) + assert len(builder.config.packages) == len(packages) - len(remove_uris) + assert set(remove_uris) & set(builder.config.packages.keys()) == set() + + diff --git a/packages/polywrap-client-config-builder/tests/package/test_set_package.py b/packages/polywrap-client-config-builder/tests/package/test_set_package.py new file mode 100644 index 00000000..1e9161e7 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/package/test_set_package.py @@ -0,0 +1,50 @@ +from typing import Any, Dict +from hypothesis import assume, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import packages_strategy, uri_strategy, package_strategy + + +@settings(max_examples=100) +@given(packages=packages_strategy, new_uri=uri_strategy, new_package=package_strategy) +def test_set_package(packages: Dict[Uri, Any], new_uri: Uri, new_package: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {**packages} + + existing_uris = set(builder.config.packages.keys()) + assume(new_uri not in existing_uris) + + builder.set_package(new_uri, new_package) + + assert len(builder.config.packages) == len(existing_uris) + 1 + assert builder.config.packages[new_uri] == new_package + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_package=package_strategy, new_package=package_strategy) +def test_set_env_overwrite(uri: Uri, old_package: Any, new_package: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {uri: old_package} + + builder.set_package(uri, new_package) + + assert builder.config.packages == {uri: new_package} + + +@settings(max_examples=100) +@given(initial_packages=packages_strategy, new_packages=packages_strategy) +def test_set_packages( + initial_packages: Dict[Uri, Any], + new_packages: Dict[Uri, Any], +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.packages = {**initial_packages} + + builder.set_packages(new_packages) + + assert len(builder.config.envs) <= len(initial_packages) + len(new_packages) diff --git a/packages/polywrap-client-config-builder/tests/redirect/__init__.py b/packages/polywrap-client-config-builder/tests/redirect/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/redirect/test_get_redirect.py b/packages/polywrap-client-config-builder/tests/redirect/test_get_redirect.py new file mode 100644 index 00000000..5a07cd7e --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/redirect/test_get_redirect.py @@ -0,0 +1,40 @@ +from typing import Any, Dict +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import redirects_strategy + + +@settings(max_examples=100) +@given(redirects=redirects_strategy) +def test_get_redirect_exists( + redirects: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = redirects + + for uri in redirects: + assert builder.get_redirect(uri) == redirects[uri] + assert builder.get_redirect(Uri.from_str("test/not-exists")) is None + + +def test_get_redirect_not_exists(): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_redirect(Uri.from_str("test/not-exists")) is None + + +@settings(max_examples=100) +@given(redirects=redirects_strategy) +def test_get_redirects( + redirects: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_redirects() == {} + + builder.config.redirects = redirects + assert builder.get_redirects() == redirects diff --git a/packages/polywrap-client-config-builder/tests/redirect/test_remove_redirect.py b/packages/polywrap-client-config-builder/tests/redirect/test_remove_redirect.py new file mode 100644 index 00000000..045f48cd --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/redirect/test_remove_redirect.py @@ -0,0 +1,59 @@ +from typing import Any, Dict +from random import randint +from hypothesis import assume, event, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import redirects_strategy + + +@settings(max_examples=100) +@given(redirects=redirects_strategy) +def test_remove_redirect(redirects: Dict[Uri, Any]): + assume(redirects) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {**redirects} + + uris = list(redirects.keys()) + uri_index = randint(0, len(uris) - 1) + remove_uri = uris[uri_index] + event(f"Uri to remove: {remove_uri}") + + builder.remove_redirect(remove_uri) + assert len(builder.config.redirects) == len(redirects) - 1 + assert remove_uri not in builder.config.redirects + + +@settings(max_examples=100) +@given(redirects=redirects_strategy) +def test_remove_non_existent_redirect(redirects: Dict[Uri, Any]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {**redirects} + + builder.remove_redirect(Uri("test", "non-existent")) + assert builder.config.redirects == redirects + + +@settings(max_examples=100) +@given(redirects=redirects_strategy) +def test_remove_redirects(redirects: Dict[Uri, Any]): + assume(redirects) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {**redirects} + + uris = list(redirects.keys()) + uri_indices = [ + randint(0, len(uris) - 1) for _ in range(randint(0, len(uris) - 1)) + ] + remove_uris = list({uris[uri_index] for uri_index in uri_indices}) + event(f"Uris to remove: {remove_uris}") + + builder.remove_redirects(remove_uris) + assert len(builder.config.redirects) == len(redirects) - len(remove_uris) + assert set(remove_uris) & set(builder.config.redirects.keys()) == set() + + diff --git a/packages/polywrap-client-config-builder/tests/redirect/test_set_redirect.py b/packages/polywrap-client-config-builder/tests/redirect/test_set_redirect.py new file mode 100644 index 00000000..4eed5de9 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/redirect/test_set_redirect.py @@ -0,0 +1,50 @@ +from typing import Any, Dict +from hypothesis import assume, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import redirects_strategy, uri_strategy + + +@settings(max_examples=100) +@given(redirects=redirects_strategy, new_uri=uri_strategy, new_redirect=uri_strategy) +def test_set_redirect(redirects: Dict[Uri, Any], new_uri: Uri, new_redirect: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {**redirects} + + existing_uris = set(builder.config.redirects.keys()) + assume(new_uri not in existing_uris) + + builder.set_redirect(new_uri, new_redirect) + + assert len(builder.config.redirects) == len(existing_uris) + 1 + assert builder.config.redirects[new_uri] == new_redirect + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_redirect=uri_strategy, new_redirect=uri_strategy) +def test_set_env_overwrite(uri: Uri, old_redirect: Any, new_redirect: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {uri: old_redirect} + + builder.set_redirect(uri, new_redirect) + + assert builder.config.redirects == {uri: new_redirect} + + +@settings(max_examples=100) +@given(initial_redirects=redirects_strategy, new_redirects=redirects_strategy) +def test_set_redirects( + initial_redirects: Dict[Uri, Any], + new_redirects: Dict[Uri, Any], +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.redirects = {**initial_redirects} + + builder.set_redirects(new_redirects) + + assert len(builder.config.envs) <= len(initial_redirects) + len(new_redirects) diff --git a/packages/polywrap-client-config-builder/tests/resolver/__init__.py b/packages/polywrap-client-config-builder/tests/resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/resolver/test_add_resolvers.py b/packages/polywrap-client-config-builder/tests/resolver/test_add_resolvers.py new file mode 100644 index 00000000..eba6062d --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/resolver/test_add_resolvers.py @@ -0,0 +1,35 @@ +from typing import Any, List +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import UriResolver + +from ..strategies import resolvers_strategy, resolver_strategy + + +@settings(max_examples=100) +@given(resolvers=resolvers_strategy, new_resolver=resolver_strategy) +def test_add_resolver(resolvers: List[UriResolver], new_resolver: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.resolvers = [*resolvers] + builder.add_resolver(new_resolver) + + assert len(builder.config.resolvers) == len(resolvers) + 1 + assert builder.config.resolvers[-1] == new_resolver + + +@settings(max_examples=100) +@given(initial_resolvers=resolvers_strategy, new_resolvers=resolvers_strategy) +def test_add_resolvers( + initial_resolvers: List[UriResolver], + new_resolvers: List[UriResolver], +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.resolvers = [*initial_resolvers] + + builder.add_resolvers(new_resolvers) + + assert len(builder.config.resolvers) == len(initial_resolvers) + len(new_resolvers) diff --git a/packages/polywrap-client-config-builder/tests/resolver/test_get_resolvers.py b/packages/polywrap-client-config-builder/tests/resolver/test_get_resolvers.py new file mode 100644 index 00000000..a3b99593 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/resolver/test_get_resolvers.py @@ -0,0 +1,22 @@ +from typing import List +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import UriResolver + +from ..strategies import resolvers_strategy + + +@settings(max_examples=100) +@given(resolvers=resolvers_strategy) +def test_get_resolvers( + resolvers: List[UriResolver] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_resolvers() == [] + + builder.config.resolvers = resolvers + assert builder.get_resolvers() == resolvers diff --git a/packages/polywrap-client-config-builder/tests/run_doctest.py b/packages/polywrap-client-config-builder/tests/run_doctest.py new file mode 100644 index 00000000..ec9d73c5 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/run_doctest.py @@ -0,0 +1,24 @@ +# test_all.py +import doctest +from typing import Any +import unittest +import pkgutil +import polywrap_client_config_builder + +def load_tests(loader: Any, tests: Any, ignore: Any) -> Any: + """Load doctests and return TestSuite object.""" + modules = pkgutil.walk_packages( + path=polywrap_client_config_builder.__path__, + prefix=f"{polywrap_client_config_builder.__name__}.", + onerror=lambda x: None, + ) + for _, modname, _ in modules: + try: + module = __import__(modname, fromlist="dummy") + tests.addTests(doctest.DocTestSuite(module)) + except (ImportError, ValueError, AttributeError): + continue + return tests + +if __name__ == "__main__": + unittest.main() diff --git a/packages/polywrap-client-config-builder/tests/strategies.py b/packages/polywrap-client-config-builder/tests/strategies.py new file mode 100644 index 00000000..7f27463b --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/strategies.py @@ -0,0 +1,70 @@ +from polywrap_core import Uri, UriResolver, WrapPackage, Wrapper +from hypothesis import strategies as st +from unittest.mock import Mock + +from polywrap_client_config_builder import BuilderConfig + +from .consts import C_LONG_MAX, C_LONG_MIN + +# List of Mock resolvers +MockResolvers = [Mock(UriResolver, name=f"MockResolver{i}") for i in range(10)] + +# List of Mock wrappers +MockWrappers = [Mock(Wrapper, name=f"MockWrapper{i}") for i in range(10)] + +# List of Mock packages +MockPackages = [Mock(WrapPackage, name=f"MockPackage{i}") for i in range(10)] + +# Scalars +scalar_st_list = [ + st.none(), + st.booleans(), + st.integers(min_value=C_LONG_MIN, max_value=C_LONG_MAX), + st.floats(allow_nan=False), + st.text(), + st.binary(), +] + +# Uri +uri_safe_chars_strategy = st.text( + alphabet=st.characters(whitelist_categories="L", whitelist_characters="-._~") +) +uri_strategy = st.builds(Uri, uri_safe_chars_strategy, uri_safe_chars_strategy) + +# Env +env_strategy = st.dictionaries(st.text(), st.one_of(scalar_st_list), max_size=10) +envs_strategy = st.dictionaries( + uri_strategy, env_strategy, max_size=10 +) + +# Interface Implementations +interfaces_strategy = st.dictionaries(uri_strategy, st.lists(uri_strategy, max_size=10), max_size=10) + +# Non-empty Interface Implementations +non_empty_interfaces_strategy = st.dictionaries(uri_strategy, st.lists(uri_strategy, min_size=1, max_size=10), min_size=1, max_size=10) + +# URI Redirects +redirects_strategy = st.dictionaries(uri_strategy, uri_strategy, max_size=10) + +# Resolver +resolver_strategy = st.sampled_from(MockResolvers) +resolvers_strategy = st.lists(resolver_strategy, max_size=10) + +# Wrapper +wrapper_strategy = st.sampled_from(MockWrappers) +wrappers_strategy = st.dictionaries(uri_strategy, wrapper_strategy, max_size=10) + +# Packages +package_strategy = st.sampled_from(MockPackages) +packages_strategy = st.dictionaries(uri_strategy, package_strategy, max_size=10) + +# builder config +builder_config_strategy = st.builds( + BuilderConfig, + envs=envs_strategy, + interfaces=interfaces_strategy, + wrappers=wrappers_strategy, + packages=packages_strategy, + resolvers=resolvers_strategy, + redirects=redirects_strategy, +) diff --git a/packages/polywrap-client-config-builder/tests/test_add.py b/packages/polywrap-client-config-builder/tests/test_add.py new file mode 100644 index 00000000..d0ca5951 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/test_add.py @@ -0,0 +1,61 @@ +from typing import List +from hypothesis import given, settings, strategies as st + +from polywrap_client_config_builder import ( + BuilderConfig, + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) + +from .strategies import builder_config_strategy + + +@settings(max_examples=100) +@given(config=builder_config_strategy) +def test_add_builder_config( + config: BuilderConfig, +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder = builder.add(config) + assert builder.config.envs == config.envs + assert builder.config.interfaces == config.interfaces + assert builder.config.redirects == config.redirects + assert builder.config.resolvers == config.resolvers + assert builder.config.wrappers == config.wrappers + assert builder.config.packages == config.packages + + +@settings(max_examples=10) +@given(configs=st.lists(builder_config_strategy, max_size=10)) +def test_add_multiple_builder_config(configs: List[BuilderConfig]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + expected_config = BuilderConfig() + + for config in configs: + builder = builder.add(config) + expected_config.envs.update(config.envs) + expected_config.interfaces.update(config.interfaces) + expected_config.packages.update(config.packages) + expected_config.wrappers.update(config.wrappers) + expected_config.redirects.update(config.redirects) + expected_config.resolvers.extend(config.resolvers) + + assert builder.config == expected_config + + assert builder.config == expected_config + + +@settings(max_examples=100) +@given(config=builder_config_strategy) +def test_add_builder_config_with_duplicate_data( + config: BuilderConfig, +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder = builder.add(config) + builder = builder.add(config) + assert builder.config.envs == config.envs + assert builder.config.interfaces == config.interfaces + assert builder.config.redirects == config.redirects + assert len(builder.config.resolvers) == 2 * len(config.resolvers) + assert builder.config.wrappers == config.wrappers + assert builder.config.packages == config.packages diff --git a/packages/polywrap-client-config-builder/tests/test_build.py b/packages/polywrap-client-config-builder/tests/test_build.py new file mode 100644 index 00000000..783848ca --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/test_build.py @@ -0,0 +1,121 @@ +from typing import Dict, cast +from unittest.mock import patch +from polywrap_uri_resolvers import ( + PackageResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, + ResolutionResultCacheResolver, + ExtendableUriResolver, + InMemoryResolutionResultCache, +) +from polywrap_client_config_builder import ( + BuildOptions, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri, UriPackage, UriWrapper, WrapPackage, Wrapper +import pytest + + +@pytest.fixture +def builder() -> PolywrapClientConfigBuilder: + """Return a PolywrapClientConfigBuilder with a default config.""" + return PolywrapClientConfigBuilder() + + +def test_build_resolver_order(builder: PolywrapClientConfigBuilder): + """Test the order of resolvers in UriResolverAggregator.""" + redirects: Dict[Uri, Uri] = {Uri.from_str("test/1"): Uri.from_str("test/2")} + builder.config.redirects = redirects + + config = builder.build() + + isinstance(config.resolver, RecursiveResolver) + recursive_resolver = cast(RecursiveResolver, config.resolver) + + isinstance(recursive_resolver.resolver, ResolutionResultCacheResolver) + cache_resolver = cast(ResolutionResultCacheResolver, recursive_resolver.resolver) + + isinstance(cache_resolver.resolver_to_cache, UriResolverAggregator) + aggregator_resolver = cast(UriResolverAggregator, cache_resolver.resolver_to_cache) + + aggregated_resolvers = aggregator_resolver._resolvers # type: ignore + assert isinstance(aggregated_resolvers[0], StaticResolver) + assert isinstance(aggregated_resolvers[1], ExtendableUriResolver) + + +def test_no_build_options(builder: PolywrapClientConfigBuilder): + """Test the absence of resolver in BuildOptions.""" + config = builder.build() + assert isinstance(config.resolver, RecursiveResolver) + + +def test_build_options_resolver(builder: PolywrapClientConfigBuilder): + """Test the presence of resolver in BuildOptions overrides the default one.""" + redirects: Dict[Uri, Uri] = {Uri.from_str("test/1"): Uri.from_str("test/2")} + builder.config.redirects = redirects + + config = builder.build( + BuildOptions( + resolver=PackageResolver( + uri=Uri.from_str("test/package"), package=NotImplemented + ) + ) + ) + + assert isinstance(config.resolver, PackageResolver) + + +def test_build_options_cache(builder: PolywrapClientConfigBuilder): + """Test the presence of cache in BuildOptions overrides the default one.""" + custom_cache = InMemoryResolutionResultCache() + config = builder.build(BuildOptions(resolution_result_cache=custom_cache)) + assert isinstance(config.resolver, RecursiveResolver) + assert isinstance(config.resolver.resolver, ResolutionResultCacheResolver) + + assert config.resolver.resolver.cache is custom_cache + + +def test_build_static_resolver_like(builder: PolywrapClientConfigBuilder): + """Test the composition of StaticResolverLike.""" + redirects: Dict[Uri, Uri] = {Uri.from_str("test/from"): Uri.from_str("test/to")} + builder.config.redirects = redirects + + with patch("polywrap_core.types.wrapper.Wrapper") as MockWrapper, patch( + "polywrap_core.types.wrap_package.WrapPackage" + ) as MockPackage: + + wrappers: Dict[Uri, Wrapper] = {Uri.from_str("test/wrapper"): MockWrapper} + builder.config.wrappers = wrappers + + packages: Dict[Uri, WrapPackage] = {Uri.from_str("test/package"): MockPackage} + builder.config.packages = packages + + static_resolver_like = builder._build_static_resolver_like() # type: ignore + + assert static_resolver_like[Uri.from_str("test/from")] == Uri.from_str( + "test/to" + ) + assert static_resolver_like[Uri.from_str("test/wrapper")] == UriWrapper( + uri=Uri.from_str("test/wrapper"), wrapper=MockWrapper + ) + assert static_resolver_like[Uri.from_str("test/package")] == UriPackage( + uri=Uri.from_str("test/package"), package=MockPackage + ) + + +def test_build_client_config_attributes(builder: PolywrapClientConfigBuilder): + """Test the attributes of ClientConfig.""" + envs = {Uri("test", "env1"): "test", Uri("test", "env2"): "test"} + builder.config.envs = envs + + interfaces = { + Uri("test", "interface1"): [Uri("test", "impl1"), Uri("test", "impl2")], + Uri("test", "interface2"): [Uri("test", "impl3")], + } + builder.config.interfaces = interfaces + + config = builder.build() + + assert config.envs is envs + assert config.interfaces is interfaces diff --git a/packages/polywrap-client-config-builder/tests/test_client_config_builder.py b/packages/polywrap-client-config-builder/tests/test_client_config_builder.py deleted file mode 100644 index 9c8ae684..00000000 --- a/packages/polywrap-client-config-builder/tests/test_client_config_builder.py +++ /dev/null @@ -1,482 +0,0 @@ -# """ -# Polywrap Python Client. - -# The Test suite for the Polywrap Client Config Builder uses pytest to -# test the various methods of the ClientConfigBuilder class. These tests -# include sample code for configuring the client's: -# - Envs -# - Interfaces -# - Packages -# - Redirects -# - Wrappers -# - Resolvers - -# docs.polywrap.io -# Copyright 2022 Polywrap -# """ - -# from abc import ABC -# from dataclasses import asdict -# from typing import Any, Dict, Generic, List, Optional, TypeVar, Union, cast - -# from polywrap_client import PolywrapClient -# from polywrap_core import ( -# AnyWrapManifest, -# GetFileOptions, -# GetManifestOptions, -# InvocableResult, -# InvokeOptions, -# Invoker, -# IUriResolver, -# IWrapPackage, -# Uri, -# UriPackage, -# UriWrapper, -# Wrapper, -# ) -# from polywrap_result import Err, Ok, Result - -# from polywrap_client_config_builder import ( -# BaseClientConfigBuilder, -# ClientConfig, -# ClientConfigBuilder, -# ) - -# UriResolverLike = Union[Uri, UriPackage, UriWrapper, List["UriResolverLike"]] - - -# # Mocked Classes for the tests (class fixtures arent supported in pytest) -# pw = PolywrapClient() -# resolver: IUriResolver = pw.get_uri_resolver() -# TConfig = TypeVar('TConfig') -# TResult = TypeVar('TResult') - -# class MockedModule(Generic[TConfig, TResult], ABC): -# env: Dict[str, Any] -# config: TConfig - -# def __init__(self, config: TConfig): -# self.config = config - -# def set_env(self, env: Dict[str, Any]) -> None: -# self.env = env - -# async def __wrap_invoke__(self, method: str, args: Dict[str, Any], client: Invoker) -> Result[TResult]: -# methods: List[str] = [name for name in dir(self) if name == method] - -# if not methods: -# return Err.from_str(f"{method} is not defined in plugin") - -# callable_method = getattr(self, method) -# return Ok(callable_method(args, client)) if callable(callable_method) else Err.from_str(f"{method} is an attribute, not a method") - - -# class MockedWrapper(Wrapper, Generic[TConfig, TResult]): -# module: MockedModule[TConfig, TResult] - -# def __init__(self, module: MockedModule[TConfig, TResult], manifest: AnyWrapManifest) -> None: -# self.module = module -# self.manifest = manifest - -# async def invoke( -# self, options: InvokeOptions, invoker: Invoker -# ) -> Result[InvocableResult]: -# env = options.env or {} -# self.module.set_env(env) - -# args: Union[Dict[str, Any], bytes] = options.args or {} -# decoded_args: Dict[str, Any] = msgpack_decode(args) if isinstance(args, bytes) else args - -# result: Result[TResult] = await self.module.__wrap_invoke__(options.method, decoded_args, invoker) - -# if result.is_err(): -# return cast(Err, result.err) - -# return Ok(InvocableResult(result=result,encoded=False)) - - -# async def get_file(self, options: GetFileOptions) -> Result[Union[str, bytes]]: -# return Err.from_str("client.get_file(..) is not implemented for plugins") - -# def get_manifest(self) -> Result[AnyWrapManifest]: -# return Ok(self.manifest) - -# class MockedPackage(Generic[TConfig, TResult], IWrapPackage): -# module: MockedModule[TConfig, TResult] -# manifest: AnyWrapManifest - -# def __init__( -# self, -# module: MockedModule[TConfig, TResult], -# manifest: AnyWrapManifest -# ): -# self.module = module -# self.manifest = manifest - -# async def create_wrapper(self) -> Result[Wrapper]: -# return Ok(MockedWrapper(module=self.module, manifest=self.manifest)) - -# async def get_manifest(self, options: Optional[GetManifestOptions] = None) -> Result[AnyWrapManifest]: -# return Ok(self.manifest) - - - -# def test_client_config_structure_starts_empty(): -# ccb = ClientConfigBuilder() -# client_config = ccb.build() -# result = ClientConfig( -# envs={}, -# interfaces={}, -# resolver = [], -# wrappers = [], -# packages=[], -# redirects={} -# ) -# assert asdict(client_config) == asdict(result) - - -# def test_client_config_structure_sets_env(): -# ccb = ClientConfigBuilder() -# uri = Uri("wrap://ens/eth.plugin.one"), -# env = { 'color': "red", 'size': "small" } -# ccb = ccb.set_env( -# uri = uri, -# env = env -# ) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={uri: env}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - - -# # ENVS - -# def test_client_config_builder_set_env(env_varA, env_uriX): -# ccb = ClientConfigBuilder() -# envs = { env_uriX: env_varA } -# ccb = ccb.set_env( env_varA, env_uriX) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs=envs, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# def test_client_config_builder_add_env(env_varA, env_uriX): -# ccb = ClientConfigBuilder() # instantiate new client config builder -# ccb = ccb.add_env(env = env_varA, uri = env_uriX) # add env to client config builder -# client_config: ClientConfig = ccb.build() # build a client config object -# print(client_config) -# assert asdict(client_config) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# def test_client_config_builder_add_env_updates_env_value(env_varA,env_varB, env_uriX): -# ccb = ClientConfigBuilder() # instantiate new client config builder -# ccb = ccb.add_env(env = env_varA, uri = env_uriX) # add env to client config builder -# client_config: ClientConfig = ccb.build() # build a client config object -# assert asdict(client_config) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) -# ccb = ccb.add_env(env = env_varB, uri = env_uriX) # update value of env var on client config builder -# client_config: ClientConfig = ccb.build() # build a new client config object -# assert asdict(client_config) == asdict(ClientConfig(envs={env_uriX: env_varB}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# def test_client_config_builder_set_env_and_add_env_updates_and_add_values(env_varA, env_varB, env_varN, env_varM, env_varS, env_uriX, env_uriY): -# ccb = ClientConfigBuilder() -# ccb = ccb.set_env(env_varA, env_uriX) # set the environment variables A -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# ccb = ccb.set_env(env_varB, env_uriX) # set new vars on the same Uri -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={env_uriX: env_varB}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# ccb = ccb.add_env(env_varM, env_uriY) # add new env vars on a new Uri -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig( -# envs={ -# env_uriX: env_varB, -# env_uriY: env_varM -# }, -# interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# # add new env vars on the second Uri, while also updating the Env vars of dog and season -# ccb = ccb.add_envs([env_varN, env_varS], env_uriY) -# new_envs = {**env_varM, **env_varN, **env_varS} -# print(new_envs) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs = {env_uriX: env_varB, env_uriY: new_envs}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# # INTERFACES AND IMPLEMENTATIONS - -# def test_client_config_builder_adds_interface_implementations(): -# ccb = ClientConfigBuilder() -# interfaces_uri = Uri("wrap://ens/eth.plugin.one") -# implementations_uris = [Uri("wrap://ens/eth.plugin.one"), Uri("wrap://ens/eth.plugin.two")] -# ccb = ccb.add_interface_implementations(interfaces_uri, implementations_uris) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={interfaces_uri: implementations_uris}, resolver = [], wrappers=[], packages=[], redirects={})) - -# # PACKAGES - -# def test_client_config_builder_set_package(): -# # wrap_package = IWrapPackage() -# ccb = ClientConfigBuilder() -# uri_package = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# ccb = ccb.set_package(uri_package) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[], packages=[uri_package], redirects={})) - - -# def test_client_config_builder_set_package(): -# ccb = ClientConfigBuilder() -# module: MockedModule[None, str] = MockedModule(config=None) -# manifest = cast(AnyWrapManifest, {}) -# # This implementation below is correct, but the test fails because the UriPackage -# # gets instantiated twice and two different instances are created. -# # uri_package: UriPackage = UriPackage(uri=env_uriX, package=MockedPackage(module, manifest)) -# # so instead we use the following implementation -# uri_package = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# ccb = ccb.set_package(uri_package) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, -# interfaces={}, resolver = [], wrappers=[], packages=[uri_package], redirects={})) - -# def test_client_config_builder_add_package(): -# ccb = ClientConfigBuilder() -# uri_package = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# ccb = ccb.add_package(uri_package) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, -# resolver = [], wrappers=[], packages=[uri_package], redirects={})) - -# def test_client_config_builder_add_package_updates_packages_list(): -# ccb = ClientConfigBuilder() -# uri_package1 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# ccb = ccb.add_package(uri_package1) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, -# resolver = [], wrappers=[], packages=[uri_package1], redirects={})) -# uri_package2 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Updated") -# ccb = ccb.add_package(uri_package2) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, -# resolver = [], wrappers=[], packages=[uri_package1, uri_package2], redirects={})) - -# def test_client_config_builder_add_multiple_packages(): -# ccb = ClientConfigBuilder() -# uri_package1 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# uri_package2 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Updated") -# ccb = ccb.add_packages([uri_package1, uri_package2]) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], -# wrappers=[], packages=[uri_package1, uri_package2], redirects={})) - -# def test_client_config_builder_add_packages_removes_packages(): -# ccb = ClientConfigBuilder() -# uri_package1 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# uri_package2 = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Updated") -# ccb = ccb.add_packages([uri_package1, uri_package2]) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], -# wrappers=[], packages=[uri_package1, uri_package2], redirects={})) -# ccb = ccb.remove_package(uri_package1) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], -# wrappers=[], packages=[uri_package2], redirects={})) - -# # WRAPPERS AND PLUGINS - -# def test_client_config_builder_add_wrapper1(): -# ccb = ClientConfigBuilder() -# uri_wrapper = UriWrapper(uri=Uri("wrap://ens/eth.plugin.one"),wrapper="todo") -# ccb = ccb.add_wrapper(uri_wrapper) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[uri_wrapper], packages=[], redirects={})) -# # add second wrapper -# uri_wrapper2 = UriWrapper(uri=Uri("wrap://ens/eth.plugin.two"),wrapper="Todo") -# ccb = ccb.add_wrapper(uri_wrapper2) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[uri_wrapper, uri_wrapper2], packages=[], redirects={})) - - -# def test_client_config_builder_add_wrapper2(): -# ccb = ClientConfigBuilder() -# wrapper = Uri("wrap://ens/uni.wrapper.eth") -# ccb = ccb.add_wrapper(wrapper) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[wrapper], packages=[], redirects={})) - -# def test_client_config_builder_adds_multiple_wrappers(): -# ccb = ClientConfigBuilder() -# wrappers = [Uri("wrap://ens/uni.wrapper.eth"), Uri("wrap://ens/https.plugin.eth")] -# ccb = ccb.add_wrappers(wrappers) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=wrappers, packages=[], redirects={})) - -# def test_client_config_builder_removes_wrapper(): -# ccb = ClientConfigBuilder() -# wrapper = Uri("wrap://ens/uni.wrapper.eth") -# ccb = ccb.add_wrapper(wrapper) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[wrapper], packages=[], redirects={})) -# ccb = ccb.remove_wrapper(wrapper) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={})) - -# # RESOLVER - -# def test_client_config_builder_set_uri_resolver(): -# ccb = ClientConfigBuilder() -# resolver: UriResolverLike = Uri("wrap://ens/eth.resolver.one") -# ccb = ccb.set_resolver(resolver) -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[resolver], wrappers=[], packages=[], redirects={})) - -# def test_client_config_builder_add_resolver(): -# # set a first resolver -# ccb = ClientConfigBuilder() -# resolverA = Uri("wrap://ens/eth.resolver.one") -# ccb: BaseClientConfigBuilder = ccb.set_resolver(resolverA) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[resolverA], wrappers=[], packages=[], redirects={})) - -# # add a second resolver -# resolverB = Uri("wrap://ens/eth.resolver.two") -# ccb = ccb.add_resolver(resolverB) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[resolverA, resolverB], wrappers=[], packages=[], redirects={})) - -# # add a third and fourth resolver -# resolverC = Uri("wrap://ens/eth.resolver.three") -# resolverD = Uri("wrap://ens/eth.resolver.four") -# ccb = ccb.add_resolvers([resolverC, resolverD]) -# client_config: ClientConfig = ccb.build() -# resolvers: List[UriResolverLike] = [resolverA, resolverB, resolverC, resolverD] -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=resolvers, wrappers=[], packages=[], redirects={})) - -# # REDIRECTS - -# def test_client_config_builder_sets_uri_redirects(env_uriX, env_uriY, env_uriZ): -# # set a first redirect -# ccb = ClientConfigBuilder() -# ccb = ccb.set_uri_redirect(env_uriX, env_uriY) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={env_uriX: env_uriY})) - -# # add a second redirect -# ccb = ccb.set_uri_redirect(env_uriY, env_uriZ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={env_uriX: env_uriY, env_uriY: env_uriZ})) - -# # update the first redirect -# ccb.set_uri_redirect(env_uriX, env_uriZ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={env_uriX: env_uriZ, env_uriY: env_uriZ})) - -# def test_client_config_builder_removes_uri_redirects(env_uriX, env_uriY, env_uriZ): -# ccb = ClientConfigBuilder() -# ccb = ccb.set_uri_redirect(env_uriX, env_uriY) -# ccb = ccb.set_uri_redirect(env_uriY, env_uriZ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={env_uriX: env_uriY, env_uriY: env_uriZ})) - -# ccb = ccb.remove_uri_redirect(env_uriX) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={env_uriY: env_uriZ})) - - - -# def test_client_config_builder_sets_many_uri_redirects(env_uriX,env_uriY, env_uriZ): - -# # set a first redirect -# ccb = ClientConfigBuilder() -# ccb = ccb.set_uri_redirects([{ -# env_uriX: env_uriY, -# }] ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], redirects={env_uriX: env_uriY})) - -# # updates that first redirect to a new value -# ccb = ccb.set_uri_redirects([{ -# env_uriX: env_uriZ, -# }] ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], redirects={env_uriX: env_uriZ})) - -# # add a second redirect -# ccb = ccb.set_uri_redirects([{ -# env_uriY: env_uriX, -# }] ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], redirects={env_uriX: env_uriZ, env_uriY: env_uriX})) - -# # add a third redirect and update the first redirect -# ccb = ccb.set_uri_redirects([{ -# env_uriX: env_uriY, -# env_uriZ: env_uriY, -# }] ) -# client_config: ClientConfig = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, resolver=[], wrappers=[], packages=[], -# redirects={ -# env_uriX: env_uriY, -# env_uriY: env_uriX, -# env_uriZ: env_uriY -# })) - - -# # GENERIC ADD FUNCTION - -# def test_client_config_builder_generic_add(env_varA,env_uriX, env_uriY): -# # Test adding package, wrapper, resolver, interface, and env with the ccb.add method -# ccb = ClientConfigBuilder() - -# # starts empty -# client_config = ccb.build() -# assert asdict(client_config) == asdict(ClientConfig(envs={}, interfaces={}, -# resolver = [], wrappers=[], packages=[], redirects={})) - -# # add an env -# new_config = ClientConfig(envs={env_uriX: env_varA}, interfaces={}, resolver = [], wrappers=[], packages=[], redirects={}) -# ccb = ccb.add(new_config) -# client_config1 = ccb.build() -# assert asdict(client_config1) == asdict(new_config) - -# # add a resolver -# new_resolvers = ClientConfig(resolver=[Uri("wrap://ens/eth.resolver.one")], envs={}, interfaces={}, wrappers=[], packages=[], redirects={}) -# ccb = ccb.add(new_resolvers) -# client_config2 = ccb.build() -# assert asdict(client_config2) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, -# resolver = [Uri("wrap://ens/eth.resolver.one")], wrappers=[], packages=[], redirects={})) - -# # add a second resolver -# new_resolver = ClientConfig(resolver=[Uri("wrap://ens/eth.resolver.two")], envs={}, interfaces={}, wrappers=[], packages=[], redirects={}) -# ccb = ccb.add(new_resolver) -# client_config5 = ccb.build() -# assert asdict(client_config5) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, -# resolver = [Uri("wrap://ens/eth.resolver.one"), Uri("wrap://ens/eth.resolver.two")], wrappers=[], packages=[], redirects={})) - - -# # add a wrapper -# new_wrapper = ClientConfig(wrappers=[Uri("wrap://ens/uni.wrapper.eth")], envs={}, interfaces={}, resolver = [], packages=[], redirects={}) -# ccb = ccb.add(new_wrapper) -# client_config3 = ccb.build() -# assert asdict(client_config3) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces={}, -# resolver = [Uri("wrap://ens/eth.resolver.one"), Uri("wrap://ens/eth.resolver.two")], -# wrappers=[Uri("wrap://ens/uni.wrapper.eth")], packages=[], redirects={})) - -# # add an interface -# interfaces: Dict[Uri, List[Uri]] = {Uri("wrap://ens/eth.interface.eth"): [env_uriX,env_uriY]} -# new_interface = ClientConfig(interfaces=interfaces, envs={}, resolver = [], wrappers=[], packages=[], redirects={}) -# ccb = ccb.add(new_interface) -# client_config4 = ccb.build() -# assert asdict(client_config4) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces=interfaces, -# resolver = [Uri("wrap://ens/eth.resolver.one"), Uri("wrap://ens/eth.resolver.two")], -# wrappers=[Uri("wrap://ens/uni.wrapper.eth")], packages=[], redirects={})) - -# # add a package -# uri_package = UriPackage(uri=Uri("wrap://ens/eth.plugin.one"),package="Todo") -# new_package = ClientConfig(packages=[uri_package], envs={}, interfaces={}, resolver = [], wrappers=[], redirects={}) -# ccb = ccb.add(new_package) -# client_config6 = ccb.build() -# assert asdict(client_config6) == asdict(ClientConfig(envs={env_uriX: env_varA}, interfaces=interfaces, -# resolver = [Uri("wrap://ens/eth.resolver.one"), Uri("wrap://ens/eth.resolver.two")], -# wrappers=[Uri("wrap://ens/uni.wrapper.eth")], packages=[uri_package], redirects={})) - - diff --git a/packages/polywrap-client-config-builder/tests/test_sanity.py b/packages/polywrap-client-config-builder/tests/test_sanity.py deleted file mode 100644 index eee2f85b..00000000 --- a/packages/polywrap-client-config-builder/tests/test_sanity.py +++ /dev/null @@ -1,12 +0,0 @@ -from polywrap_core import Uri -from polywrap_client_config_builder import PolywrapClientConfigBuilder - - -def test_sanity(): - config = ( - PolywrapClientConfigBuilder() - .add_env(Uri.from_str("ens/hello.eth"), {"hello": "world"}) - .build() - ) - - assert config.envs[Uri.from_str("ens/hello.eth")]["hello"] == "world" diff --git a/packages/polywrap-client-config-builder/tests/wrapper/__init__.py b/packages/polywrap-client-config-builder/tests/wrapper/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client-config-builder/tests/wrapper/test_get_wrapper.py b/packages/polywrap-client-config-builder/tests/wrapper/test_get_wrapper.py new file mode 100644 index 00000000..2203892b --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/wrapper/test_get_wrapper.py @@ -0,0 +1,40 @@ +from typing import Any, Dict +from hypothesis import given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import wrappers_strategy + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy) +def test_get_wrapper_exists( + wrappers: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = wrappers + + for uri in wrappers: + assert builder.get_wrapper(uri) == wrappers[uri] + assert builder.get_wrapper(Uri.from_str("test/not-exists")) is None + + +def test_get_wrapper_not_exists(): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_wrapper(Uri.from_str("test/not-exists")) is None + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy) +def test_get_wrappers( + wrappers: Dict[Uri, Any] +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + assert builder.get_wrappers() == {} + + builder.config.wrappers = wrappers + assert builder.get_wrappers() == wrappers diff --git a/packages/polywrap-client-config-builder/tests/wrapper/test_remove_wrapper.py b/packages/polywrap-client-config-builder/tests/wrapper/test_remove_wrapper.py new file mode 100644 index 00000000..0a54eae4 --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/wrapper/test_remove_wrapper.py @@ -0,0 +1,59 @@ +from typing import Any, Dict +from random import randint +from hypothesis import assume, event, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import wrappers_strategy + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy) +def test_remove_wrapper(wrappers: Dict[Uri, Any]): + assume(wrappers) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {**wrappers} + + uris = list(wrappers.keys()) + uri_index = randint(0, len(uris) - 1) + remove_uri = uris[uri_index] + event(f"Uri to remove: {remove_uri}") + + builder.remove_wrapper(remove_uri) + assert len(builder.config.wrappers) == len(wrappers) - 1 + assert remove_uri not in builder.config.wrappers + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy) +def test_remove_non_existent_wrapper(wrappers: Dict[Uri, Any]): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {**wrappers} + + builder.remove_wrapper(Uri("test", "non-existent")) + assert builder.config.wrappers == wrappers + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy) +def test_remove_wrappers(wrappers: Dict[Uri, Any]): + assume(wrappers) + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {**wrappers} + + uris = list(wrappers.keys()) + uri_indices = [ + randint(0, len(uris) - 1) for _ in range(randint(0, len(uris) - 1)) + ] + remove_uris = list({uris[uri_index] for uri_index in uri_indices}) + event(f"Uris to remove: {remove_uris}") + + builder.remove_wrappers(remove_uris) + assert len(builder.config.wrappers) == len(wrappers) - len(remove_uris) + assert set(remove_uris) & set(builder.config.wrappers.keys()) == set() + + diff --git a/packages/polywrap-client-config-builder/tests/wrapper/test_set_wrapper.py b/packages/polywrap-client-config-builder/tests/wrapper/test_set_wrapper.py new file mode 100644 index 00000000..da05a52b --- /dev/null +++ b/packages/polywrap-client-config-builder/tests/wrapper/test_set_wrapper.py @@ -0,0 +1,50 @@ +from typing import Any, Dict +from hypothesis import assume, given, settings + +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri + +from ..strategies import wrappers_strategy, uri_strategy, wrapper_strategy + + +@settings(max_examples=100) +@given(wrappers=wrappers_strategy, new_uri=uri_strategy, new_wrapper=wrapper_strategy) +def test_set_wrapper(wrappers: Dict[Uri, Any], new_uri: Uri, new_wrapper: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {**wrappers} + + existing_uris = set(builder.config.wrappers.keys()) + assume(new_uri not in existing_uris) + + builder.set_wrapper(new_uri, new_wrapper) + + assert len(builder.config.wrappers) == len(existing_uris) + 1 + assert builder.config.wrappers[new_uri] == new_wrapper + + +@settings(max_examples=100) +@given(uri=uri_strategy, old_wrapper=wrapper_strategy, new_wrapper=wrapper_strategy) +def test_set_env_overwrite(uri: Uri, old_wrapper: Any, new_wrapper: Any): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {uri: old_wrapper} + + builder.set_wrapper(uri, new_wrapper) + + assert builder.config.wrappers == {uri: new_wrapper} + + +@settings(max_examples=100) +@given(initial_wrappers=wrappers_strategy, new_wrappers=wrappers_strategy) +def test_set_wrappers( + initial_wrappers: Dict[Uri, Any], + new_wrappers: Dict[Uri, Any], +): + builder: ClientConfigBuilder = PolywrapClientConfigBuilder() + builder.config.wrappers = {**initial_wrappers} + + builder.set_wrappers(new_wrappers) + + assert len(builder.config.envs) <= len(initial_wrappers) + len(new_wrappers) diff --git a/packages/polywrap-client/README.md b/packages/polywrap-client/README.md index 2be53554..a077bc1b 100644 --- a/packages/polywrap-client/README.md +++ b/packages/polywrap-client/README.md @@ -9,12 +9,26 @@ Python implementation of the polywrap client. Use the `polywrap-uri-resolvers` package to configure resolver and build config for the client. ```python -from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader - -config = ClientConfig( - resolver=FsUriResolver(file_reader=SimpleFileReader()) +from polywrap_uri_resolvers import ( + FsUriResolver, + SimpleFileReader ) - +from polywrap_core import Uri, ClientConfig +from polywrap_client import PolywrapClient +from polywrap_client_config_builder import PolywrapClientConfigBuilder + +builder = ( + PolywrapClientConfigBuilder() + .add_resolver(FsUriResolver(file_reader=SimpleFileReader())) + .set_env(Uri.from_str("ens/foo.eth"), {"foo": "bar"}) + .add_interface_implementations( + Uri.from_str("ens/foo.eth"), [ + Uri.from_str("ens/bar.eth"), + Uri.from_str("ens/baz.eth") + ] + ) +) +config = builder.build() client = PolywrapClient(config) ``` @@ -32,9 +46,6 @@ args = { "prop1": "1000", # multiply the base number by this factor }, } -options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False -) -result = await client.invoke(options) +result = client.invoke(uri=uri, method="method", args=args, encode_result=False) assert result == "123000" ``` \ No newline at end of file diff --git a/packages/polywrap-client/poetry.lock b/packages/polywrap-client/poetry.lock index 55ad1014..dcd3ec56 100644 --- a/packages/polywrap-client/poetry.lock +++ b/packages/polywrap-client/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.4" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.4-py3-none-any.whl", hash = "sha256:a1b8543ef9d36ea777194bc9b17f5f8678d2c56ee6a45b2c2f17eec96f242347"}, + {file = "astroid-2.15.4.tar.gz", hash = "sha256:c81e1c7fbac615037744d067a9bb5f9aeb655edf59b63ee8b59585475d6f80d8"}, ] [package.dependencies] @@ -151,19 +151,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -458,19 +458,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"}, + {file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -490,7 +490,7 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "polywrap-client-config-builder" -version = "0.1.0a28" +version = "0.1.0a29" description = "" category = "dev" optional = false @@ -517,8 +517,8 @@ files = [] develop = true [package.dependencies] -polywrap-manifest = "^0.1.0a29" -polywrap-msgpack = "^0.1.0a29" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} [package.source] type = "directory" @@ -530,15 +530,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -546,14 +548,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "polywrap-plugin" @@ -566,14 +570,28 @@ files = [] develop = true [package.dependencies] -polywrap-core = "^0.1.0a29" -polywrap-manifest = "^0.1.0a29" -polywrap-msgpack = "^0.1.0a29" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} [package.source] type = "directory" url = "../polywrap-plugin" +[[package]] +name = "polywrap-test-cases" +version = "0.1.0a29" +description = "Plugin package" +category = "dev" +optional = false +python-versions = "^3.10" +files = [] +develop = true + +[package.source] +type = "directory" +url = "../polywrap-test-cases" + [[package]] name = "polywrap-uri-resolvers" version = "0.1.0a29" @@ -585,8 +603,8 @@ files = [] develop = true [package.dependencies] -polywrap-core = "^0.1.0a29" -polywrap-wasm = "^0.1.0a29" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-wasm = {path = "../polywrap-wasm", develop = true} [package.source] type = "directory" @@ -598,19 +616,21 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_wasm-0.1.0a29-py3-none-any.whl", hash = "sha256:462ae2d043abbed45f94b9615339834029af7d503d2f8e6037959fef953edd7b"}, - {file = "polywrap_wasm-0.1.0a29.tar.gz", hash = "sha256:97c2bb2c057e260376a99e5cea44ce2a78097c1ee670be1b6f0269f233f772fe"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-core = ">=0.1.0a29,<0.2.0" -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -unsync = ">=1.4.0,<2.0.0" -unsync-stubs = ">=0.1.2,<0.2.0" -wasmtime = ">=6.0.0,<7.0.0" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +unsync = "^1.4.0" +unsync-stubs = "^0.1.2" +wasmtime = "^6.0.0" + +[package.source] +type = "directory" +url = "../polywrap-wasm" [[package]] name = "py" @@ -740,14 +760,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -755,18 +775,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -784,14 +804,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.307" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.307-py3-none-any.whl", hash = "sha256:6b360d2e018311bdf8acea73ef1f21bf0b5b502345aa94bc6763cf197b2e75b3"}, + {file = "pyright-1.1.307.tar.gz", hash = "sha256:b7a8734fad4a2438b8bb0dfbe462f529c9d4eb31947bdae85b9b4e7a97ff6a49"}, ] [package.dependencies] @@ -925,14 +945,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -944,14 +964,14 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.7.2" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, ] [package.extras] @@ -1036,14 +1056,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1129,24 +1149,24 @@ files = [ [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wasmtime" @@ -1255,4 +1275,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "45555f608380159ffbd59e24ed29fbcec94d09e10f901de1d22a5900034a2ba2" +content-hash = "4155c5c48793c71912efd5d8fbf125766472bcc9c1c3a7ba7144df0afd26eade" diff --git a/packages/polywrap-client/polywrap_client/client.py b/packages/polywrap-client/polywrap_client/client.py index 358e3a44..8e26cf48 100644 --- a/packages/polywrap-client/polywrap_client/client.py +++ b/packages/polywrap-client/polywrap_client/client.py @@ -3,44 +3,38 @@ import json from textwrap import dedent -from typing import Any, Dict, List, Optional, Union, cast +from typing import Any, Dict, List, Optional, Union from polywrap_core import ( Client, ClientConfig, - Env, - GetFileOptions, - GetManifestOptions, - InvokerOptions, - IUriResolutionContext, - TryResolveUriOptions, Uri, UriPackage, UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, UriResolver, UriWrapper, Wrapper, + build_clean_uri_history, + get_env_from_resolution_path, ) -from polywrap_manifest import AnyWrapManifest +from polywrap_core import get_implementations as core_get_implementations +from polywrap_manifest import AnyWrapManifest, DeserializeManifestOptions from polywrap_msgpack import msgpack_decode, msgpack_encode -from polywrap_uri_resolvers import UriResolutionContext, build_clean_uri_history class PolywrapClient(Client): """Defines the Polywrap client. - Attributes: - _config (ClientConfig): The client configuration. + Args: + config (ClientConfig): The polywrap client config. """ _config: ClientConfig def __init__(self, config: ClientConfig): - """Initialize a new PolywrapClient instance. - - Args: - config (ClientConfig): The polywrap client config. - """ + """Initialize a new PolywrapClient instance.""" self._config = config def get_config(self) -> ClientConfig: @@ -59,13 +53,13 @@ def get_uri_resolver(self) -> UriResolver: """ return self._config.resolver - def get_envs(self) -> Dict[Uri, Env]: + def get_envs(self) -> Dict[Uri, Any]: """Get the dictionary of environment variables. Returns: - Dict[Uri, Env]: The dictionary of environment variables. + Dict[Uri, Any]: The dictionary of environment variables. """ - envs: Dict[Uri, Env] = self._config.envs + envs: Dict[Uri, Any] = self._config.envs return envs def get_interfaces(self) -> Dict[Uri, List[Uri]]: @@ -77,142 +71,216 @@ def get_interfaces(self) -> Dict[Uri, List[Uri]]: interfaces: Dict[Uri, List[Uri]] = self._config.interfaces return interfaces - def get_implementations(self, uri: Uri) -> Union[List[Uri], None]: - """Get the implementations for the given interface URI. + def get_implementations( + self, + uri: Uri, + apply_resolution: bool = True, + resolution_context: Optional[UriResolutionContext] = None, + ) -> Optional[List[Uri]]: + """Get implementations of an interface with its URI. Args: - uri (Uri): The interface URI. + uri (Uri): URI of the interface. + apply_resolution (bool): If True, apply resolution to the URI and interfaces. + resolution_context (Optional[UriResolutionContext]): A URI resolution context Returns: - Union[List[Uri], None]: The list of implementation URIs. + Optional[List[Uri]]: List of implementations or None if not found. + + Raises: + WrapGetImplementationsError: If the URI cannot be resolved. """ interfaces: Dict[Uri, List[Uri]] = self.get_interfaces() - return interfaces.get(uri) + if not apply_resolution: + return interfaces.get(uri) - def get_env_by_uri(self, uri: Uri) -> Union[Env, None]: + return core_get_implementations(uri, interfaces, self, resolution_context) + + def get_env_by_uri(self, uri: Uri) -> Union[Any, None]: """Get the environment variables for the given URI. Args: uri (Uri): The URI of the wrapper. Returns: - Union[Env, None]: The environment variables. + Union[Any, None]: The environment variables. """ return self._config.envs.get(uri) - async def get_file(self, uri: Uri, options: GetFileOptions) -> Union[bytes, str]: + def get_file( + self, uri: Uri, path: str, encoding: Optional[str] = "utf-8" + ) -> Union[bytes, str]: """Get the file from the given wrapper URI. Args: uri (Uri): The wrapper URI. - options (GetFileOptions): The options for getting the file. + path (str): The path to the file. + encoding (Optional[str]): The encoding of the file. Returns: Union[bytes, str]: The file contents. """ - loaded_wrapper = await self.load_wrapper(uri) - return await loaded_wrapper.get_file(options) + loaded_wrapper = self.load_wrapper(uri) + return loaded_wrapper.get_file(path, encoding) - async def get_manifest( - self, uri: Uri, options: Optional[GetManifestOptions] = None + def get_manifest( + self, uri: Uri, options: Optional[DeserializeManifestOptions] = None ) -> AnyWrapManifest: """Get the manifest from the given wrapper URI. Args: uri (Uri): The wrapper URI. - options (Optional[GetManifestOptions]): The options for getting the manifest. + options (Optional[DeserializeManifestOptions]): The manifest options. Returns: AnyWrapManifest: The manifest. """ - loaded_wrapper = await self.load_wrapper(uri) + loaded_wrapper = self.load_wrapper(uri) return loaded_wrapper.get_manifest() - async def try_resolve_uri( - self, options: TryResolveUriOptions[UriPackageOrWrapper] + def try_resolve_uri( + self, uri: Uri, resolution_context: Optional[UriResolutionContext] = None ) -> UriPackageOrWrapper: """Try to resolve the given URI. Args: - options (TryResolveUriOptions[UriPackageOrWrapper]): The options for resolving the URI. + uri (Uri): The URI to resolve. + resolution_context (Optional[UriResolutionContext]):\ + The resolution context. Returns: UriPackageOrWrapper: The resolved URI, package or wrapper. + + Raises: + UriResolutionError: If the URI cannot be resolved. """ - uri = options.uri uri_resolver = self._config.resolver - resolution_context = options.resolution_context or UriResolutionContext() + resolution_context = resolution_context or UriResolutionContext() - return await uri_resolver.try_resolve_uri(uri, self, resolution_context) + return uri_resolver.try_resolve_uri(uri, self, resolution_context) - async def load_wrapper( + def load_wrapper( self, uri: Uri, - resolution_context: Optional[IUriResolutionContext[UriPackageOrWrapper]] = None, - ) -> Wrapper[UriPackageOrWrapper]: + resolution_context: Optional[UriResolutionContext] = None, + ) -> Wrapper: """Load the wrapper for the given URI. Args: uri (Uri): The wrapper URI. - resolution_context (Optional[IUriResolutionContext[UriPackageOrWrapper]]):\ + resolution_context (Optional[UriResolutionContext]):\ The resolution context. Returns: - Wrapper[UriPackageOrWrapper]: initialized wrapper instance. + Wrapper: initialized wrapper instance. + + Raises: + UriResolutionError: If the URI cannot be resolved. + RuntimeError: If the URI cannot be resolved. """ resolution_context = resolution_context or UriResolutionContext() - uri_package_or_wrapper = await self.try_resolve_uri( - TryResolveUriOptions(uri=uri, resolution_context=resolution_context) + uri_package_or_wrapper = self.try_resolve_uri( + uri=uri, resolution_context=resolution_context ) - if isinstance(uri_package_or_wrapper, UriPackage): - return await cast( - UriPackage[UriPackageOrWrapper], uri_package_or_wrapper - ).package.create_wrapper() - - if isinstance(uri_package_or_wrapper, UriWrapper): - return cast(UriWrapper[UriPackageOrWrapper], uri_package_or_wrapper).wrapper - - raise RuntimeError( - dedent( - f""" - Error resolving URI "{uri.uri}" - URI not found - Resolution Stack: { - json.dumps( - build_clean_uri_history( - resolution_context.get_history() - ), indent=2 + match uri_package_or_wrapper: + case UriPackage(uri=uri, package=package): + return package.create_wrapper() + case UriWrapper(uri=uri, wrapper=wrapper): + return wrapper + case _: + raise RuntimeError( + dedent( + f""" + Error resolving URI "{uri.uri}" + URI not found + Resolution Stack: { + json.dumps( + build_clean_uri_history( + resolution_context.get_history() + ), indent=2 + ) + } + """ ) - } - """ - ) - ) + ) - async def invoke(self, options: InvokerOptions[UriPackageOrWrapper]) -> Any: + def invoke( + self, + uri: Uri, + method: str, + args: Optional[Any] = None, + env: Optional[Any] = None, + resolution_context: Optional[UriResolutionContext] = None, + encode_result: Optional[bool] = False, + ) -> Any: """Invoke the given wrapper URI. Args: - options (InvokerOptions[UriPackageOrWrapper]): The options for invoking the wrapper. + uri (Uri): The wrapper URI. + method (str): The method to invoke. + args (Optional[Any]): The arguments to pass to the method. + env (Optional[Any]): The environment variables to pass. + resolution_context (Optional[UriResolutionContext]):\ + The resolution context. + encode_result (Optional[bool]): If True, encode the result. Returns: Any: The result of the invocation. + + Raises: + RuntimeError: If the URI cannot be resolved. + MsgpackError: If the data cannot be encoded/decoded. + ManifestError: If the manifest is invalid. + WrapError: If something went wrong during the invocation. + UriResolutionError: If the URI cannot be resolved. """ - resolution_context = options.resolution_context or UriResolutionContext() - wrapper = await self.load_wrapper( - options.uri, resolution_context=resolution_context + resolution_context = resolution_context or UriResolutionContext() + load_wrapper_context = resolution_context.create_sub_history_context() + wrapper = self.load_wrapper(uri, resolution_context=load_wrapper_context) + wrapper_resolution_path = load_wrapper_context.get_resolution_path() + wrapper_resolved_uri = wrapper_resolution_path[-1] + + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, + result=UriWrapper(uri=uri, wrapper=wrapper), + description="Client.load_wrapper", + sub_history=load_wrapper_context.get_history(), + ) + ) + + env = env or get_env_from_resolution_path( + load_wrapper_context.get_resolution_path(), self ) - options.env = options.env or self.get_env_by_uri(options.uri) - invocable_result = await wrapper.invoke(options, invoker=self) + wrapper_invoke_context = resolution_context.create_sub_history_context() - if options.encode_result and not invocable_result.encoded: + invocable_result = wrapper.invoke( + uri=wrapper_resolved_uri, + method=method, + args=args, + env=env, + resolution_context=wrapper_invoke_context, + client=self, + ) + + resolution_context.track_step( + UriResolutionStep( + source_uri=wrapper_resolved_uri, + result=wrapper_resolved_uri, + description="Wrapper.invoke", + sub_history=wrapper_invoke_context.get_history(), + ) + ) + + if encode_result and not invocable_result.encoded: encoded = msgpack_encode(invocable_result.result) return encoded if ( - not options.encode_result + not encode_result and invocable_result.encoded and isinstance(invocable_result.result, (bytes, bytearray)) ): @@ -220,3 +288,6 @@ async def invoke(self, options: InvokerOptions[UriPackageOrWrapper]) -> Any: return decoded return invocable_result.result + + +__all__ = ["PolywrapClient"] diff --git a/packages/polywrap-client/pyproject.toml b/packages/polywrap-client/pyproject.toml index 7d063f27..76b7e9cb 100644 --- a/packages/polywrap-client/pyproject.toml +++ b/packages/polywrap-client/pyproject.toml @@ -11,16 +11,16 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -polywrap-uri-resolvers = "^0.1.0a29" -polywrap-manifest = "^0.1.0a29" -polywrap-msgpack = "^0.1.0a29" -polywrap-core = "^0.1.0a29" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +polywrap-core = {path = "../polywrap-core", develop = true} [tool.poetry.dev-dependencies] pytest = "^7.1.2" pytest-asyncio = "^0.19.0" polywrap-plugin = {path = "../polywrap-plugin", develop = true} polywrap-client-config-builder = {path = "../polywrap-client-config-builder", develop = true} +polywrap-test-cases = {path = "../polywrap-test-cases", develop = true} pylint = "^2.15.4" black = "^22.10.0" bandit = { version = "^1.7.4", extras = ["toml"]} @@ -52,6 +52,7 @@ testpaths = [ [tool.pylint] disable = [ + "too-many-arguments", ] ignore = [ "tests/" diff --git a/packages/polywrap-client/tests/cases/asyncify/wrap.info b/packages/polywrap-client/tests/cases/asyncify/wrap.info deleted file mode 100644 index d77304d2..00000000 Binary files a/packages/polywrap-client/tests/cases/asyncify/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/asyncify/wrap.wasm b/packages/polywrap-client/tests/cases/asyncify/wrap.wasm deleted file mode 100644 index 3ff58acd..00000000 Binary files a/packages/polywrap-client/tests/cases/asyncify/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/big-number/wrap.info b/packages/polywrap-client/tests/cases/big-number/wrap.info deleted file mode 100644 index 923183bf..00000000 Binary files a/packages/polywrap-client/tests/cases/big-number/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/big-number/wrap.wasm b/packages/polywrap-client/tests/cases/big-number/wrap.wasm deleted file mode 100644 index e12d75ce..00000000 Binary files a/packages/polywrap-client/tests/cases/big-number/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/sha3/wrap.info b/packages/polywrap-client/tests/cases/sha3/wrap.info deleted file mode 100644 index 4c52e6c9..00000000 --- a/packages/polywrap-client/tests/cases/sha3/wrap.info +++ /dev/null @@ -1 +0,0 @@ -��version�0.1�name�sha3-wasm-rs�type�wasm�abi��version�0.1�moduleType��type�Module�kind̀�methods���name�sha3_512�return��type�String�name�sha3_512�requiredäkind"�scalar��name�sha3_512�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�sha3_384�return��type�String�name�sha3_384�requiredäkind"�scalar��name�sha3_384�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�sha3_256�return��type�String�name�sha3_256�requiredäkind"�scalar��name�sha3_256�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�sha3_224�return��type�String�name�sha3_224�requiredäkind"�scalar��name�sha3_224�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�keccak_512�return��type�String�name�keccak_512�requiredäkind"�scalar��name�keccak_512�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�keccak_384�return��type�String�name�keccak_384�requiredäkind"�scalar��name�keccak_384�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�keccak_256�return��type�String�name�keccak_256�requiredäkind"�scalar��name�keccak_256�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�keccak_224�return��type�String�name�keccak_224�requiredäkind"�scalar��name�keccak_224�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�hex_keccak_256�return��type�String�name�hex_keccak_256�requiredäkind"�scalar��name�hex_keccak_256�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��name�buffer_keccak_256�return��type�String�name�buffer_keccak_256�requiredäkind"�scalar��name�buffer_keccak_256�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�Bytes�name�message�requiredäkind"�scalar��name�message�type�Bytes�requiredäkind��name�shake_256�return��type�String�name�shake_256�requiredäkind"�scalar��name�shake_256�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��type�Int�name�outputBits�requiredäkind"�scalar��name�outputBits�type�Int�requiredäkind��name�shake_128�return��type�String�name�shake_128�requiredäkind"�scalar��name�shake_128�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�message�requiredäkind"�scalar��name�message�type�String�requiredäkind��type�Int�name�outputBits�requiredäkind"�scalar��name�outputBits�type�Int�requiredäkind \ No newline at end of file diff --git a/packages/polywrap-client/tests/cases/sha3/wrap.wasm b/packages/polywrap-client/tests/cases/sha3/wrap.wasm deleted file mode 100644 index 004b76f7..00000000 Binary files a/packages/polywrap-client/tests/cases/sha3/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-env/wrap.info b/packages/polywrap-client/tests/cases/simple-env/wrap.info deleted file mode 100644 index 9789e69c..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-env/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-env/wrap.wasm b/packages/polywrap-client/tests/cases/simple-env/wrap.wasm deleted file mode 100644 index b2803ab3..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-env/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.info b/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.info deleted file mode 100644 index afe55c11..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.wasm b/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.wasm deleted file mode 100755 index e8772878..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-interface/implementation/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-interface/interface/wrap.info b/packages/polywrap-client/tests/cases/simple-interface/interface/wrap.info deleted file mode 100644 index e7ea4d79..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-interface/interface/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.info b/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.info deleted file mode 100644 index 29b5baca..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.wasm b/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.wasm deleted file mode 100755 index 0aca8ee9..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-interface/wrapper/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.info b/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.info deleted file mode 100644 index df7afa51..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.wasm b/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.wasm deleted file mode 100755 index fc8365b7..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-subinvoke/invoke/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.info b/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.info deleted file mode 100644 index 94137ba9..00000000 --- a/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.info +++ /dev/null @@ -1 +0,0 @@ -��version�0.1�name�Simple�type�wasm�abi��version�0.1�moduleType��type�Module�kind̀�methods���name�add�return��type�Int�name�add�requiredäkind"�scalar��name�add�type�Int�requiredäkind�type�Method�kind@�requiredéarguments���type�Int�name�a�requiredäkind"�scalar��name�a�type�Int�requiredäkind��type�Int�name�b�requiredäkind"�scalar��name�b�type�Int�requiredäkind \ No newline at end of file diff --git a/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.wasm b/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.wasm deleted file mode 100755 index 878af173..00000000 Binary files a/packages/polywrap-client/tests/cases/simple-subinvoke/subinvoke/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.info b/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.info deleted file mode 100644 index 5fe7559f..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.wasm b/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.wasm deleted file mode 100755 index 50a0ba0b..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/00-subinvoke/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.info b/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.info deleted file mode 100644 index ea746854..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.wasm b/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.wasm deleted file mode 100755 index efba976d..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/01-invoke/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.info b/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.info deleted file mode 100644 index b7303416..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.info and /dev/null differ diff --git a/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.wasm b/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.wasm deleted file mode 100755 index 3b5e06c9..00000000 Binary files a/packages/polywrap-client/tests/cases/subinvoke/02-consumer/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-client/tests/conftest.py b/packages/polywrap-client/tests/conftest.py deleted file mode 100644 index db1f91b1..00000000 --- a/packages/polywrap-client/tests/conftest.py +++ /dev/null @@ -1,86 +0,0 @@ - -from pathlib import Path -from polywrap_core import FileReader, ClientConfig, Invoker, UriPackageOrWrapper, Env, Uri -from polywrap_uri_resolvers import ( - RecursiveResolver, - UriResolverAggregator, - StaticResolver, - FsUriResolver, - SimpleFileReader, - WRAP_MANIFEST_PATH, - WRAP_MODULE_PATH -) -from polywrap_plugin import PluginModule, PluginPackage -from pytest import fixture -from typing import Dict, Any, Optional -from polywrap_client import PolywrapClient -import time - -@fixture -def client(memory_storage_plugin: PluginPackage[None]): - memory_storage_uri = Uri.from_str("wrap://ens/memory-storage.polywrap.eth") - config = ClientConfig( - resolver=RecursiveResolver( - UriResolverAggregator( - [ - FsUriResolver(file_reader=SimpleFileReader()), - StaticResolver({ memory_storage_uri: memory_storage_plugin}) - ] - ) - ) - ) - return PolywrapClient(config) - -@fixture -def simple_wrap_module(): - wrap_path = Path(__file__).parent / "cases" / "simple-invoke" / "wrap.wasm" - with open(wrap_path, "rb") as f: - yield f.read() - - -@fixture -def simple_wrap_manifest(): - wrap_path = Path(__file__).parent / "cases" / "simple-invoke" / "wrap.info" - with open(wrap_path, "rb") as f: - yield f.read() - -@fixture -def simple_file_reader(simple_wrap_module: bytes, simple_wrap_manifest: bytes): - class SimpleFileReader(FileReader): - async def read_file(self, file_path: str) -> bytes: - if file_path == WRAP_MODULE_PATH: - return simple_wrap_module - if file_path == WRAP_MANIFEST_PATH: - return simple_wrap_manifest - raise FileNotFoundError(f"FileNotFound: {file_path}") - - yield SimpleFileReader() - -class MemoryStorage(PluginModule[None]): - def __init__(self): - super().__init__(None) - self.value = 0 - - def getData(self, args: Dict[str, Any], client: Invoker[UriPackageOrWrapper], env: Optional[Env]) -> int: - time.sleep(0.05) # Sleep for 50 milliseconds - return self.value - - def setData(self, args: Dict[str, Any], client: Invoker[UriPackageOrWrapper], env: Optional[Env]) -> bool: - time.sleep(0.05) # Sleep for 50 milliseconds - self.value = args["value"] - return True - - -@fixture -def memory_storage_plugin() -> PluginPackage[None]: - return PluginPackage(module=MemoryStorage(), manifest={}) # type: ignore - - -class Adder(PluginModule[None]): - def add(self, args: Dict[str, Any], client: Invoker[UriPackageOrWrapper], env: Optional[Env]) -> int: - return args["a"] + args["b"] - - -@fixture -def adder_plugin() -> PluginPackage[None]: - return PluginPackage(module=Adder(None), manifest={}) # type: ignore diff --git a/packages/polywrap-client/tests/consts.py b/packages/polywrap-client/tests/consts.py new file mode 100644 index 00000000..ecae4792 --- /dev/null +++ b/packages/polywrap-client/tests/consts.py @@ -0,0 +1 @@ +SUPPORTED_IMPLEMENTATIONS = ["as", "rs"] \ No newline at end of file diff --git a/packages/polywrap-client/tests/test_asyncify.py b/packages/polywrap-client/tests/test_asyncify.py deleted file mode 100644 index 63536585..00000000 --- a/packages/polywrap-client/tests/test_asyncify.py +++ /dev/null @@ -1,111 +0,0 @@ -# Polywrap Python Client - https://polywrap.io -# BigNumber wrapper schema - https://wrappers.io/v/ipfs/Qme2YXThmsqtfpiUPHJUEzZSBiqX3woQxxdXbDJZvXrvAD - -from pathlib import Path -from polywrap_client import PolywrapClient -from polywrap_core import Uri, InvokerOptions, UriPackageOrWrapper - - -async def test_asyncify(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "asyncify").absolute()}' - ) - args = { - "numberOfTimes": 40 - } - subsequent_invokes_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="subsequentInvokes", args=args - ) - subsequent_invokes_result = await client.invoke(subsequent_invokes_options) - subsequent_invokes_expected = [str(i) for i in range(40)] - - assert subsequent_invokes_result == subsequent_invokes_expected - - local_var_method_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="localVarMethod", args=None - ) - - local_var_method_result = await client.invoke(local_var_method_options) - - assert local_var_method_result == True - - global_var_method_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="globalVarMethod", args=None - ) - - global_var_method_result = await client.invoke(global_var_method_options) - assert global_var_method_result == True - - - large_str = "polywrap" * 10000 - set_data_with_large_args_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="setDataWithLargeArgs", args={"value":large_str} - ) - set_data_with_large_args_result = await client.invoke(set_data_with_large_args_options) - assert set_data_with_large_args_result == large_str - - large_str = "polywrap" * 10000 - set_data_with_large_args_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="setDataWithLargeArgs", args={"value":large_str} - ) - set_data_with_large_args_result = await client.invoke(set_data_with_large_args_options) - assert set_data_with_large_args_result == large_str - - set_data_with_many_args_args = { - "valueA": "polywrap a", - "valueB": "polywrap b", - "valueC": "polywrap c", - "valueD": "polywrap d", - "valueE": "polywrap e", - "valueF": "polywrap f", - "valueG": "polywrap g", - "valueH": "polywrap h", - "valueI": "polywrap i", - "valueJ": "polywrap j", - "valueK": "polywrap k", - "valueL": "polywrap l", - } - set_data_with_many_args_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="setDataWithManyArgs", args=set_data_with_many_args_args - ) - - set_data_with_many_args_result = await client.invoke(set_data_with_many_args_options) - - set_data_with_many_args_expected = "polywrap apolywrap bpolywrap cpolywrap dpolywrap epolywrap fpolywrap gpolywrap hpolywrap ipolywrap jpolywrap kpolywrap l" - assert set_data_with_many_args_result == set_data_with_many_args_expected - - def create_obj(i: int): - return { - "propA": f"a-{i}", - "propB": f"b-{i}", - "propC": f"c-{i}", - "propD": f"d-{i}", - "propE": f"e-{i}", - "propF": f"f-{i}", - "propG": f"g-{i}", - "propH": f"h-{i}", - "propI": f"i-{i}", - "propJ": f"j-{i}", - "propK": f"k-{i}", - "propL": f"l-{i}" - } - - set_data_with_many_structure_args_args = { - "valueA": create_obj(1), - "valueB": create_obj(2), - "valueC": create_obj(3), - "valueD": create_obj(4), - "valueE": create_obj(5), - "valueF": create_obj(6), - "valueG": create_obj(7), - "valueH": create_obj(8), - "valueI": create_obj(9), - "valueJ": create_obj(10), - "valueK": create_obj(11), - "valueL": create_obj(12), - } - set_data_with_many_structured_args_options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="setDataWithManyStructuredArgs", args=set_data_with_many_structure_args_args - ) - set_data_with_many_structured_args_result = await client.invoke(set_data_with_many_structured_args_options) - assert set_data_with_many_structured_args_result == True diff --git a/packages/polywrap-client/tests/test_bignumber.py b/packages/polywrap-client/tests/test_bignumber.py deleted file mode 100644 index 3c196406..00000000 --- a/packages/polywrap-client/tests/test_bignumber.py +++ /dev/null @@ -1,71 +0,0 @@ -# Polywrap Python Client - https://polywrap.io -# BigNumber wrapper schema - https://wrappers.io/v/ipfs/Qme2YXThmsqtfpiUPHJUEzZSBiqX3woQxxdXbDJZvXrvAD - -from pathlib import Path -from polywrap_client import PolywrapClient -from polywrap_core import Uri, InvokerOptions, UriPackageOrWrapper - - -async def test_invoke_bignumber_1arg_and_1prop(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}' - ) - args = { - "arg1": "123", # The base number - "obj": { - "prop1": "1000", # multiply the base number by this factor - }, - } - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False - ) - result = await client.invoke(options) - assert result == "123000" - - -async def test_invoke_bignumber_with_1arg_and_2props(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}' - ) - args = {"arg1": "123123", "obj": {"prop1": "1000", "prop2": "4"}} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False - ) - result = await client.invoke(options) - assert result == str(123123 * 1000 * 4) - - -async def test_invoke_bignumber_with_2args_and_1prop(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}' - ) - args = {"arg1": "123123", "obj": {"prop1": "1000", "prop2": "444"}} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False - ) - result = await client.invoke(options) - assert result == str(123123 * 1000 * 444) - - -async def test_invoke_bignumber_with_2args_and_2props(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}' - ) - args = {"arg1": "123123", "arg2": "555", "obj": {"prop1": "1000", "prop2": "4"}} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False - ) - result = await client.invoke(options) - assert result == str(123123 * 555 * 1000 * 4) - - -async def test_invoke_bignumber_with_2args_and_2props_floats(client: PolywrapClient): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}' - ) - args = {"arg1": "123.123", "arg2": "55.5", "obj": {"prop1": "10.001", "prop2": "4"}} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="method", args=args, encode_result=False - ) - result = await client.invoke(options) - assert result == str(123.123 * 55.5 * 10.001 * 4) diff --git a/packages/polywrap-client/tests/test_client.py b/packages/polywrap-client/tests/test_client.py deleted file mode 100644 index c79d0406..00000000 --- a/packages/polywrap-client/tests/test_client.py +++ /dev/null @@ -1,195 +0,0 @@ -from pathlib import Path - -from polywrap_client_config_builder import PolywrapClientConfigBuilder -from polywrap_plugin import PluginPackage -from polywrap_client import PolywrapClient -from polywrap_manifest import deserialize_wrap_manifest -from polywrap_core import ( - Uri, - InvokerOptions, - FileReader, - UriPackageOrWrapper, - ClientConfig, -) -from polywrap_uri_resolvers import ( - BaseUriResolver, - FsUriResolver, - SimpleFileReader, - StaticResolver, -) -from polywrap_wasm import WasmWrapper - - -async def test_invoke( - client: PolywrapClient, - simple_file_reader: FileReader, - simple_wrap_module: bytes, - simple_wrap_manifest: bytes, -): - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-invoke").absolute()}' - ) - args = {"arg": "hello polywrap"} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="simpleMethod", args=args, encode_result=False - ) - result = await client.invoke(options) - - assert result == args["arg"] - - manifest = deserialize_wrap_manifest(simple_wrap_manifest) - - wrapper = WasmWrapper( - file_reader=simple_file_reader, - wasm_module=simple_wrap_module, - manifest=manifest, - ) - resolver = StaticResolver({Uri.from_str("ens/wrapper.eth"): wrapper}) - - config = ClientConfig(resolver=resolver) - client = PolywrapClient(config=config) - - args = {"arg": "hello polywrap"} - options = InvokerOptions( - uri=Uri.from_str("ens/wrapper.eth"), - method="simpleMethod", - args=args, - encode_result=False, - ) - result = await client.invoke(options) - - assert result == args["arg"] - - -async def test_subinvoke(): - uri_resolver = BaseUriResolver( - file_reader=SimpleFileReader(), - redirects={ - Uri.from_str("ens/add.eth"): Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-subinvoke", "subinvoke").absolute()}' - ), - }, - ) - - client = PolywrapClient(config=ClientConfig(resolver=uri_resolver)) - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-subinvoke", "invoke").absolute()}' - ) - args = {"a": 1, "b": 2} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="add", args=args, encode_result=False - ) - result = await client.invoke(options) - - assert result == "1 + 2 = 3" - - -async def test_interface_implementation(): - uri_resolver = BaseUriResolver( - file_reader=SimpleFileReader(), - redirects={}, - ) - - interface_uri = Uri.from_str("ens/interface.eth") - impl_uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-interface", "implementation").absolute()}' - ) - - client = PolywrapClient( - config=ClientConfig( - resolver=uri_resolver, interfaces={interface_uri: [impl_uri]} - ) - ) - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-interface", "wrapper").absolute()}' - ) - args = {"arg": {"str": "hello", "uint8": 2}} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="moduleMethod", args=args, encode_result=False - ) - result = await client.invoke(options) - assert client.get_implementations(interface_uri) == [impl_uri] - assert result == {"str": "hello", "uint8": 2} - - -def test_get_env_by_uri(): - uri_resolver = BaseUriResolver( - file_reader=SimpleFileReader(), - redirects={}, - ) - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-env").absolute()}' - ) - env = {"externalArray": [1, 2, 3], "externalString": "hello"} - - client = PolywrapClient( - config=ClientConfig( - envs={uri: env}, - resolver=uri_resolver, - ) - ) - assert client.get_env_by_uri(uri) == env - - -async def test_env(): - uri_resolver = BaseUriResolver( - file_reader=SimpleFileReader(), - redirects={}, - ) - - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "simple-env").absolute()}' - ) - env = {"externalArray": [1, 2, 3], "externalString": "hello"} - - client = PolywrapClient( - config=ClientConfig( - envs={uri: env}, - resolver=uri_resolver, - ) - ) - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, - method="externalEnvMethod", - args={}, - encode_result=False, - ) - - result = await client.invoke(options) - - assert result == env - - -async def test_complex_subinvocation(adder_plugin: PluginPackage[None]): - config = ( - PolywrapClientConfigBuilder() - .add_resolver(FsUriResolver(SimpleFileReader())) - .set_redirect( - Uri.from_str("ens/imported-subinvoke.eth"), - Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "subinvoke", "00-subinvoke").absolute()}' - ), - ) - .set_redirect( - Uri.from_str("ens/imported-invoke.eth"), - Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "subinvoke", "01-invoke").absolute()}' - ), - ) - .set_package( - Uri.from_str("plugin/adder"), - adder_plugin, - ) - ).build() - - client = PolywrapClient(config) - uri = Uri.from_str( - f'fs/{Path(__file__).parent.joinpath("cases", "subinvoke", "02-consumer").absolute()}' - ) - args = {"a": 1, "b": 1} - options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions( - uri=uri, method="addFromPluginAndIncrement", args=args - ) - result = await client.invoke(options) - - assert result == 4 diff --git a/packages/polywrap-client/tests/test_sha3.py b/packages/polywrap-client/tests/test_sha3.py deleted file mode 100644 index d67fcec8..00000000 --- a/packages/polywrap-client/tests/test_sha3.py +++ /dev/null @@ -1,111 +0,0 @@ -# # Polywrap Python Client - https://polywrap.io -# # SHA3 Wrapper Schema - https://wrappers.io/v/ipfs/QmbYw6XfEmNdR3Uoa7u2U1WRqJEXbseiSoBNBt3yPFnKvi - -# from pathlib import Path -# from polywrap_client import PolywrapClient -# from polywrap_core import Uri, InvokerOptions -# import hashlib -# import pytest -# from Crypto.Hash import keccak, SHAKE128, SHAKE256 - -# client = PolywrapClient() -# uri = Uri(f'fs/{Path(__file__).parent.joinpath("cases", "sha3").absolute()}') - -# args = {"message": "hello polywrap!"} - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_sha3_512(): -# options = InvokerOptions(uri=uri, method="sha3_512", args=args, encode_result=False) -# result = await client.invoke(options) -# s = hashlib.sha512() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_sha3_384(): -# options = InvokerOptions(uri=uri, method="sha3_384", args=args, encode_result=False) -# result = await client.invoke(options) -# s = hashlib.sha384() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_sha3_256(): -# options = InvokerOptions(uri=uri, method="sha3_256", args=args, encode_result=False) -# result = await client.invoke(options) -# s = hashlib.sha256() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_sha3_224(): -# options = InvokerOptions(uri=uri, method="sha3_224", args=args, encode_result=False) -# result = await client.invoke(options) -# s = hashlib.sha224() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_keccak_512(): -# options = InvokerOptions(uri=uri, method="keccak_512", args=args, encode_result=False) -# result = await client.invoke(options) -# k = keccak.new(digest_bits=512) -# k.update(b'hello polywrap!') -# assert result.unwrap() == k.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_keccak_384(): -# options = InvokerOptions(uri=uri, method="keccak_384", args=args, encode_result=False) -# result = await client.invoke(options) -# k = keccak.new(digest_bits=384) -# k.update(b'hello polywrap!') -# assert result.unwrap() == k.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_keccak_256(): -# options = InvokerOptions(uri=uri, method="keccak_256", args=args, encode_result=False) -# result = await client.invoke(options) -# k = keccak.new(digest_bits=256) -# k.update(b'hello polywrap!') -# assert result.unwrap() == k.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_keccak_224(): -# options = InvokerOptions(uri=uri, method="keccak_224", args=args, encode_result=False) -# result = await client.invoke(options) -# k = keccak.new(digest_bits=224) -# k.update(b'hello polywrap!') -# assert result.unwrap() == k.digest() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_hex_keccak_256(): -# options = InvokerOptions(uri=uri, method="hex_keccak_256", args=args, encode_result=False) -# result = await client.invoke(options) -# k = keccak.new(digest_bits=256) -# k.update(b'hello polywrap!') -# assert result.unwrap() == k.hexdigest() - -# @pytest.mark.skip(reason="buffer keccak must be implemented in python in order to assert") -# async def test_invoke_buffer_keccak_256(): -# options = InvokerOptions(uri=uri, method="buffer_keccak_256", args=args, encode_result=False) -# result = await client.invoke(options) -# # TODO: Not sure exactly what this function `buffer_keccak_256` is doing in order to assert it properly -# assert result.unwrap() == False - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_shake_256(): -# args = {"message": "hello polywrap!", "outputBits":8} -# options = InvokerOptions(uri=uri, method="shake_256", args=args, encode_result=False) -# result = await client.invoke(options) -# s = SHAKE256.new() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.read(8).hex() - -# @pytest.mark.skip(reason="can't invoke sha3 wrapper due to an error related to wasmtime") -# async def test_invoke_shake_128(): -# args = {"message": "hello polywrap!", "outputBits":8} -# options = InvokerOptions(uri=uri, method="shake_128", args=args, encode_result=False) -# result = await client.invoke(options) -# s = SHAKE128.new() -# s.update(b"hello polywrap!") -# assert result.unwrap() == s.read(8).hex() \ No newline at end of file diff --git a/packages/polywrap-client/tests/test_timer.py b/packages/polywrap-client/tests/test_timer.py deleted file mode 100644 index 435b5050..00000000 --- a/packages/polywrap-client/tests/test_timer.py +++ /dev/null @@ -1,49 +0,0 @@ -# import asyncio -# from typing import Any, Dict - -# from pathlib import Path -# from polywrap_core import Invoker, Uri, InvokerOptions, UriWrapper, Wrapper -# from polywrap_plugin import PluginModule, PluginWrapper -# from polywrap_uri_resolvers import StaticResolver -# from polywrap_manifest import AnyWrapManifest -# from polywrap_result import Result, Ok, Err -# from polywrap_client import PolywrapClient, PolywrapClientConfig -# from pytest import fixture - - -# @fixture -# def timer_module(): -# class TimerModule(PluginModule[None, str]): -# def __init__(self, config: None): -# super().__init__(config) - -# async def sleep(self, args: Dict[str, Any], client: Invoker): -# await asyncio.sleep(args["time"]) -# print(f"Woke up after {args['time']} seconds") -# return Ok(True) - -# return TimerModule(None) - -# @fixture -# def simple_wrap_manifest(): -# wrap_path = Path(__file__).parent / "cases" / "simple-invoke" / "wrap.info" -# with open(wrap_path, "rb") as f: -# yield f.read() - -# @fixture -# def timer_wrapper(timer_module: PluginModule[None, str], simple_wrap_manifest: AnyWrapManifest): -# return PluginWrapper(module=timer_module, manifest=simple_wrap_manifest) - - -# async def test_timer(timer_wrapper: Wrapper): -# uri_wrapper = UriWrapper(uri=Uri("ens/timer.eth"), wrapper=timer_wrapper) -# resolver = StaticResolver.from_list([uri_wrapper]).unwrap() - -# config = PolywrapClientConfig(resolver=resolver) - -# client = PolywrapClient(config) -# uri = Uri('ens/timer.eth') or Uri(f'fs/{Path(__file__).parent.joinpath("cases", "big-number").absolute()}') -# args = { "time": 1 } -# options = InvokerOptions(uri=uri, method="sleep", args=args, encode_result=False) -# result = await client.invoke(options) -# assert result.unwrap() == True diff --git a/packages/polywrap-client/tests/wrap_features/.gitignore b/packages/polywrap-client/tests/wrap_features/.gitignore new file mode 100644 index 00000000..becd6eb0 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/.gitignore @@ -0,0 +1 @@ +!env/ \ No newline at end of file diff --git a/packages/polywrap-client/tests/wrap_features/__init__.py b/packages/polywrap-client/tests/wrap_features/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_features/env/__init__.py b/packages/polywrap-client/tests/wrap_features/env/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_features/env/conftest.py b/packages/polywrap-client/tests/wrap_features/env/conftest.py new file mode 100644 index 00000000..782ce83b --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/env/conftest.py @@ -0,0 +1,90 @@ +from typing import Any, Callable + +import pytest +from polywrap_client_config_builder import PolywrapClientConfigBuilder +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri +from polywrap_test_cases import get_path_to_test_wrappers +from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader + + +@pytest.fixture +def external_wrapper_uri() -> Callable[[str], Uri]: + def get_external_wrapper_uri(implementation: str) -> Uri: + external_wrapper_path = f"{get_path_to_test_wrappers()}/env-type/00-external/implementations/{implementation}" + return Uri.from_str(f"file/{external_wrapper_path}") + + return get_external_wrapper_uri + + +@pytest.fixture +def wrapper_uri() -> Callable[[str], Uri]: + def get_wrapper_uri(implementation: str) -> Uri: + wrapper_path = f"{get_path_to_test_wrappers()}/env-type/01-main/implementations/{implementation}" + return Uri.from_str(f"file/{wrapper_path}") + + return get_wrapper_uri + + +@pytest.fixture +def wrapper_env() -> Any: + return { + "object": { + "prop": "object string", + }, + "str": "string", + "optFilledStr": "optional string", + "number": 10, + "bool": True, + "en": "FIRST", + "array": [32, 23], + } + + +@pytest.fixture +def expected_wrapper_env(wrapper_env: Any) -> Any: + return { + **wrapper_env, + "optStr": None, + "optNumber": None, + "optBool": None, + "optObject": None, + "optEnum": None, + "en": 0, + } + + +@pytest.fixture +def external_wrapper_env() -> Any: + return { + "externalArray": [1, 2, 3], + "externalString": "iamexternal", + } + + +@pytest.fixture +def builder( + wrapper_uri: Callable[[str], Uri], + external_wrapper_uri: Callable[[str], Uri], + wrapper_env: Any, + external_wrapper_env: Any, +) -> Callable[[str], ClientConfigBuilder]: + def get_builder(implementation: str) -> ClientConfigBuilder: + return ( + PolywrapClientConfigBuilder() + .add_env( + wrapper_uri(implementation), + wrapper_env, + ) + .add_env( + external_wrapper_uri(implementation), + external_wrapper_env, + ) + .set_redirect( + Uri.from_str("ens/external-env.polywrap.eth"), + external_wrapper_uri(implementation), + ) + .add_resolver(FsUriResolver(SimpleFileReader())) + ) + + return get_builder diff --git a/packages/polywrap-client/tests/wrap_features/env/test_method_require_env.py b/packages/polywrap-client/tests/wrap_features/env/test_method_require_env.py new file mode 100644 index 00000000..4dae3dda --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/env/test_method_require_env.py @@ -0,0 +1,47 @@ +from typing import Any, Callable + +import pytest +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri + +from polywrap_client import PolywrapClient + +from ...consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_method_require_env( + implementation: str, + builder: Callable[[str], ClientConfigBuilder], + wrapper_uri: Callable[[str], Uri], + wrapper_env: Any, + expected_wrapper_env: Any, +): + client = PolywrapClient(builder(implementation).build()) + method_require_env_result = client.invoke( + uri=wrapper_uri(implementation), + method="methodRequireEnv", + args={ + "arg": "string", + }, + ) + assert method_require_env_result == expected_wrapper_env + + k = { + Uri( + "file", + "/Users/niraj/Documents/Projects/polywrap/python-client/packages/polywrap-test-cases/wrappers/env-type/01-main/implementations/rs", + ): { + "object": {"prop": "object string"}, + "str": "string", + "optFilledStr": "optional string", + "number": 10, + "bool": True, + "en": "FIRST", + "array": [32, 23], + }, + Uri( + "file", + "/Users/niraj/Documents/Projects/polywrap/python-client/packages/polywrap-test-cases/wrappers/env-type/00-external/implementations/rs", + ): {"externalArray": [1, 2, 3], "externalString": "iamexternal"}, + } diff --git a/packages/polywrap-client/tests/wrap_features/env/test_mock_updated_env.py b/packages/polywrap-client/tests/wrap_features/env/test_mock_updated_env.py new file mode 100644 index 00000000..d28b338e --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/env/test_mock_updated_env.py @@ -0,0 +1,39 @@ +from typing import Any, Callable + +import pytest +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri + +from polywrap_client import PolywrapClient + +from ...consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_mock_updated_env( + implementation: str, + builder: Callable[[str], ClientConfigBuilder], + wrapper_uri: Callable[[str], Uri], + expected_wrapper_env: Any, +): + client = PolywrapClient(builder(implementation).build()) + override_env = { + "object": { + "prop": "object another string", + }, + "str": "another string", + "optFilledStr": "optional string", + "number": 10, + "bool": True, + "en": "FIRST", + "array": [32, 23], + } + mock_updated_env_result = client.invoke( + uri=wrapper_uri(implementation), + method="methodRequireEnv", + args={ + "arg": "string", + }, + env=override_env, + ) + assert mock_updated_env_result == {**expected_wrapper_env, **override_env, "en": 0} diff --git a/packages/polywrap-client/tests/wrap_features/env/test_subinvoke_env_method.py b/packages/polywrap-client/tests/wrap_features/env/test_subinvoke_env_method.py new file mode 100644 index 00000000..4f1425fe --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/env/test_subinvoke_env_method.py @@ -0,0 +1,31 @@ +from typing import Any, Callable + +import pytest +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri + +from polywrap_client import PolywrapClient + +from ...consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_subinvoke_env_method( + implementation: str, + builder: Callable[[str], ClientConfigBuilder], + wrapper_uri: Callable[[str], Uri], + expected_wrapper_env: Any, + external_wrapper_env: Any, +): + client = PolywrapClient(builder(implementation).build()) + subinvoke_env_method_result = client.invoke( + uri=wrapper_uri(implementation), + method="subinvokeEnvMethod", + args={ + "arg": "string", + }, + ) + assert subinvoke_env_method_result == { + "local": expected_wrapper_env, + "external": external_wrapper_env, + } diff --git a/packages/polywrap-client/tests/wrap_features/interface_implementations/__init__.py b/packages/polywrap-client/tests/wrap_features/interface_implementations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_features/interface_implementations/conftest.py b/packages/polywrap-client/tests/wrap_features/interface_implementations/conftest.py new file mode 100644 index 00000000..ec603be9 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/interface_implementations/conftest.py @@ -0,0 +1,49 @@ +from typing import Callable + +import pytest +from polywrap_client_config_builder import PolywrapClientConfigBuilder +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri +from polywrap_test_cases import get_path_to_test_wrappers +from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader + + +@pytest.fixture +def interface_uri() -> Uri: + return Uri.from_str("wrap://ens/interface.eth") + + +@pytest.fixture +def implementation_uri() -> Callable[[str], Uri]: + def get_implementation_uri(implementation: str) -> Uri: + implementation_path = f"{get_path_to_test_wrappers()}/interface-invoke/01-implementation/implementations/{implementation}" + return Uri.from_str(f"file/{implementation_path}") + + return get_implementation_uri + + +@pytest.fixture +def wrapper_uri() -> Callable[[str], Uri]: + def get_wrapper_uri(implementation: str) -> Uri: + wrapper_path = f"{get_path_to_test_wrappers()}/interface-invoke/02-wrapper/implementations/{implementation}" + return Uri.from_str(f"file/{wrapper_path}") + + return get_wrapper_uri + + +@pytest.fixture +def builder( + interface_uri: Uri, + implementation_uri: Callable[[str], Uri], +) -> Callable[[str], ClientConfigBuilder]: + def get_builder(implementation: str) -> ClientConfigBuilder: + return ( + PolywrapClientConfigBuilder() + .add_interface_implementations( + interface_uri=interface_uri, + implementations_uris=[implementation_uri(implementation)] + ) + .add_resolver(FsUriResolver(SimpleFileReader())) + ) + + return get_builder diff --git a/packages/polywrap-client/tests/wrap_features/interface_implementations/test_get_implementations.py b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_get_implementations.py new file mode 100644 index 00000000..3129b1ed --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_get_implementations.py @@ -0,0 +1,42 @@ +import pytest +from polywrap_core import Uri +from polywrap_client import PolywrapClient +from polywrap_client_config_builder import PolywrapClientConfigBuilder + + + +def test_get_all_implementations_of_interface(): + interface1_uri = Uri.from_str("wrap://ens/some-interface1.eth") + interface2_uri = Uri.from_str("wrap://ens/some-interface2.eth") + interface3_uri = Uri.from_str("wrap://ens/some-interface3.eth") + + implementation1_uri = Uri.from_str("wrap://ens/some-implementation.eth") + implementation2_uri = Uri.from_str("wrap://ens/some-implementation2.eth") + implementation3_uri = Uri.from_str("wrap://ens/some-implementation3.eth") + implementation4_uri = Uri.from_str("wrap://ens/some-implementation4.eth") + + builder = ( + PolywrapClientConfigBuilder() + .set_redirect(interface1_uri, interface2_uri) + .set_redirect(implementation1_uri, implementation2_uri) + .set_redirect(implementation2_uri, implementation3_uri) + .set_package(implementation4_uri, NotImplemented) + .add_interface_implementations(interface1_uri, [implementation1_uri, implementation2_uri]) + .add_interface_implementations(interface2_uri, [implementation3_uri]) + .add_interface_implementations(interface3_uri, [implementation3_uri, implementation4_uri]) + ) + + + client = PolywrapClient(builder.build()) + + implementations1 = client.get_implementations(interface1_uri) + implementations2 = client.get_implementations(interface2_uri) + implementations3 = client.get_implementations(interface3_uri) + + assert implementations1 is not None + assert implementations2 is not None + assert implementations3 is not None + + assert set(implementations1) == {implementation1_uri, implementation2_uri, implementation3_uri} + assert set(implementations2) == {implementation1_uri, implementation2_uri, implementation3_uri} + assert set(implementations3) == {implementation3_uri, implementation4_uri} diff --git a/packages/polywrap-client/tests/wrap_features/interface_implementations/test_implementation_register.py b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_implementation_register.py new file mode 100644 index 00000000..dda01a32 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_implementation_register.py @@ -0,0 +1,31 @@ +import pytest +from polywrap_core import Uri +from polywrap_client import PolywrapClient +from polywrap_client_config_builder import PolywrapClientConfigBuilder + + +def test_register_interface_implementations(): + interface_uri = Uri.from_str("wrap://ens/some-interface1.eth") + implementation1_uri = Uri.from_str("wrap://ens/some-implementation1.eth") + implementation2_uri = Uri.from_str("wrap://ens/some-implementation2.eth") + + builder = ( + PolywrapClientConfigBuilder() + .add_interface_implementations( + interface_uri, [implementation1_uri, implementation2_uri] + ) + .set_redirect(Uri.from_str("uri/foo"), Uri.from_str("uri/bar")) + ) + + client = PolywrapClient(builder.build()) + + interfaces = client.get_interfaces() + + assert interfaces == {interface_uri: [implementation1_uri, implementation2_uri]} + + implementations = client.get_implementations( + interface_uri + ) + + assert implementations is not None + assert set(implementations) == {implementation1_uri, implementation2_uri} diff --git a/packages/polywrap-client/tests/wrap_features/interface_implementations/test_interface_invoke.py b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_interface_invoke.py new file mode 100644 index 00000000..8c687ae0 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/interface_implementations/test_interface_invoke.py @@ -0,0 +1,32 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ...consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_interface_invoke( + implementation: str, + builder: Callable[[str], ClientConfigBuilder], + wrapper_uri: Callable[[str], Uri], +): + client = PolywrapClient(builder(implementation).build()) + + result = client.invoke( + uri=wrapper_uri(implementation), + method="moduleMethod", + args={ + "arg": { + "uint8": 1, + "str": "Test String 1", + }, + }, + ) + + assert result == { + "uint8": 1, + "str": "Test String 1", + } diff --git a/packages/polywrap-client/tests/wrap_features/subinvoke/__init__.py b/packages/polywrap-client/tests/wrap_features/subinvoke/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_features/subinvoke/conftest.py b/packages/polywrap-client/tests/wrap_features/subinvoke/conftest.py new file mode 100644 index 00000000..2eaba63a --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/subinvoke/conftest.py @@ -0,0 +1,43 @@ +from typing import Callable + +import pytest +from polywrap_client_config_builder import PolywrapClientConfigBuilder +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri +from polywrap_test_cases import get_path_to_test_wrappers +from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader + + +@pytest.fixture +def subinvoke_wrapper_uri() -> Callable[[str], Uri]: + def get_subinvoke_wrapper_uri(implementation: str) -> Uri: + subinvoke_wrapper_path = f"{get_path_to_test_wrappers()}/subinvoke/00-subinvoke/implementations/{implementation}" + return Uri.from_str(f"file/{subinvoke_wrapper_path}") + + return get_subinvoke_wrapper_uri + + +@pytest.fixture +def wrapper_uri() -> Callable[[str], Uri]: + def get_wrapper_uri(implementation: str) -> Uri: + wrapper_path = f"{get_path_to_test_wrappers()}/subinvoke/01-invoke/implementations/{implementation}" + return Uri.from_str(f"file/{wrapper_path}") + + return get_wrapper_uri + + +@pytest.fixture +def builder( + subinvoke_wrapper_uri: Callable[[str], Uri], +) -> Callable[[str], ClientConfigBuilder]: + def get_builder(implementation: str) -> ClientConfigBuilder: + return ( + PolywrapClientConfigBuilder() + .set_redirect( + Uri.from_str("ens/imported-subinvoke.eth"), + subinvoke_wrapper_uri(implementation), + ) + .add_resolver(FsUriResolver(SimpleFileReader())) + ) + + return get_builder diff --git a/packages/polywrap-client/tests/wrap_features/subinvoke/test_subinvoke.py b/packages/polywrap-client/tests/wrap_features/subinvoke/test_subinvoke.py new file mode 100644 index 00000000..fbc7d4dd --- /dev/null +++ b/packages/polywrap-client/tests/wrap_features/subinvoke/test_subinvoke.py @@ -0,0 +1,24 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri +import pytest + +from ...consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_subinvoke( + implementation: str, + builder: Callable[[str], ClientConfigBuilder], + wrapper_uri: Callable[[str], Uri], +): + client = PolywrapClient(builder(implementation).build()) + + result = client.invoke( + uri=wrapper_uri(implementation), + method="addAndIncrement", + args={"a": 1, "b": 1}, + ) + + assert result == 3 diff --git a/packages/polywrap-client/tests/wrap_types/__init__.py b/packages/polywrap-client/tests/wrap_types/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_types/asyncify/__init__.py b/packages/polywrap-client/tests/wrap_types/asyncify/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/wrap_types/asyncify/conftest.py b/packages/polywrap-client/tests/wrap_types/asyncify/conftest.py new file mode 100644 index 00000000..16650bdf --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/asyncify/conftest.py @@ -0,0 +1,54 @@ +import time +from typing import Any, Callable, Dict +from polywrap_test_cases import get_path_to_test_wrappers + +import pytest +from polywrap_client_config_builder import PolywrapClientConfigBuilder +from polywrap_client_config_builder.types import ClientConfigBuilder +from polywrap_core import Uri +from polywrap_plugin import PluginModule, PluginPackage +from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader + + +class MemoryStoragePlugin(PluginModule[None]): + def __init__(self): + super().__init__(None) + self._value = None + + def getData(self, *_: Any) -> Any: + self.sleep(0.005) + return self._value + + def setData(self, args: Dict[str, Any], *_:Any) -> bool: + self.sleep(0.005) + self._value = args["value"] + return True + + def sleep(self, seconds: float) -> None: + time.sleep(seconds) + + +def memory_storage_plugin() -> PluginPackage[None]: + return PluginPackage(manifest=NotImplemented, module=MemoryStoragePlugin()) + + +@pytest.fixture +def wrapper_uri() -> Callable[[str], Uri]: + def get_subinvoke_wrapper_uri(implementation: str) -> Uri: + subinvoke_wrapper_path = f"{get_path_to_test_wrappers()}/asyncify/implementations/{implementation}" + return Uri.from_str(f"file/{subinvoke_wrapper_path}") + + return get_subinvoke_wrapper_uri + + +@pytest.fixture +def builder() -> ClientConfigBuilder: + return ( + PolywrapClientConfigBuilder() + .set_package( + Uri.from_str("ens/memory-storage.polywrap.eth"), + memory_storage_plugin(), + ) + .add_resolver(FsUriResolver(SimpleFileReader())) + ) + diff --git a/packages/polywrap-client/tests/wrap_types/asyncify/test_asyncify.py b/packages/polywrap-client/tests/wrap_types/asyncify/test_asyncify.py new file mode 100644 index 00000000..ef40a752 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/asyncify/test_asyncify.py @@ -0,0 +1,130 @@ +from typing import Callable, Dict +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ...consts import SUPPORTED_IMPLEMENTATIONS + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_subsequent_invokes(implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri]): + client = PolywrapClient(builder.build()) + subsequent_invokes = client.invoke( + uri=wrapper_uri(implementation), + method="subsequentInvokes", + args={ + "numberOfTimes": 40, + }, + ) + + expected = [str(index) for index in range(40)] + assert subsequent_invokes == expected + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_local_var_method(implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri]): + client = PolywrapClient(builder.build()) + localVarMethod = client.invoke( + uri=wrapper_uri(implementation), + method="localVarMethod", + ) + + assert localVarMethod == True + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_global_var_method(implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri]): + client = PolywrapClient(builder.build()) + globalVarMethod = client.invoke( + uri=wrapper_uri(implementation), + method="globalVarMethod", + ) + + assert globalVarMethod == True + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_set_data_with_large_args(implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri]): + client = PolywrapClient(builder.build()) + large_str = "polywrap " * 10000 + + setDataWithLargeArgs = client.invoke( + uri=wrapper_uri(implementation), + method="setDataWithLargeArgs", + args={ + "value": large_str, + }, + ) + + assert setDataWithLargeArgs == large_str + + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_set_data_with_many_args(implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri]): + client = PolywrapClient(builder.build()) + args = { + "valueA": "polywrap a", + "valueB": "polywrap b", + "valueC": "polywrap c", + "valueD": "polywrap d", + "valueE": "polywrap e", + "valueF": "polywrap f", + "valueG": "polywrap g", + "valueH": "polywrap h", + "valueI": "polywrap i", + "valueJ": "polywrap j", + "valueK": "polywrap k", + "valueL": "polywrap l", + } + + setDataWithManyArgs = client.invoke( + uri=wrapper_uri(implementation), + method="setDataWithManyArgs", + args=args, + ) + + expected = "polywrap apolywrap bpolywrap cpolywrap dpolywrap epolywrap fpolywrap gpolywrap hpolywrap ipolywrap jpolywrap kpolywrap l" + assert setDataWithManyArgs == expected + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_set_data_with_many_structured_args( + implementation: str, builder: ClientConfigBuilder, wrapper_uri: Callable[[str], Uri] +): + client = PolywrapClient(builder.build()) + create_obj: Callable[[int], Dict[str, str]] = lambda i: { + "propA": f"a-{i}", + "propB": f"b-{i}", + "propC": f"c-{i}", + "propD": f"d-{i}", + "propE": f"e-{i}", + "propF": f"f-{i}", + "propG": f"g-{i}", + "propH": f"h-{i}", + "propI": f"i-{i}", + "propJ": f"j-{i}", + "propK": f"k-{i}", + "propL": f"l-{i}", + } + args = { + "valueA": create_obj(1), + "valueB": create_obj(2), + "valueC": create_obj(3), + "valueD": create_obj(4), + "valueE": create_obj(5), + "valueF": create_obj(6), + "valueG": create_obj(7), + "valueH": create_obj(8), + "valueI": create_obj(9), + "valueJ": create_obj(10), + "valueK": create_obj(11), + "valueL": create_obj(12), + } + + setDataWithManyStructuredArgs = client.invoke( + uri=wrapper_uri(implementation), + method="setDataWithManyStructuredArgs", + args=args, + ) + + assert setDataWithManyStructuredArgs == True diff --git a/packages/polywrap-client/tests/wrap_types/conftest.py b/packages/polywrap-client/tests/wrap_types/conftest.py new file mode 100644 index 00000000..6fde8d48 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/conftest.py @@ -0,0 +1,24 @@ +from typing import Callable + +import pytest +from polywrap_client_config_builder import ( + ClientConfigBuilder, + PolywrapClientConfigBuilder, +) +from polywrap_core import Uri +from polywrap_test_cases import get_path_to_test_wrappers +from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader + + +@pytest.fixture +def builder() -> ClientConfigBuilder: + return PolywrapClientConfigBuilder().add_resolver(FsUriResolver(SimpleFileReader())) + + +@pytest.fixture +def wrapper_uri() -> Callable[[str, str], Uri]: + def get_wrapper_uri(wrapper_name: str, implementation: str) -> Uri: + wrapper_path = f"{get_path_to_test_wrappers()}/{wrapper_name}/implementations/{implementation}" + return Uri.from_str(f"file/{wrapper_path}") + + return get_wrapper_uri diff --git a/packages/polywrap-client/tests/wrap_types/test_bigint.py b/packages/polywrap-client/tests/wrap_types/test_bigint.py new file mode 100644 index 00000000..4bb9e01d --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_bigint.py @@ -0,0 +1,51 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_bigint_method_with_arg1_and_obj( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("bigint-type", implementation) + + arg1 = "123456789123456789" + prop1 = "987654321987654321" + + response = client.invoke( + uri=uri, method="method", args={"arg1": arg1, "obj": {"prop1": prop1}} + ) + + result = int(arg1) * int(prop1) + assert response == str(result) + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_bigint_method_with_arg1_arg2_and_obj( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("bigint-type", implementation) + + arg1 = "123456789123456789" + arg2 = "123456789123456789123456789123456789" + prop1 = "987654321987654321" + prop2 = "987654321987654321987654321987654321" + + response = client.invoke( + uri=uri, + method="method", + args={"arg1": arg1, "arg2": arg2, "obj": {"prop1": prop1, "prop2": prop2}}, + ) + + result = int(arg1) * int(arg2) * int(prop1) * int(prop2) + assert response == str(result) diff --git a/packages/polywrap-client/tests/wrap_types/test_bignumber.py b/packages/polywrap-client/tests/wrap_types/test_bignumber.py new file mode 100644 index 00000000..1189830c --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_bignumber.py @@ -0,0 +1,81 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_bignumber_method_with_arg1_and_obj( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("bignumber-type", implementation) + + arg1 = "1234.56789123456789" + prop1 = "98.7654321987654321" + + response = client.invoke( + uri=uri, + method="method", + args={ + "arg1": arg1, + "obj": { + "prop1": prop1, + }, + }, + ) + + import decimal + decimal.getcontext().prec = len(response) + + arg1 = decimal.Decimal(arg1) + prop1 = decimal.Decimal(prop1) + result = arg1 * prop1 + + + assert response == str(result) + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_bignumber_method_with_arg1_arg2_and_obj( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("bignumber-type", implementation) + + arg1 = "1234567.89123456789" + arg2 = "123456789123.456789123456789123456789" + prop1 = "987654.321987654321" + prop2 = "987.654321987654321987654321987654321" + + response = client.invoke( + uri=uri, + method="method", + args={ + "arg1": arg1, + "arg2": arg2, + "obj": { + "prop1": prop1, + "prop2": prop2, + }, + }, + ) + + import decimal + + decimal.getcontext().prec = len(response) + + arg1 = decimal.Decimal(arg1) + arg2 = decimal.Decimal(arg2) + prop1 = decimal.Decimal(prop1) + prop2 = decimal.Decimal(prop2) + result = arg1 * arg2 * prop1 * prop2 + + assert response == str(result) diff --git a/packages/polywrap-client/tests/wrap_types/test_bytes.py b/packages/polywrap-client/tests/wrap_types/test_bytes.py new file mode 100644 index 00000000..2c7e5f39 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_bytes.py @@ -0,0 +1,33 @@ +from typing import Callable, Dict +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_bytes( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("bytes-type", implementation) + + prop = b"hello world" + expected = b"hello world Sanity!" + + response: bytes = client.invoke( + uri=uri, + method="bytesMethod", + args={ + "arg": { + "prop": prop, + } + }, + ) + + assert response == expected + diff --git a/packages/polywrap-client/tests/wrap_types/test_enum.py b/packages/polywrap-client/tests/wrap_types/test_enum.py new file mode 100644 index 00000000..23c1d141 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_enum.py @@ -0,0 +1,91 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri, WrapAbortError +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_required_enum( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("enum-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="method1", + args={ + "en": 5, + } + ) + + assert "Invalid value for enum 'SanityEnum': 5" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_valid_enum( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("enum-type", implementation) + + response = client.invoke( + uri=uri, + method="method1", + args={ + "en": 2, + "optEnum": 1, + } + ) + + assert response == 2 + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_optional_enum( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("enum-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="method1", + args={ + "en": 2, + "optEnum": "INVALID", + } + ) + + assert "Invalid key for enum 'SanityEnum': INVALID" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_valid_enum_array( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("enum-type", implementation) + + response = client.invoke( + uri=uri, + method="method2", + args={ + "enumArray": ["OPTION1", 0, "OPTION3"], + } + ) + + assert response == [0, 0, 2] diff --git a/packages/polywrap-client/tests/wrap_types/test_invalid_type.py b/packages/polywrap-client/tests/wrap_types/test_invalid_type.py new file mode 100644 index 00000000..89ce532f --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_invalid_type.py @@ -0,0 +1,83 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri, WrapAbortError +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_bool( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("invalid-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="boolMethod", + args={"arg": 10}, + ) + + assert "Property must be of type 'bool'. Found 'int'." in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_int( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("invalid-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="intMethod", + args={"arg": "10"}, + ) + + assert "Property must be of type 'int'. Found 'string'." in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_bytes( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("invalid-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="bytesMethod", + args={"arg": 10.23}, + ) + + assert "Property must be of type 'bytes'. Found 'float64'." in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_array( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("invalid-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="arrayMethod", + args={"arg": {"prop": 1}}, + ) + + assert "Property must be of type 'array'. Found 'map'." in err.value.args[0] diff --git a/packages/polywrap-client/tests/wrap_types/test_json.py b/packages/polywrap-client/tests/wrap_types/test_json.py new file mode 100644 index 00000000..8c96d589 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_json.py @@ -0,0 +1,53 @@ +import json +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_json_parse( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("json-type", implementation) + value = { "foo": "bar", "bar": "bar" } + json_value = json.dumps(value) + + response = client.invoke( + uri=uri, + method="parse", + args={ + "value": json_value, + }, + ) + + assert json.loads(response) == value + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_json_stringify( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("json-type", implementation) + values = [json.dumps({"bar": "foo"}), json.dumps({"foo": "bar"})] + + response = client.invoke( + uri=uri, + method="stringify", + args={ + "values": values, + }, + ) + + # Note: python json.dumps() adds a space after the colon, + # but the JS implementation does not. + assert response.replace(":", ": ") == "".join(values) diff --git a/packages/polywrap-client/tests/wrap_types/test_map.py b/packages/polywrap-client/tests/wrap_types/test_map.py new file mode 100644 index 00000000..565f26b0 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_map.py @@ -0,0 +1,124 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_msgpack import GenericMap +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_return_map_when_map( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("map-type", implementation) + map_value = GenericMap({"Hello": 1, "World": 2}) + + response = client.invoke( + uri=uri, + method="returnMap", + args={ + "map": map_value, + }, + ) + + assert response == map_value + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_return_map_when_dict( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("map-type", implementation) + map_value = {"Hello": 1, "World": 2} + + response = client.invoke( + uri=uri, + method="returnMap", + args={ + "map": map_value, + }, + ) + + assert response == GenericMap(map_value) + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_get_key( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("map-type", implementation) + map_value = {"Hello": 1, "World": 2} + nested_map_value = {"Nested": map_value} + + response = client.invoke( + uri=uri, + method="getKey", + args={ + "foo": { + "map": map_value, + "nestedMap": nested_map_value, + }, + "key": "Hello", + }, + ) + + assert response == 1 + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_return_custom_map( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("map-type", implementation) + map_value = GenericMap({"Hello": 1, "World": 2}) + nested_map_value = GenericMap({"Nested": map_value}) + foo = { + "map": map_value, + "nestedMap": nested_map_value, + } + + response = client.invoke( + uri=uri, + method="returnCustomMap", + args={ + "foo": foo, + }, + ) + + assert response == foo + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_return_nested_map( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("map-type", implementation) + map_value = GenericMap({"Hello": 1, "World": 2}) + nested_map_value = GenericMap({"Nested": map_value}) + + response = client.invoke( + uri=uri, + method="returnNestedMap", + args={ + "foo": nested_map_value, + }, + ) + + assert response == nested_map_value diff --git a/packages/polywrap-client/tests/wrap_types/test_numbers.py b/packages/polywrap-client/tests/wrap_types/test_numbers.py new file mode 100644 index 00000000..949b5cbd --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_numbers.py @@ -0,0 +1,139 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri, WrapAbortError +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_int8( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="i8Method", + args={ + "first": -129, + "second": 10, + } + ) + + assert "integer overflow: value = -129; bits = 8" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_uint8( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="u8Method", + args={ + "first": 256, + "second": 10, + } + ) + + assert "integer overflow: value = 256; bits = 8" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_int16( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="i16Method", + args={ + "first": -32769, + "second": 10, + } + ) + + assert "integer overflow: value = -32769; bits = 16" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_uint16( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="u16Method", + args={ + "first": 65536, + "second": 10, + } + ) + + assert "integer overflow: value = 65536; bits = 16" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_int32( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="i32Method", + args={ + "first": -2147483649, + "second": 10, + } + ) + + assert "integer overflow: value = -2147483649; bits = 32" in err.value.args[0] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_invalid_uint32( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("numbers-type", implementation) + + with pytest.raises(WrapAbortError) as err: + client.invoke( + uri=uri, + method="u32Method", + args={ + "first": 4294967296, + "second": 10, + } + ) + + assert "integer overflow: value = 4294967296; bits = 32" in err.value.args[0] diff --git a/packages/polywrap-client/tests/wrap_types/test_object.py b/packages/polywrap-client/tests/wrap_types/test_object.py new file mode 100644 index 00000000..71c62925 --- /dev/null +++ b/packages/polywrap-client/tests/wrap_types/test_object.py @@ -0,0 +1,118 @@ +from typing import Callable +from polywrap_client import PolywrapClient +from polywrap_core import Uri +from polywrap_client_config_builder.types import ClientConfigBuilder +import pytest + +from ..consts import SUPPORTED_IMPLEMENTATIONS + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_object_method1( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("object-type", implementation) + obj = { + "arg1": { + "prop": "arg1 prop", + "nested": { + "prop": "arg1 nested prop", + }, + } + } + + response = client.invoke( + uri=uri, + method="method1", + args=obj, + ) + + assert response == [obj["arg1"], { + "prop": "", + "nested": { + "prop": "", + }, + }] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_object_method2( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("object-type", implementation) + obj = { + "arg": { + "prop": "null", + "nested": { + "prop": "arg nested prop", + }, + } + } + + response = client.invoke( + uri=uri, + method="method2", + args=obj, + ) + + assert response is None + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_object_method3( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("object-type", implementation) + obj = { + "arg": { + "prop": "arg prop", + "nested": { + "prop": "arg nested prop", + }, + } + } + + response = client.invoke( + uri=uri, + method="method3", + args=obj, + ) + + assert response == [None, obj["arg"]] + + +@pytest.mark.parametrize("implementation", SUPPORTED_IMPLEMENTATIONS) +def test_object_method4( + implementation: str, + builder: ClientConfigBuilder, + wrapper_uri: Callable[[str, str], Uri], +): + client = PolywrapClient(builder.build()) + uri = wrapper_uri("object-type", implementation) + obj = { + "arg": { + "prop": [49, 50, 51, 52], + } + } + + response = client.invoke( + uri=uri, + method="method4", + args=obj, + ) + + assert response == { + "prop": "1234", + "nested": { + "prop": "nested prop", + }, + } diff --git a/packages/polywrap-client/tox.ini b/packages/polywrap-client/tox.ini index 864ed32f..742e4c19 100644 --- a/packages/polywrap-client/tox.ini +++ b/packages/polywrap-client/tox.ini @@ -4,6 +4,7 @@ envlist = py310 [testenv] commands = + python -m polywrap_test_cases pytest tests/ [testenv:lint] diff --git a/packages/polywrap-core/poetry.lock b/packages/polywrap-core/poetry.lock index 5c855385..80d92f84 100644 --- a/packages/polywrap-core/poetry.lock +++ b/packages/polywrap-core/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.5" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.5-py3-none-any.whl", hash = "sha256:078e5212f9885fa85fbb0cf0101978a336190aadea6e13305409d099f71b2324"}, + {file = "astroid-2.15.5.tar.gz", hash = "sha256:1039262575027b441137ab4a62a793a9b43defb42c32d5670f38686207cd780f"}, ] [package.dependencies] @@ -151,19 +151,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -455,14 +455,14 @@ files = [ [[package]] name = "nodeenv" -version = "1.7.0" +version = "1.8.0" description = "Node.js virtual environment builder" category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ - {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, - {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, ] [package.dependencies] @@ -506,19 +506,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, + {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -542,15 +542,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -558,14 +560,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "py" @@ -651,21 +655,6 @@ typing-extensions = ">=4.2.0" dotenv = ["python-dotenv (>=0.10.4)"] email = ["email-validator (>=1.0.3)"] -[[package]] -name = "pydeps" -version = "1.12.1" -description = "Display module dependencies" -category = "dev" -optional = false -python-versions = "*" -files = [ - {file = "pydeps-1.12.1-py3-none-any.whl", hash = "sha256:aa8d307b31434e451f4b505ffc3cf280996eaae35bee85b59c8e80a3f8d51014"}, - {file = "pydeps-1.12.1.tar.gz", hash = "sha256:fc3aa0c02c0ac2d7a0caea869d47b6b4aaf4b15d41a1b79a1c529189efb86e13"}, -] - -[package.dependencies] -stdlib-list = "*" - [[package]] name = "pydocstyle" version = "6.3.0" @@ -686,14 +675,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -701,18 +690,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -730,14 +719,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.309" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.309-py3-none-any.whl", hash = "sha256:a8b052c1997f7334e80074998ea0f93bd149550e8cf27ccb5481d3b2e1aad161"}, + {file = "pyright-1.1.309.tar.gz", hash = "sha256:1abcfa83814d792a5d70b38621cc6489acfade94ebb2279e55ba1f394d54296c"}, ] [package.dependencies] @@ -770,24 +759,6 @@ tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] -[[package]] -name = "pytest-asyncio" -version = "0.19.0" -description = "Pytest support for asyncio" -category = "dev" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pytest-asyncio-0.19.0.tar.gz", hash = "sha256:ac4ebf3b6207259750bc32f4c1d8fcd7e79739edbc67ad0c58dd150b1d072fed"}, - {file = "pytest_asyncio-0.19.0-py3-none-any.whl", hash = "sha256:7a97e37cfe1ed296e2e84941384bdd37c376453912d397ed39293e0916f521fa"}, -] - -[package.dependencies] -pytest = ">=6.1.0" - -[package.extras] -testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] - [[package]] name = "pyyaml" version = "6.0" @@ -840,14 +811,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -859,19 +830,19 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.8.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] @@ -910,31 +881,16 @@ files = [ {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, ] -[[package]] -name = "stdlib-list" -version = "0.8.0" -description = "A list of Python Standard Libraries (2.6-7, 3.2-9)." -category = "dev" -optional = false -python-versions = "*" -files = [ - {file = "stdlib-list-0.8.0.tar.gz", hash = "sha256:a1e503719720d71e2ed70ed809b385c60cd3fb555ba7ec046b96360d30b16d9f"}, - {file = "stdlib_list-0.8.0-py3-none-any.whl", hash = "sha256:2ae0712a55b68f3fbbc9e58d6fa1b646a062188f49745b495f94d3310a9fdd3e"}, -] - -[package.extras] -develop = ["sphinx"] - [[package]] name = "stevedore" -version = "5.0.0" +version = "5.1.0" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false python-versions = ">=3.8" files = [ - {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, - {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, + {file = "stevedore-5.1.0-py3-none-any.whl", hash = "sha256:8cc040628f3cea5d7128f2e76cf486b2251a4e543c7b938f58d9a377f6694a2d"}, + {file = "stevedore-5.1.0.tar.gz", hash = "sha256:a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c"}, ] [package.dependencies] @@ -966,14 +922,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1045,14 +1001,14 @@ test = ["black (>=22.3.0,<23.0.0)", "coverage (>=6.2,<7.0)", "isort (>=5.0.6,<6. [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.0" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.0-py3-none-any.whl", hash = "sha256:6ad00b63f849b7dcc313b70b6b304ed67b2b2963b3098a33efe18056b1a9a223"}, + {file = "typing_extensions-4.6.0.tar.gz", hash = "sha256:ff6b238610c747e44c268aa4bb23c8c735d665a63726df3f9431ce707f2aa768"}, ] [[package]] @@ -1073,24 +1029,24 @@ typing-extensions = ">=3.7.4" [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wrapt" @@ -1180,4 +1136,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "3b2fca101f9a8890d57f4ad962c2512fd18d826ad4ec6ab733c9d050f15640b1" +content-hash = "bd0557df35270b1dcdb727e3505fbd3bdd1afaed488458de3346783456248e00" diff --git a/packages/polywrap-core/polywrap_core/types/__init__.py b/packages/polywrap-core/polywrap_core/types/__init__.py index 219b5d5f..4559c269 100644 --- a/packages/polywrap-core/polywrap_core/types/__init__.py +++ b/packages/polywrap-core/polywrap_core/types/__init__.py @@ -1,16 +1,13 @@ """This module contains all the core types used in the various polywrap packages.""" +from .clean_resolution_step import * from .client import * from .config import * -from .env import * from .errors import * from .file_reader import * from .invocable import * -from .invoke_args import * from .invoker import * from .invoker_client import * -from .options import * from .uri import * -from .uri_like import * from .uri_package import * from .uri_package_wrapper import * from .uri_resolution_context import * diff --git a/packages/polywrap-core/polywrap_core/types/clean_resolution_step.py b/packages/polywrap-core/polywrap_core/types/clean_resolution_step.py new file mode 100644 index 00000000..9b14e766 --- /dev/null +++ b/packages/polywrap-core/polywrap_core/types/clean_resolution_step.py @@ -0,0 +1,4 @@ +"""This module contains CleanResolutionStep type.""" +from typing import List, Union + +CleanResolutionStep = List[Union[str, "CleanResolutionStep"]] diff --git a/packages/polywrap-core/polywrap_core/types/client.py b/packages/polywrap-core/polywrap_core/types/client.py index b73fa72c..02dc27dd 100644 --- a/packages/polywrap-core/polywrap_core/types/client.py +++ b/packages/polywrap-core/polywrap_core/types/client.py @@ -1,25 +1,19 @@ """This module contains the Client interface.""" from __future__ import annotations -from abc import abstractmethod -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Protocol, Union -from polywrap_manifest import AnyWrapManifest +from polywrap_manifest import AnyWrapManifest, DeserializeManifestOptions -from .env import Env from .invoker_client import InvokerClient -from .options.file_options import GetFileOptions -from .options.manifest_options import GetManifestOptions from .uri import Uri -from .uri_package_wrapper import UriPackageOrWrapper from .uri_resolver import UriResolver -class Client(InvokerClient[UriPackageOrWrapper]): - """Client interface defines core set of functionalities\ +class Client(InvokerClient, Protocol): + """Client protocol defines core set of functionalities\ for interacting with a wrapper.""" - @abstractmethod def get_interfaces(self) -> Dict[Uri, List[Uri]]: """Get dictionary of interfaces and their implementations. @@ -27,57 +21,64 @@ def get_interfaces(self) -> Dict[Uri, List[Uri]]: Dict[Uri, List[Uri]]: Dictionary of interfaces and their implementations where\ key is interface URI and value is list of implementation uris. """ + ... - @abstractmethod - def get_envs(self) -> Dict[Uri, Env]: + def get_envs(self) -> Dict[Uri, Any]: """Get dictionary of environments. Returns: - Dict[Uri, Env]: Dictionary of environments where key is URI and value is env. + Dict[Uri, Any]: Dictionary of environments where key is URI and value is env. """ + ... - @abstractmethod - def get_env_by_uri(self, uri: Uri) -> Union[Env, None]: + def get_env_by_uri(self, uri: Uri) -> Union[Any, None]: """Get environment by URI. Args: uri (Uri): URI of the Wrapper. Returns: - Union[Env, None]: env if found, otherwise None. + Union[Any, None]: env if found, otherwise None. """ + ... - @abstractmethod def get_uri_resolver(self) -> UriResolver: """Get URI resolver. Returns: - IUriResolver: URI resolver. + UriResolver: URI resolver. """ + ... - @abstractmethod - async def get_file(self, uri: Uri, options: GetFileOptions) -> Union[bytes, str]: + def get_file( + self, uri: Uri, path: str, encoding: Optional[str] = "utf-8" + ) -> Union[bytes, str]: """Get file from URI. Args: uri (Uri): URI of the wrapper. - options (GetFileOptions): Options for getting file from the wrapper. + path (str): Path to the file. + encoding (Optional[str]): Encoding of the file. Returns: Union[bytes, str]]: file contents. """ + ... - @abstractmethod - async def get_manifest( - self, uri: Uri, options: Optional[GetManifestOptions] = None + def get_manifest( + self, uri: Uri, options: Optional[DeserializeManifestOptions] = None ) -> AnyWrapManifest: """Get manifest from URI. Args: uri (Uri): URI of the wrapper. - options (Optional[GetManifestOptions]): \ + options (Optional[DeserializeManifestOptions]): \ Options for getting manifest from the wrapper. Returns: AnyWrapManifest: Manifest of the wrapper. """ + ... + + +__all__ = ["Client"] diff --git a/packages/polywrap-core/polywrap_core/types/config.py b/packages/polywrap-core/polywrap_core/types/config.py index 97afe12c..9673fcaf 100644 --- a/packages/polywrap-core/polywrap_core/types/config.py +++ b/packages/polywrap-core/polywrap_core/types/config.py @@ -2,19 +2,18 @@ from __future__ import annotations from dataclasses import dataclass, field -from typing import Dict, List +from typing import Any, Dict, List -from .env import Env from .uri import Uri from .uri_resolver import UriResolver @dataclass(slots=True, kw_only=True) class ClientConfig: - """Client configuration. + """Defines Client configuration dataclass. - Attributes: - envs (Dict[Uri, Env]): Dictionary of environments \ + Args: + envs (Dict[Uri, Any]): Dictionary of environments \ where key is URI and value is env. interfaces (Dict[Uri, List[Uri]]): Dictionary of interfaces \ and their implementations where key is interface URI \ @@ -22,6 +21,9 @@ class ClientConfig: resolver (UriResolver): URI resolver. """ - envs: Dict[Uri, Env] = field(default_factory=dict) + envs: Dict[Uri, Any] = field(default_factory=dict) interfaces: Dict[Uri, List[Uri]] = field(default_factory=dict) resolver: UriResolver + + +__all__ = ["ClientConfig"] diff --git a/packages/polywrap-core/polywrap_core/types/env.py b/packages/polywrap-core/polywrap_core/types/env.py deleted file mode 100644 index 7949d5eb..00000000 --- a/packages/polywrap-core/polywrap_core/types/env.py +++ /dev/null @@ -1,4 +0,0 @@ -"""This module defines Env type.""" -from typing import Any, Dict - -Env = Dict[str, Any] diff --git a/packages/polywrap-core/polywrap_core/types/errors.py b/packages/polywrap-core/polywrap_core/types/errors.py index f445b191..54732eff 100644 --- a/packages/polywrap-core/polywrap_core/types/errors.py +++ b/packages/polywrap-core/polywrap_core/types/errors.py @@ -1,59 +1,82 @@ """This module contains the core wrap errors.""" +# pylint: disable=too-many-arguments + +from __future__ import annotations import json from textwrap import dedent -from typing import Generic, TypeVar +from typing import Any, Optional, cast + +from polywrap_msgpack import GenericMap, msgpack_decode -from polywrap_msgpack import msgpack_decode +from .invoke_options import InvokeOptions +from .uri import Uri -from .options.invoke_options import InvokeOptions -from .uri_like import UriLike -TUriLike = TypeVar("TUriLike", bound=UriLike) +def _default_encoder(obj: Any) -> Any: + if isinstance(obj, bytes): + return list(obj) + if isinstance(obj, (Uri, GenericMap)): + return repr(cast(Any, obj)) + raise TypeError(f"Object of type '{type(obj).__name__}' is not JSON serializable") class WrapError(Exception): """Base class for all exceptions related to wrappers.""" -class WrapAbortError(Generic[TUriLike], WrapError): +class WrapAbortError(WrapError): """Raises when a wrapper aborts execution. - Attributes: + Args: invoke_options (InvokeOptions): InvokeOptions for the invocation\ that was aborted. message: The message provided by the wrapper. """ - invoke_options: InvokeOptions[TUriLike] + uri: Uri + """The URI of the wrapper.""" + + method: str + """The method that was invoked.""" + message: str + """The message provided by the wrapper.""" + + invoke_args: Optional[str] = None + """The arguments that were passed to the wrapper.""" + + invoke_env: Optional[str] = None + """The environment variables that were passed to the wrapper.""" - # pylint: disable=too-many-arguments def __init__( self, - invoke_options: InvokeOptions[TUriLike], + invoke_options: InvokeOptions, message: str, ): """Initialize a new instance of WasmAbortError.""" - self.invoke_options = invoke_options + self.uri = invoke_options.uri + self.method = invoke_options.method self.message = message - invoke_args = ( + self.invoke_args = ( json.dumps( msgpack_decode(invoke_options.args) if isinstance(invoke_options.args, bytes) else invoke_options.args, indent=2, + default=_default_encoder, ) if invoke_options.args is not None else None ) - invoke_env = ( + self.invoke_env = ( json.dumps( msgpack_decode(invoke_options.env) if isinstance(invoke_options.env, bytes) else invoke_options.env, indent=2, + default=_default_encoder, ) if invoke_options.env is not None else None @@ -65,19 +88,58 @@ def __init__( WrapAbortError: The following wrapper aborted execution with the given message: URI: {invoke_options.uri} Method: {invoke_options.method} - Args: {invoke_args} - env: {invoke_env} + Args: {self.invoke_args} + env: {self.invoke_env} Message: {message} """ ) ) -class WrapInvocationError(WrapAbortError[TUriLike]): +class WrapInvocationError(WrapAbortError): """Raises when there is an error invoking a wrapper. - Attributes: - invoke_options (InvokeOptions): InvokeOptions for the invocation \ + Args: + invoke_options (InvokeOptions): InvokeOptions for the invocation\ that was aborted. message: The message provided by the wrapper. """ + + +class WrapGetImplementationsError(WrapError): + """Raises when there is an error getting implementations of an interface. + + Args: + uri (Uri): URI of the interface. + message (str): The message provided by the wrapper. + """ + + uri: Uri + """The URI of the interface.""" + + message: str + """The message provided by the wrapper.""" + + def __init__(self, uri: Uri, message: str): + """Initialize a new instance of WrapGetImplementationsError.""" + self.uri = uri + self.message = message + + super().__init__( + dedent( + f""" + WrapGetImplementationsError: Failed to get implementations of \ + the following interface URI with the given message: + URI: {uri} + Message: {message} + """ + ) + ) + + +__all__ = [ + "WrapError", + "WrapAbortError", + "WrapInvocationError", + "WrapGetImplementationsError", +] diff --git a/packages/polywrap-core/polywrap_core/types/file_reader.py b/packages/polywrap-core/polywrap_core/types/file_reader.py index 6067d0cf..268a7eb1 100644 --- a/packages/polywrap-core/polywrap_core/types/file_reader.py +++ b/packages/polywrap-core/polywrap_core/types/file_reader.py @@ -1,14 +1,13 @@ """This module contains file reader interface.""" from __future__ import annotations -from abc import ABC, abstractmethod +from typing import Protocol -class FileReader(ABC): - """File reader interface.""" +class FileReader(Protocol): + """FileReader protocol used by UriResolver.""" - @abstractmethod - async def read_file(self, file_path: str) -> bytes: + def read_file(self, file_path: str) -> bytes: """Read a file from the given file path. Args: @@ -20,3 +19,7 @@ async def read_file(self, file_path: str) -> bytes: Returns: bytes: The file contents. """ + ... + + +__all__ = ["FileReader"] diff --git a/packages/polywrap-core/polywrap_core/types/invocable.py b/packages/polywrap-core/polywrap_core/types/invocable.py index 12c3d44f..efb15102 100644 --- a/packages/polywrap-core/polywrap_core/types/invocable.py +++ b/packages/polywrap-core/polywrap_core/types/invocable.py @@ -1,15 +1,14 @@ """This module contains the interface for invoking any invocables.""" +# pylint: disable=too-many-arguments + from __future__ import annotations -from abc import ABC, abstractmethod from dataclasses import dataclass -from typing import Any, Generic, Optional, TypeVar - -from .invoker import Invoker -from .options.invoke_options import InvokeOptions -from .uri_like import UriLike +from typing import Any, Optional, Protocol -TUriLike = TypeVar("TUriLike", bound=UriLike) +from .invoker_client import InvokerClient +from .uri import Uri +from .uri_resolution_context import UriResolutionContext @dataclass(slots=True, kw_only=True) @@ -17,29 +16,43 @@ class InvocableResult: """Result of a wrapper invocation. Args: - result (Optional[Any]): Invocation result. The type of this value is \ + result (Any): Invocation result. The type of this value is \ the return type of the method. encoded (Optional[bool]): It will be set true if result is encoded """ - result: Optional[Any] = None + result: Any encoded: Optional[bool] = None -class Invocable(ABC, Generic[TUriLike]): - """Invocable interface.""" +class Invocable(Protocol): + """Defines Invocable protocol.""" - @abstractmethod - async def invoke( - self, options: InvokeOptions[TUriLike], invoker: Invoker[TUriLike] + def invoke( + self, + uri: Uri, + method: str, + args: Optional[Any] = None, + env: Optional[Any] = None, + resolution_context: Optional[UriResolutionContext] = None, + client: Optional[InvokerClient] = None, ) -> InvocableResult: """Invoke the Wrapper based on the provided InvokeOptions. Args: - options (InvokeOptions): InvokeOptions for this invocation. - invoker (Invoker): The invoker instance requesting this invocation.\ - This invoker will be used for any subinvocation that may occur. + uri (Uri): Uri of the wrapper + method (str): Method to be executed + args (Optional[Any]) : Arguments for the method, structured as a dictionary + env (Optional[Any]): Override the client's config for all invokes within this invoke. + resolution_context (Optional[UriResolutionContext]): A URI resolution context + client (Optional[InvokerClient]): The invoker client instance requesting\ + this invocation. This invoker client will be used for any subinvocation\ + that may occur. Returns: InvocableResult: Result of the invocation. """ + ... + + +__all__ = ["Invocable", "InvocableResult"] diff --git a/packages/polywrap-core/polywrap_core/types/invoke_args.py b/packages/polywrap-core/polywrap_core/types/invoke_args.py deleted file mode 100644 index d0d074e3..00000000 --- a/packages/polywrap-core/polywrap_core/types/invoke_args.py +++ /dev/null @@ -1,4 +0,0 @@ -"""This module defines InvokeArgs type.""" -from typing import Any, Dict, Union - -InvokeArgs = Union[Dict[str, Any], bytes, None] diff --git a/packages/polywrap-core/polywrap_core/types/invoke_options.py b/packages/polywrap-core/polywrap_core/types/invoke_options.py new file mode 100644 index 00000000..0db5df23 --- /dev/null +++ b/packages/polywrap-core/polywrap_core/types/invoke_options.py @@ -0,0 +1,37 @@ +"""This module defines the InvokeOptions protocol.""" +from typing import Any, Optional, Protocol + +from .uri import Uri +from .uri_resolution_context import UriResolutionContext + + +class InvokeOptions(Protocol): + """InvokeOptions protocol exposes the core options for an invocation.""" + + @property + def uri(self) -> Uri: + """The URI of the wrapper.""" + ... + + @property + def method(self) -> str: + """The method to invoke.""" + ... + + @property + def args(self) -> Any: + """The arguments to pass to the method.""" + ... + + @property + def env(self) -> Any: + """The environment variables to set for the invocation.""" + ... + + @property + def resolution_context(self) -> Optional[UriResolutionContext]: + """A URI resolution context.""" + ... + + +__all__ = ["InvokeOptions"] diff --git a/packages/polywrap-core/polywrap_core/types/invoker.py b/packages/polywrap-core/polywrap_core/types/invoker.py index b81cb2ca..37db229b 100644 --- a/packages/polywrap-core/polywrap_core/types/invoker.py +++ b/packages/polywrap-core/polywrap_core/types/invoker.py @@ -1,49 +1,54 @@ """This module contains the interface for invoking any invocables.""" +# pylint: disable=too-many-arguments + from __future__ import annotations -from abc import ABC, abstractmethod -from dataclasses import dataclass -from typing import Any, Generic, List, Optional, TypeVar, Union +from typing import Any, List, Optional, Protocol -from .options.invoke_options import InvokeOptions from .uri import Uri -from .uri_like import UriLike - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -@dataclass(slots=True, kw_only=True) -class InvokerOptions(Generic[TUriLike], InvokeOptions[TUriLike]): - """Options for invoking a wrapper using an invoker. +from .uri_resolution_context import UriResolutionContext - Attributes: - encode_result (Optional[bool]): If true, the result will be encoded. - """ - encode_result: Optional[bool] = False +class Invoker(Protocol): + """Invoker protocol defines the methods for invoking a wrapper.""" - -class Invoker(ABC, Generic[TUriLike]): - """Invoker interface defines the methods for invoking a wrapper.""" - - @abstractmethod - async def invoke(self, options: InvokerOptions[TUriLike]) -> Any: + def invoke( + self, + uri: Uri, + method: str, + args: Optional[Any] = None, + env: Optional[Any] = None, + resolution_context: Optional[UriResolutionContext] = None, + encode_result: Optional[bool] = False, + ) -> Any: """Invoke the Wrapper based on the provided InvokerOptions. Args: - options (InvokerOptions): InvokerOptions for this invocation. + uri (Uri): Uri of the wrapper + method (str): Method to be executed + args (Optional[Any]) : Arguments for the method, structured as a dictionary + env (Optional[Any]): Override the client's config for all invokes within this invoke. + resolution_context (Optional[UriResolutionContext]): A URI resolution context + encode_result (Optional[bool]): If True, the result will be encoded Returns: Any: invocation result. """ + ... - @abstractmethod - def get_implementations(self, uri: Uri) -> Union[List[Uri], None]: + def get_implementations( + self, uri: Uri, apply_resolution: bool = True + ) -> Optional[List[Uri]]: """Get implementations of an interface with its URI. Args: uri (Uri): URI of the interface. + apply_resolution (bool): If True, apply resolution to the URI and interfaces. Returns: - Union[List[Uri], None]: List of implementations or None if not found. + Optional[List[Uri]]: List of implementations or None if not found. """ + ... + + +__all__ = ["Invoker"] diff --git a/packages/polywrap-core/polywrap_core/types/invoker_client.py b/packages/polywrap-core/polywrap_core/types/invoker_client.py index 245e3af4..ff41a43a 100644 --- a/packages/polywrap-core/polywrap_core/types/invoker_client.py +++ b/packages/polywrap-core/polywrap_core/types/invoker_client.py @@ -1,15 +1,15 @@ """This module contains the InvokerClient interface.""" from __future__ import annotations -from typing import Generic, TypeVar +from typing import Protocol from .invoker import Invoker -from .uri_like import UriLike from .uri_resolver_handler import UriResolverHandler -TUriLike = TypeVar("TUriLike", bound=UriLike) - -class InvokerClient(Generic[TUriLike], Invoker[TUriLike], UriResolverHandler[TUriLike]): - """InvokerClient interface defines core set of functionalities\ +class InvokerClient(Invoker, UriResolverHandler, Protocol): + """InvokerClient protocol defines core set of functionalities\ for resolving and invoking a wrapper.""" + + +__all__ = ["InvokerClient"] diff --git a/packages/polywrap-core/polywrap_core/types/options/__init__.py b/packages/polywrap-core/polywrap_core/types/options/__init__.py deleted file mode 100644 index 1c08b389..00000000 --- a/packages/polywrap-core/polywrap_core/types/options/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -"""This module contains the options for various client methods.""" -from .file_options import * -from .invoke_options import * -from .manifest_options import * -from .uri_resolver_options import * diff --git a/packages/polywrap-core/polywrap_core/types/options/file_options.py b/packages/polywrap-core/polywrap_core/types/options/file_options.py deleted file mode 100644 index 614fc3e8..00000000 --- a/packages/polywrap-core/polywrap_core/types/options/file_options.py +++ /dev/null @@ -1,18 +0,0 @@ -"""This module contains GetFileOptions type.""" -from __future__ import annotations - -from dataclasses import dataclass -from typing import Optional - - -@dataclass(slots=True, kw_only=True) -class GetFileOptions: - """Options for getting a file from a wrapper. - - Attributes: - path (str): Path to the file. - encoding (Optional[str]): Encoding of the file. - """ - - path: str - encoding: Optional[str] = "utf-8" diff --git a/packages/polywrap-core/polywrap_core/types/options/invoke_options.py b/packages/polywrap-core/polywrap_core/types/options/invoke_options.py deleted file mode 100644 index afe3a1d3..00000000 --- a/packages/polywrap-core/polywrap_core/types/options/invoke_options.py +++ /dev/null @@ -1,32 +0,0 @@ -"""This module contains the interface for invoking any invocables.""" -from __future__ import annotations - -from dataclasses import dataclass, field -from typing import Generic, Optional, TypeVar - -from ..env import Env -from ..invoke_args import InvokeArgs -from ..uri import Uri -from ..uri_like import UriLike -from ..uri_resolution_context import IUriResolutionContext - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -@dataclass(slots=True, kw_only=True) -class InvokeOptions(Generic[TUriLike]): - """Options required for a wrapper invocation. - - Args: - uri (Uri): Uri of the wrapper - method (str): Method to be executed - args (Optional[InvokeArgs]) : Arguments for the method, structured as a dictionary - env (Optional[Env]): Override the client's config for all invokes within this invoke. - resolution_context (Optional[IUriResolutionContext]): A URI resolution context - """ - - uri: Uri - method: str - args: Optional[InvokeArgs] = field(default_factory=dict) - env: Optional[Env] = None - resolution_context: Optional[IUriResolutionContext[TUriLike]] = None diff --git a/packages/polywrap-core/polywrap_core/types/options/manifest_options.py b/packages/polywrap-core/polywrap_core/types/options/manifest_options.py deleted file mode 100644 index 521218df..00000000 --- a/packages/polywrap-core/polywrap_core/types/options/manifest_options.py +++ /dev/null @@ -1,11 +0,0 @@ -"""This module contains GetManifestOptions type.""" -from __future__ import annotations - -from dataclasses import dataclass - -from polywrap_manifest import DeserializeManifestOptions - - -@dataclass(slots=True, kw_only=True) -class GetManifestOptions(DeserializeManifestOptions): - """Options for getting a manifest from a wrapper.""" diff --git a/packages/polywrap-core/polywrap_core/types/options/uri_resolver_options.py b/packages/polywrap-core/polywrap_core/types/options/uri_resolver_options.py deleted file mode 100644 index 9d897d0d..00000000 --- a/packages/polywrap-core/polywrap_core/types/options/uri_resolver_options.py +++ /dev/null @@ -1,24 +0,0 @@ -"""This module contains the TryResolveUriOptions type.""" -from __future__ import annotations - -from dataclasses import dataclass -from typing import Generic, Optional, TypeVar - -from ..uri import Uri -from ..uri_like import UriLike -from ..uri_resolution_context import IUriResolutionContext - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -@dataclass(slots=True, kw_only=True) -class TryResolveUriOptions(Generic[TUriLike]): - """Options for resolving a uri. - - Args: - uri (Uri): Uri of the wrapper to resolve. - resolution_context (Optional[IUriResolutionContext]): A URI resolution context - """ - - uri: Uri - resolution_context: Optional[IUriResolutionContext[TUriLike]] = None diff --git a/packages/polywrap-core/polywrap_core/types/uri.py b/packages/polywrap-core/polywrap_core/types/uri.py index f6390bf2..4d1ef475 100644 --- a/packages/polywrap-core/polywrap_core/types/uri.py +++ b/packages/polywrap-core/polywrap_core/types/uri.py @@ -2,12 +2,12 @@ from __future__ import annotations import re +from functools import total_ordering from typing import Union -from .uri_like import UriLike - -class Uri(UriLike): +@total_ordering +class Uri: """Defines a wrapper URI and provides utilities for parsing and validating them. wrapper URIs are used to identify and resolve Polywrap wrappers. They are \ @@ -17,7 +17,16 @@ class Uri(UriLike): `:///` where the scheme is always "wrap" and the \ authority is the URI scheme of the underlying wrapper. + Args: + authority (str): The authority of the URI. This is used to determine \ + which URI resolver to use. + path (str): The path of the URI. This is used to determine the \ + location of the wrapper. + Examples: + >>> uri = Uri("ipfs", "QmHASH") + >>> uri.uri + "wrap://ipfs/QmHASH" >>> uri = Uri.from_str("ipfs/QmHASH") >>> uri.uri "wrap://ipfs/QmHASH" @@ -40,20 +49,16 @@ class Uri(UriLike): Traceback (most recent call last): ... TypeError: expected string or bytes-like object - - Attributes: - scheme (str): The scheme of the URI. Defaults to "wrap". This helps \ - differentiate Polywrap URIs from other URI schemes. - authority (str): The authority of the URI. This is used to determine \ - which URI resolver to use. - path (str): The path of the URI. This is used to determine the \ - location of the wrapper. """ URI_REGEX = re.compile( r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" ) # https://www.rfc-editor.org/rfc/rfc3986#appendix-B + scheme = "wrap" + """The scheme of the URI. Defaults to "wrap". This helps \ + differentiate Polywrap URIs from other URI schemes.""" + _authority: str _path: str @@ -61,8 +66,8 @@ def __init__(self, authority: str, path: str): """Initialize a new instance of a wrapper URI. Args: - authority: The authority of the URI. - path: The path of the URI. + authority (str): The authority of the URI. + path (str): The path of the URI. """ self._authority = authority self._path = path @@ -150,3 +155,29 @@ def from_str(cls, uri: str) -> Uri: raise ValueError("The provided URI has an invalid path") return cls(authority, path) + + def __str__(self) -> str: + """Return the URI as a string.""" + return self.uri + + def __repr__(self) -> str: + """Return the string URI representation.""" + return f'Uri("{self._authority}", "{self._path}")' + + def __hash__(self) -> int: + """Return the hash of the URI.""" + return hash(self.uri) + + def __eq__(self, obj: object) -> bool: + """Return true if the provided object is a Uri and has the same URI.""" + return self.uri == obj.uri if isinstance(obj, Uri) else False + + def __lt__(self, uri: object) -> bool: + """Return true if the provided Uri has a URI that is lexicographically\ + less than this Uri.""" + if not isinstance(uri, Uri): + raise TypeError(f"Cannot compare Uri to {type(uri)}") + return self.uri < uri.uri + + +__all__ = ["Uri"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_like.py b/packages/polywrap-core/polywrap_core/types/uri_like.py deleted file mode 100644 index 39014221..00000000 --- a/packages/polywrap-core/polywrap_core/types/uri_like.py +++ /dev/null @@ -1,64 +0,0 @@ -"""This module contains the utility for sanitizing and parsing Wrapper URIs.""" -from __future__ import annotations - -from abc import ABC, abstractmethod -from functools import total_ordering - - -@total_ordering -class UriLike(ABC): - """Defines the interface for a URI-like object. - - Examples: - - Uri - - UriWrapper - - UriPackage - """ - - @property - def scheme(self) -> str: - """Return the scheme of the URI.""" - return "wrap" - - @property - @abstractmethod - def authority(self) -> str: - """Return the authority of the URI.""" - - @property - @abstractmethod - def path(self) -> str: - """Return the path of the URI.""" - - @property - @abstractmethod - def uri(self) -> str: - """Return the URI as a string.""" - - @staticmethod - @abstractmethod - def is_canonical_uri(uri: str) -> bool: - """Return true if the provided URI is canonical.""" - - def __str__(self) -> str: - """Return the URI as a string.""" - return self.uri - - def __repr__(self) -> str: - """Return the string URI representation.""" - return f"Uri({self.uri})" - - def __hash__(self) -> int: - """Return the hash of the URI.""" - return hash(self.uri) - - def __eq__(self, obj: object) -> bool: - """Return true if the provided object is a Uri and has the same URI.""" - return self.uri == obj.uri if isinstance(obj, UriLike) else False - - def __lt__(self, uri: object) -> bool: - """Return true if the provided Uri has a URI that is lexicographically\ - less than this Uri.""" - if not isinstance(uri, UriLike): - raise TypeError(f"Cannot compare Uri to {type(uri)}") - return self.uri < uri.uri diff --git a/packages/polywrap-core/polywrap_core/types/uri_package.py b/packages/polywrap-core/polywrap_core/types/uri_package.py index 8d84f5d3..b86bb9fe 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_package.py +++ b/packages/polywrap-core/polywrap_core/types/uri_package.py @@ -1,35 +1,26 @@ """This module contains the UriPackage type.""" from __future__ import annotations -from typing import Generic, TypeVar +from dataclasses import dataclass from .uri import Uri -from .uri_like import UriLike from .wrap_package import WrapPackage -TUriLike = TypeVar("TUriLike", bound=UriLike) +@dataclass(slots=True, kw_only=True) +class UriPackage: + """UriPackage is a dataclass that contains a URI and a package. -class UriPackage(Generic[TUriLike], Uri): - """UriPackage is a dataclass that contains a URI and a wrap package. - - Attributes: + Args: + uri (Uri): The URI of the wrap package. package (WrapPackage): The wrap package. """ - _package: WrapPackage[TUriLike] + uri: Uri + """The URI of the wrap package.""" - def __init__(self, uri: Uri, package: WrapPackage[TUriLike]) -> None: - """Initialize a new instance of UriPackage. + package: WrapPackage + """The wrap package.""" - Args: - uri (Uri): The URI. - package (WrapPackage): The wrap package. - """ - super().__init__(uri.authority, uri.path) - self._package = package - @property - def package(self) -> WrapPackage[TUriLike]: - """Return the wrap package.""" - return self._package +__all__ = ["UriPackage"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_package_wrapper.py b/packages/polywrap-core/polywrap_core/types/uri_package_wrapper.py index 8351aac8..4d4a80d5 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_package_wrapper.py +++ b/packages/polywrap-core/polywrap_core/types/uri_package_wrapper.py @@ -1,4 +1,22 @@ -"""UriPackageOrWrapper is a Union type alias for a URI, a package, or a wrapper.""" +"""UriPackageOrWrapper is a Union type alias for a URI, a package, or a wrapper. + +UriPackageOrWrapper = Union[Uri, UriWrapper, UriPackage] + +Examples: + >>> from polywrap_core.types import UriPackageOrWrapper + >>> from polywrap_core.types import Uri + >>> from polywrap_core.types import UriPackage + >>> from polywrap_core.types import UriWrapper + >>> result: UriPackageOrWrapper = Uri("authority", "path") + >>> match result: + ... case Uri(uri): + ... print(uri) + ... case _: + ... print("Not a URI") + ... + wrap://authority/path + +""" from __future__ import annotations from typing import Union @@ -7,6 +25,6 @@ from .uri_package import UriPackage from .uri_wrapper import UriWrapper -UriPackageOrWrapper = Union[ - Uri, UriWrapper["UriPackageOrWrapper"], UriPackage["UriPackageOrWrapper"] -] +UriPackageOrWrapper = Union[Uri, UriWrapper, UriPackage] + +__all__ = ["UriPackageOrWrapper"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_resolution_context.py b/packages/polywrap-core/polywrap_core/types/uri_resolution_context.py index 3909a36e..bffb103e 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_resolution_context.py +++ b/packages/polywrap-core/polywrap_core/types/uri_resolution_context.py @@ -1,20 +1,44 @@ -"""This module contains the interface for a URI resolution context.""" -from __future__ import annotations - -from abc import ABC, abstractmethod -from typing import Generic, List, TypeVar +"""This module contains implementation of IUriResolutionContext interface.""" +from typing import List, Optional, Set from .uri import Uri -from .uri_like import UriLike -from .uri_resolution_step import IUriResolutionStep +from .uri_resolution_step import UriResolutionStep + + +class UriResolutionContext: + """Represents the context of a uri resolution. + + Args: + resolving_uri_set (Set[Uri]): A set of uris that\ + are currently being resolved. + resolution_path (List[Uri]): A list of uris in the order that\ + they are being resolved. + history (List[UriResolutionStep]): A list of steps \ + that have been taken to resolve the uri. + """ -TUriLike = TypeVar("TUriLike", bound=UriLike) + resolving_uri_set: Set[Uri] + """A set of uris that are currently being resolved.""" + resolution_path: List[Uri] + """A list of uris in the order that they are being resolved.""" -class IUriResolutionContext(ABC, Generic[TUriLike]): - """Defines the interface for a URI resolution context.""" + history: List[UriResolutionStep] + """A list of steps that have been taken to resolve the uri.""" + + __slots__ = ("resolving_uri_set", "resolution_path", "history") + + def __init__( + self, + resolving_uri_set: Optional[Set[Uri]] = None, + resolution_path: Optional[List[Uri]] = None, + history: Optional[List[UriResolutionStep]] = None, + ): + """Initialize a new instance of UriResolutionContext.""" + self.resolving_uri_set = resolving_uri_set or set() + self.resolution_path = resolution_path or [] + self.history = history or [] - @abstractmethod def is_resolving(self, uri: Uri) -> bool: """Check if the given uri is currently being resolved. @@ -24,8 +48,8 @@ def is_resolving(self, uri: Uri) -> bool: Returns: bool: True if the uri is currently being resolved, otherwise False. """ + return uri in self.resolving_uri_set - @abstractmethod def start_resolving(self, uri: Uri) -> None: """Start resolving the given uri. @@ -34,8 +58,9 @@ def start_resolving(self, uri: Uri) -> None: Returns: None """ + self.resolving_uri_set.add(uri) + self.resolution_path.append(uri) - @abstractmethod def stop_resolving(self, uri: Uri) -> None: """Stop resolving the given uri. @@ -44,45 +69,54 @@ def stop_resolving(self, uri: Uri) -> None: Returns: None """ + self.resolving_uri_set.remove(uri) - @abstractmethod - def track_step(self, step: IUriResolutionStep[TUriLike]) -> None: + def track_step(self, step: UriResolutionStep) -> None: """Track the given step in the resolution history. Args: - step (IUriResolutionStep): The step to track. + step (UriResolutionStep): The step to track. Returns: None """ + self.history.append(step) - @abstractmethod - def get_history(self) -> List[IUriResolutionStep[TUriLike]]: + def get_history(self) -> List[UriResolutionStep]: """Get the resolution history. Returns: - List[IUriResolutionStep]: The resolution history. + List[UriResolutionStep]: The resolution history. """ + return self.history - @abstractmethod def get_resolution_path(self) -> List[Uri]: """Get the resolution path. Returns: List[Uri]: The ordered list of URI resolution path. """ + return self.resolution_path - @abstractmethod - def create_sub_history_context(self) -> "IUriResolutionContext[TUriLike]": + def create_sub_history_context(self) -> "UriResolutionContext": """Create a new sub context that shares the same resolution path. Returns: - IUriResolutionContext: The new context. + UriResolutionContext: The new context. """ + return UriResolutionContext( + resolving_uri_set=self.resolving_uri_set, + resolution_path=self.resolution_path, + ) - @abstractmethod - def create_sub_context(self) -> "IUriResolutionContext[TUriLike]": + def create_sub_context(self) -> "UriResolutionContext": """Create a new sub context that shares the same resolution history. Returns: - IUriResolutionContext: The new context. + UriResolutionContext: The new context. """ + return UriResolutionContext( + resolving_uri_set=self.resolving_uri_set, history=self.history + ) + + +__all__ = ["UriResolutionContext"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_resolution_step.py b/packages/polywrap-core/polywrap_core/types/uri_resolution_step.py index ed75a331..b2ef95aa 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_resolution_step.py +++ b/packages/polywrap-core/polywrap_core/types/uri_resolution_step.py @@ -1,27 +1,28 @@ -"""This module contains the uri resolution step interface.""" +"""This module contains implementation of IUriResolutionStep interface.""" from __future__ import annotations from dataclasses import dataclass -from typing import Generic, List, Optional, TypeVar +from typing import Any, List, Optional from .uri import Uri -from .uri_like import UriLike - -TUriLike = TypeVar("TUriLike", bound=UriLike) @dataclass(slots=True, kw_only=True) -class IUriResolutionStep(Generic[TUriLike]): +class UriResolutionStep: """Represents a single step in the resolution of a uri. - Attributes: + Args: source_uri (Uri): The uri that was resolved. - result (T): The result of the resolution. must be a UriLike. - description: A description of the resolution step. - sub_history: A list of sub steps that were taken to resolve the uri. + result (Any): The result of the resolution. + description (Optional[str]): A description of the resolution step. + sub_history (Optional[List[UriResolutionStep]]): A list of sub steps\ + that were taken to resolve the uri. """ source_uri: Uri - result: TUriLike + result: Any description: Optional[str] = None - sub_history: Optional[List["IUriResolutionStep[TUriLike]"]] = None + sub_history: Optional[List[UriResolutionStep]] = None + + +__all__ = ["UriResolutionStep"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_resolver.py b/packages/polywrap-core/polywrap_core/types/uri_resolver.py index 66463d1c..1df16efb 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_resolver.py +++ b/packages/polywrap-core/polywrap_core/types/uri_resolver.py @@ -1,31 +1,36 @@ """This module contains the uri resolver interface.""" from __future__ import annotations -from abc import ABC, abstractmethod +from typing import Protocol from .invoker_client import InvokerClient from .uri import Uri from .uri_package_wrapper import UriPackageOrWrapper -from .uri_resolution_context import IUriResolutionContext +from .uri_resolution_context import UriResolutionContext -class UriResolver(ABC): - """Defines interface for wrapper uri resolver.""" +class UriResolver(Protocol): + """Defines protocol for wrapper uri resolver.""" - @abstractmethod - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a uri. Args: - uri: The uri to resolve. - client: The minimal invoker client to use for resolving the uri. - resolution_context: The context for resolving the uri. + uri (Uri): The uri to resolve. + client (InvokerClient): The minimal invoker client \ + to use for resolving the uri. + resolution_context (UriResolutionContext): The context \ + for resolving the uri. Returns: UriPackageOrWrapper: result of the URI resolution. """ + ... + + +__all__ = ["UriResolver"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_resolver_handler.py b/packages/polywrap-core/polywrap_core/types/uri_resolver_handler.py index 3c56687a..8dd67a87 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_resolver_handler.py +++ b/packages/polywrap-core/polywrap_core/types/uri_resolver_handler.py @@ -1,27 +1,29 @@ """This module contains uri resolver handler interface.""" from __future__ import annotations -from abc import ABC, abstractmethod -from typing import Generic, TypeVar +from typing import Any, Optional, Protocol -from .options.uri_resolver_options import TryResolveUriOptions -from .uri_like import UriLike +from .uri import Uri +from .uri_resolution_context import UriResolutionContext -TUriLike = TypeVar("TUriLike", bound=UriLike) +class UriResolverHandler(Protocol): + """Uri resolver handler protocol.""" -class UriResolverHandler(ABC, Generic[TUriLike]): - """Uri resolver handler interface.""" - - @abstractmethod - async def try_resolve_uri( - self, options: TryResolveUriOptions[TUriLike] - ) -> TUriLike: + def try_resolve_uri( + self, uri: Uri, resolution_context: Optional[UriResolutionContext] = None + ) -> Any: """Try to resolve a uri. Args: - options: The options for resolving the uri. + uri (Uri): Uri of the wrapper to resolve. + resolution_context (Optional[IUriResolutionContext]):\ + A URI resolution context Returns: - T: result of the URI resolution. Must be a UriLike. + Any: result of the URI resolution. """ + ... + + +__all__ = ["UriResolverHandler"] diff --git a/packages/polywrap-core/polywrap_core/types/uri_wrapper.py b/packages/polywrap-core/polywrap_core/types/uri_wrapper.py index 56749816..0cab0fc0 100644 --- a/packages/polywrap-core/polywrap_core/types/uri_wrapper.py +++ b/packages/polywrap-core/polywrap_core/types/uri_wrapper.py @@ -1,35 +1,23 @@ """This module contains the UriWrapper type.""" from __future__ import annotations -from typing import Generic, TypeVar +from dataclasses import dataclass from .uri import Uri -from .uri_like import UriLike from .wrapper import Wrapper -TUriLike = TypeVar("TUriLike", bound=UriLike) - -class UriWrapper(Generic[TUriLike], Uri): +@dataclass(slots=True, kw_only=True) +class UriWrapper: """UriWrapper is a dataclass that contains a URI and a wrapper. - Attributes: - wrapper: The wrapper. + Args: + uri (Uri): The URI of the wrapper. + wrapper (Wrapper): The wrapper. """ - _wrapper: Wrapper[TUriLike] - - def __init__(self, uri: Uri, wrapper: Wrapper[TUriLike]) -> None: - """Initialize a new instance of UriWrapper. + uri: Uri + wrapper: Wrapper - Args: - uri: The URI. - wrapper: The wrapper. - """ - super().__init__(uri.authority, uri.path) - self._wrapper = wrapper - @property - def wrapper(self) -> Wrapper[TUriLike]: - """Return the wrapper.""" - return self._wrapper +__all__ = ["UriWrapper"] diff --git a/packages/polywrap-core/polywrap_core/types/wrap_package.py b/packages/polywrap-core/polywrap_core/types/wrap_package.py index 4ce160d1..c7171c10 100644 --- a/packages/polywrap-core/polywrap_core/types/wrap_package.py +++ b/packages/polywrap-core/polywrap_core/types/wrap_package.py @@ -1,36 +1,36 @@ """This module contains the IWrapPackage interface.""" -from abc import ABC, abstractmethod -from typing import Generic, Optional, TypeVar +from __future__ import annotations -from polywrap_manifest import AnyWrapManifest +from typing import Optional, Protocol -from .options import GetManifestOptions -from .uri_like import UriLike -from .wrapper import Wrapper +from polywrap_manifest import AnyWrapManifest, DeserializeManifestOptions -TUriLike = TypeVar("TUriLike", bound=UriLike) +from .wrapper import Wrapper -class WrapPackage(ABC, Generic[TUriLike]): - """Wrapper package interface.""" +class WrapPackage(Protocol): + """Defines protocol for representing the wrap package.""" - @abstractmethod - async def create_wrapper(self) -> Wrapper[TUriLike]: + def create_wrapper(self) -> Wrapper: """Create a new wrapper instance from the wrapper package. Returns: Wrapper: The newly created wrapper instance. """ + ... - @abstractmethod - async def get_manifest( - self, options: Optional[GetManifestOptions] = None + def get_manifest( + self, options: Optional[DeserializeManifestOptions] = None ) -> AnyWrapManifest: """Get the manifest from the wrapper package. Args: - options: The options for getting the manifest. + options (DeserializeManifestOptions): The options for getting the manifest. Returns: AnyWrapManifest: The manifest of the wrapper. """ + ... + + +__all__ = ["WrapPackage"] diff --git a/packages/polywrap-core/polywrap_core/types/wrapper.py b/packages/polywrap-core/polywrap_core/types/wrapper.py index d92fe87c..1b45f766 100644 --- a/packages/polywrap-core/polywrap_core/types/wrapper.py +++ b/packages/polywrap-core/polywrap_core/types/wrapper.py @@ -1,52 +1,37 @@ """This module contains the Wrapper interface.""" -from abc import abstractmethod -from typing import Any, Dict, Generic, TypeVar, Union +from __future__ import annotations + +from typing import Optional, Protocol, Union from polywrap_manifest import AnyWrapManifest from .invocable import Invocable -from .invoker import InvokeOptions, Invoker -from .options import GetFileOptions -from .uri_like import UriLike - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -class Wrapper(Generic[TUriLike], Invocable[TUriLike]): - """Defines the interface for a wrapper.""" - @abstractmethod - async def invoke( - self, options: InvokeOptions[TUriLike], invoker: Invoker[TUriLike] - ) -> Any: - """Invoke the wrapper. - Args: - options: The options for invoking the wrapper. - invoker: The invoker to use for invoking the wrapper. - - Returns: - Any: The result of the wrapper invocation. - """ +class Wrapper(Invocable, Protocol): + """Defines the protocol for a wrapper.""" - @abstractmethod - async def get_file(self, options: GetFileOptions) -> Union[str, bytes]: + def get_file( + self, path: str, encoding: Optional[str] = "utf-8" + ) -> Union[str, bytes]: """Get a file from the wrapper. Args: - options: The options for getting the file. + path (str): Path to the file. + encoding (Optional[str]): Encoding of the file. Returns: Union[str, bytes]: The file contents """ + ... - @abstractmethod def get_manifest(self) -> AnyWrapManifest: """Get the manifest of the wrapper. Returns: AnyWrapManifest: The manifest of the wrapper. """ + ... -WrapperCache = Dict[str, Wrapper[TUriLike]] +__all__ = ["Wrapper"] diff --git a/packages/polywrap-core/polywrap_core/utils/__init__.py b/packages/polywrap-core/polywrap_core/utils/__init__.py index 0d6a3b67..abd549d8 100644 --- a/packages/polywrap-core/polywrap_core/utils/__init__.py +++ b/packages/polywrap-core/polywrap_core/utils/__init__.py @@ -1,3 +1,4 @@ -"""This module contains the core utility functions.""" -from .instance_of import * -from .maybe_async import * +"""This package contains the utilities used by the polywrap-uri-resolvers package.""" +from .build_clean_uri_history import * +from .get_env_from_resolution_path import * +from .get_implementations import * diff --git a/packages/polywrap-core/polywrap_core/utils/build_clean_uri_history.py b/packages/polywrap-core/polywrap_core/utils/build_clean_uri_history.py new file mode 100644 index 00000000..7a32fa1e --- /dev/null +++ b/packages/polywrap-core/polywrap_core/utils/build_clean_uri_history.py @@ -0,0 +1,74 @@ +"""This module contains an utility function for building a clean history of URI resolution steps.""" +from typing import List, Optional + +from ..types import CleanResolutionStep, UriPackage, UriResolutionStep, UriWrapper + + +def build_clean_uri_history( + history: List[UriResolutionStep], depth: Optional[int] = None +) -> CleanResolutionStep: + """Build a clean history of the URI resolution steps. + + Args: + history (List[UriResolutionStep]): A list of URI resolution steps. + depth (Optional[int]): The depth of the history to build. + + Returns: + CleanResolutionStep: A clean history of the URI resolution steps. + """ + clean_history: CleanResolutionStep = [] + + if depth is not None: + depth -= 1 + + if not history: + return clean_history + + for step in history: + clean_history.append(_build_clean_history_step(step)) + + if ( + not step.sub_history + or len(step.sub_history) == 0 + or (depth is not None and depth < 0) + ): + continue + + sub_history = build_clean_uri_history(step.sub_history, depth) + if len(sub_history) > 0: + clean_history.append(sub_history) + + return clean_history + + +def _build_clean_history_step(step: UriResolutionStep) -> str: + uri_package_or_wrapper = step.result + + match uri_package_or_wrapper: + case UriPackage(uri=uri): + return ( + f"{step.source_uri} => {step.description} => package ({uri})" + if step.description + else f"{step.source_uri} => package ({uri})" + ) + case UriWrapper(uri=uri): + return ( + f"{step.source_uri} => {step.description} => wrapper ({uri})" + if step.description + else f"{step.source_uri} => wrapper ({uri})" + ) + case uri: + if step.source_uri == uri: + return ( + f"{step.source_uri} => {step.description}" + if step.description + else f"{step.source_uri}" + ) + return ( + f"{step.source_uri} => {step.description} => uri ({uri})" + if step.description + else f"{step.source_uri} => uri ({uri})" + ) + + +__all__ = ["build_clean_uri_history"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_env_from_uri_history.py b/packages/polywrap-core/polywrap_core/utils/get_env_from_resolution_path.py similarity index 53% rename from packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_env_from_uri_history.py rename to packages/polywrap-core/polywrap_core/utils/get_env_from_resolution_path.py index 1e5b3d6b..fe97c80d 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_env_from_uri_history.py +++ b/packages/polywrap-core/polywrap_core/utils/get_env_from_resolution_path.py @@ -1,17 +1,17 @@ """This module contains the utility function for getting the env from the URI history.""" -from typing import Any, Dict, List, Union +from typing import Any, List, Union -from polywrap_core import Client, Uri +from ..types import Client, Uri -def get_env_from_uri_history( +def get_env_from_resolution_path( uri_history: List[Uri], client: Client -) -> Union[Dict[str, Any], None]: +) -> Union[Any, None]: """Get environment variable from URI resolution history. Args: - uri_history: List of URIs from the URI resolution history - client: Polywrap client instance to use for getting the env by URI + uri_history (List[Uri]): List of URIs from the URI resolution history + client (Client): Polywrap client instance to use for getting the env by URI Returns: env if found, None otherwise @@ -20,3 +20,6 @@ def get_env_from_uri_history( if env := client.get_env_by_uri(uri): return env return None + + +__all__ = ["get_env_from_resolution_path"] diff --git a/packages/polywrap-core/polywrap_core/utils/get_implementations.py b/packages/polywrap-core/polywrap_core/utils/get_implementations.py new file mode 100644 index 00000000..0f8a7544 --- /dev/null +++ b/packages/polywrap-core/polywrap_core/utils/get_implementations.py @@ -0,0 +1,55 @@ +"""This module contains the get_implementations utility.""" +from typing import Dict, List, Optional, Set + +from ..types import InvokerClient, Uri, UriResolutionContext +from ..types.errors import WrapGetImplementationsError + + +def _get_final_uri( + uri: Uri, + client: Optional[InvokerClient] = None, + resolution_context: Optional[UriResolutionContext] = None, +) -> Uri: + if client: + try: + return client.try_resolve_uri(uri, resolution_context) + except Exception as e: + raise WrapGetImplementationsError(uri, "Failed to resolve redirects") from e + return uri + + +def get_implementations( + interface_uri: Uri, + interfaces: Dict[Uri, List[Uri]], + client: Optional[InvokerClient] = None, + resolution_context: Optional[UriResolutionContext] = None, +) -> Optional[List[Uri]]: + """Get implementations of an interface with its URI. + + Args: + interface_uri (Uri): URI of the interface. + interfaces (Dict[Uri, List[Uri]]): Dictionary of interfaces and their implementations. + client (Optional[InvokerClient]): The client to use for resolving the URI. + resolution_context (Optional[UriResolutionContext]): The resolution context to use. + + Raises: + WrapGetImplementationsError: If the URI cannot be resolved. + + Returns: + Optional[List[Uri]]: List of implementations or None if not found. + """ + final_interface_uri = _get_final_uri(interface_uri, client, resolution_context) + final_implementations: Set[Uri] = set() + + for interface in interfaces: + final_current_interface_uri = _get_final_uri( + interface, client, resolution_context + ) + if final_current_interface_uri == final_interface_uri: + impls: Set[Uri] = set(interfaces.get(interface, [])) + final_implementations = final_implementations.union(impls) + + return list(final_implementations) if final_implementations else None + + +__all__ = ["get_implementations"] diff --git a/packages/polywrap-core/polywrap_core/utils/instance_of.py b/packages/polywrap-core/polywrap_core/utils/instance_of.py deleted file mode 100644 index 3772179d..00000000 --- a/packages/polywrap-core/polywrap_core/utils/instance_of.py +++ /dev/null @@ -1,16 +0,0 @@ -"""This module contains the instance_of utility function.""" -import inspect -from typing import Any - - -def instance_of(obj: Any, cls: Any): - """Check if an object is an instance of a class or any of its parent classes. - - Args: - obj (Any): any object instance - cls (Any): class to check against - - Returns: - bool: True if obj is an instance of cls or any of its parent classes, False otherwise - """ - return cls in inspect.getmro(obj.__class__) diff --git a/packages/polywrap-core/polywrap_core/utils/maybe_async.py b/packages/polywrap-core/polywrap_core/utils/maybe_async.py deleted file mode 100644 index 913182f2..00000000 --- a/packages/polywrap-core/polywrap_core/utils/maybe_async.py +++ /dev/null @@ -1,18 +0,0 @@ -"""This module contains the utility function for executing a function that may be async.""" -from __future__ import annotations - -import inspect -from typing import Any, Awaitable, Callable, Optional, Union - - -def is_coroutine(test: Optional[Union[Awaitable[Any], Any]] = None) -> bool: - """Check if the given object is a coroutine.""" - return test is not None and inspect.iscoroutine(test) - - -async def execute_maybe_async_function(func: Callable[..., Any], *args: Any) -> Any: - """Execute a function that may be async.""" - result = func(*args) - if is_coroutine(result): - result = await result - return result diff --git a/packages/polywrap-core/pyproject.toml b/packages/polywrap-core/pyproject.toml index ac5d8e31..5097c49e 100644 --- a/packages/polywrap-core/pyproject.toml +++ b/packages/polywrap-core/pyproject.toml @@ -10,11 +10,12 @@ authors = ["Cesar ", "Niraj "] [tool.poetry.dependencies] python = "^3.10" -polywrap-msgpack = "^0.1.0a29" -polywrap-manifest = "^0.1.0a29" -[tool.poetry.dev-dependencies] +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} + +[tool.poetry.group.dev.dependencies] +pycln = "^2.1.3" pytest = "^7.1.2" -pytest-asyncio = "^0.19.0" pylint = "^2.15.4" black = "^22.10.0" bandit = { version = "^1.7.4", extras = ["toml"]} @@ -24,13 +25,6 @@ isort = "^5.10.1" pyright = "^1.1.275" pydocstyle = "^6.1.1" -[tool.poetry.group.temp.dependencies] -pydeps = "^1.11.1" - - -[tool.poetry.group.dev.dependencies] -pycln = "^2.1.3" - [tool.bandit] exclude_dirs = ["tests"] @@ -42,7 +36,6 @@ typeCheckingMode = "strict" reportShadowedImports = false [tool.pytest.ini_options] -asyncio_mode = "auto" testpaths = [ "tests" ] @@ -52,6 +45,7 @@ disable = [ "invalid-name", "too-many-return-statements", "too-few-public-methods", + "unnecessary-ellipsis" ] ignore = [ "tests/" diff --git a/packages/polywrap-core/tests/run_doctest.py b/packages/polywrap-core/tests/run_doctest.py new file mode 100644 index 00000000..3fc4848e --- /dev/null +++ b/packages/polywrap-core/tests/run_doctest.py @@ -0,0 +1,24 @@ +# test_all.py +import doctest +from typing import Any +import unittest +import pkgutil +import polywrap_msgpack + +def load_tests(loader: Any, tests: Any, ignore: Any) -> Any: + """Load doctests and return TestSuite object.""" + modules = pkgutil.walk_packages( + path=polywrap_msgpack.__path__, + prefix=f"{polywrap_msgpack.__name__}.", + onerror=lambda x: None, + ) + for _, modname, _ in modules: + try: + module = __import__(modname, fromlist="dummy") + tests.addTests(doctest.DocTestSuite(module)) + except (ImportError, ValueError, AttributeError): + continue + return tests + +if __name__ == "__main__": + unittest.main() diff --git a/packages/polywrap-core/tests/test_build_clean_uri_history.py b/packages/polywrap-core/tests/test_build_clean_uri_history.py new file mode 100644 index 00000000..e5da523d --- /dev/null +++ b/packages/polywrap-core/tests/test_build_clean_uri_history.py @@ -0,0 +1,46 @@ +from polywrap_core import ( + CleanResolutionStep, + Uri, + build_clean_uri_history, + UriResolutionStep, +) +import pytest + + +@pytest.fixture +def history() -> list[UriResolutionStep]: + return [ + UriResolutionStep( + source_uri=Uri.from_str("test/1"), + result=Uri.from_str("test/2"), + description="AggreagatorResolver", + sub_history=[ + UriResolutionStep( + source_uri=Uri.from_str("test/1"), + result=Uri.from_str("test/2"), + description="ExtensionRedirectResolver", + ), + ], + ), + UriResolutionStep( + source_uri=Uri.from_str("test/2"), + result=Uri.from_str("test/3"), + description="SimpleRedirectResolver", + ), + ] + + +@pytest.fixture +def expected() -> CleanResolutionStep: + return [ + "wrap://test/1 => AggreagatorResolver => uri (wrap://test/2)", + ["wrap://test/1 => ExtensionRedirectResolver => uri (wrap://test/2)"], + "wrap://test/2 => SimpleRedirectResolver => uri (wrap://test/3)", + ] + + +def test_build_clean_uri_history( + history: list[UriResolutionStep], expected: CleanResolutionStep +): + print(build_clean_uri_history(history)) + assert build_clean_uri_history(history) == expected diff --git a/packages/polywrap-core/tests/test_env_from_resolution_path.py b/packages/polywrap-core/tests/test_env_from_resolution_path.py new file mode 100644 index 00000000..5c832372 --- /dev/null +++ b/packages/polywrap-core/tests/test_env_from_resolution_path.py @@ -0,0 +1,40 @@ +from typing import Any +from polywrap_core import ( + Client, + Uri, + get_env_from_resolution_path, +) +import pytest + + +@pytest.fixture +def resolution_path() -> list[Any]: + return [ + Uri.from_str("test/1"), + Uri.from_str("test/2"), + Uri.from_str("test/3"), + ] + + +@pytest.fixture +def client() -> Any: + class MockClient: + def get_env_by_uri(self, uri: Uri) -> Any: + if uri.uri == "wrap://test/3": + return { + "arg1": "arg1", + "arg2": "arg2", + } + + return MockClient() + + +def test_get_env_from_resolution_path(resolution_path: list[Any], client: Client): + assert get_env_from_resolution_path(resolution_path, client) == { + "arg1": "arg1", + "arg2": "arg2", + } + + +def test_get_env_from_resolution_path_empty(client: Client): + assert get_env_from_resolution_path([], client) is None diff --git a/packages/polywrap-core/tests/test_get_implementations.py b/packages/polywrap-core/tests/test_get_implementations.py new file mode 100644 index 00000000..37cb7647 --- /dev/null +++ b/packages/polywrap-core/tests/test_get_implementations.py @@ -0,0 +1,79 @@ +from polywrap_core import ( + Client, + Uri, + get_implementations, +) +from typing import Any +import pytest + +interface_1 = Uri.from_str("wrap://ens/interface-1.eth") +interface_2 = Uri.from_str("wrap://ens/interface-2.eth") +interface_3 = Uri.from_str("wrap://ens/interface-3.eth") + +implementation_1 = Uri.from_str("wrap://ens/implementation-1.eth") +implementation_2 = Uri.from_str("wrap://ens/implementation-2.eth") +implementation_3 = Uri.from_str("wrap://ens/implementation-3.eth") + + +redirects = { + interface_1: interface_2, + implementation_1: implementation_2, + implementation_2: implementation_3, +} + +interfaces = { + interface_1: [implementation_1, implementation_2], + interface_2: [implementation_3], + interface_3: [implementation_3], +} + + +@pytest.fixture +def client() -> Any: + class MockClient: + def try_resolve_uri(self, uri: Uri, *args: Any) -> Uri: + return redirects.get(uri, uri) + + return MockClient() + + +def test_get_implementations_1(client: Client): + result = get_implementations(interface_1, interfaces, client) + + assert result + assert set(result) == { + implementation_1, + implementation_2, + implementation_3, + } + + +def test_get_implementations_2(client: Client): + result = get_implementations(interface_2, interfaces, client) + + assert result + assert set(result) == { + implementation_1, + implementation_2, + implementation_3, + } + + +def test_get_implementations_3(client: Client): + result = get_implementations(interface_3, interfaces, client) + + assert result + assert set(result) == { + implementation_3, + } + + +def test_implementations_not_redirected(client: Client): + result = get_implementations(interface_1, { + interface_1: [implementation_1], + }, client) + + assert result + assert set(result) == { + implementation_1, + } \ No newline at end of file diff --git a/packages/polywrap-core/tests/test_maybe_async.py b/packages/polywrap-core/tests/test_maybe_async.py deleted file mode 100644 index 6e3323f9..00000000 --- a/packages/polywrap-core/tests/test_maybe_async.py +++ /dev/null @@ -1,27 +0,0 @@ -import inspect - -import pytest - -from polywrap_core import execute_maybe_async_function, is_coroutine - - -@pytest.mark.asyncio -async def test_sanity(): - async def coroutine(): - pass - - def test_function(): - pass - - async def test_function_return_promise(): - pass - - test_coroutine_resp = coroutine() - test_function_resp = execute_maybe_async_function(test_function) - test_function_return_promise_resp = execute_maybe_async_function(test_function_return_promise) - assert is_coroutine(test_coroutine_resp) - assert inspect.iscoroutine(test_function_resp) - assert inspect.iscoroutine(test_function_return_promise_resp) - await test_coroutine_resp - await test_function_resp - await test_function_return_promise_resp diff --git a/packages/polywrap-manifest/poetry.lock b/packages/polywrap-manifest/poetry.lock index ada0fe07..6e90bd1b 100644 --- a/packages/polywrap-manifest/poetry.lock +++ b/packages/polywrap-manifest/poetry.lock @@ -18,14 +18,14 @@ test = ["coverage", "flake8", "mypy", "pexpect", "wheel"] [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.4" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.4-py3-none-any.whl", hash = "sha256:a1b8543ef9d36ea777194bc9b17f5f8678d2c56ee6a45b2c2f17eec96f242347"}, + {file = "astroid-2.15.4.tar.gz", hash = "sha256:c81e1c7fbac615037744d067a9bb5f9aeb655edf59b63ee8b59585475d6f80d8"}, ] [package.dependencies] @@ -117,14 +117,14 @@ uvloop = ["uvloop (>=0.15.2)"] [[package]] name = "certifi" -version = "2022.12.7" +version = "2023.5.7" description = "Python package for providing Mozilla's CA Bundle." category = "dev" optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, - {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, + {file = "certifi-2023.5.7-py3-none-any.whl", hash = "sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716"}, + {file = "certifi-2023.5.7.tar.gz", hash = "sha256:0f0d56dc5a6ad56fd4ba36484d6cc34451e1c6548c61daad8c320169f91eddc7"}, ] [[package]] @@ -253,63 +253,63 @@ files = [ [[package]] name = "coverage" -version = "7.2.3" +version = "7.2.5" description = "Code coverage measurement for Python" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "coverage-7.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e58c0d41d336569d63d1b113bd573db8363bc4146f39444125b7f8060e4e04f5"}, - {file = "coverage-7.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:344e714bd0fe921fc72d97404ebbdbf9127bac0ca1ff66d7b79efc143cf7c0c4"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:974bc90d6f6c1e59ceb1516ab00cf1cdfbb2e555795d49fa9571d611f449bcb2"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0743b0035d4b0e32bc1df5de70fba3059662ace5b9a2a86a9f894cfe66569013"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d0391fb4cfc171ce40437f67eb050a340fdbd0f9f49d6353a387f1b7f9dd4fa"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4a42e1eff0ca9a7cb7dc9ecda41dfc7cbc17cb1d02117214be0561bd1134772b"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:be19931a8dcbe6ab464f3339966856996b12a00f9fe53f346ab3be872d03e257"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:72fcae5bcac3333a4cf3b8f34eec99cea1187acd55af723bcbd559adfdcb5535"}, - {file = "coverage-7.2.3-cp310-cp310-win32.whl", hash = "sha256:aeae2aa38395b18106e552833f2a50c27ea0000122bde421c31d11ed7e6f9c91"}, - {file = "coverage-7.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:83957d349838a636e768251c7e9979e899a569794b44c3728eaebd11d848e58e"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:dfd393094cd82ceb9b40df4c77976015a314b267d498268a076e940fe7be6b79"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:182eb9ac3f2b4874a1f41b78b87db20b66da6b9cdc32737fbbf4fea0c35b23fc"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bb1e77a9a311346294621be905ea8a2c30d3ad371fc15bb72e98bfcfae532df"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca0f34363e2634deffd390a0fef1aa99168ae9ed2af01af4a1f5865e362f8623"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:55416d7385774285b6e2a5feca0af9652f7f444a4fa3d29d8ab052fafef9d00d"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:06ddd9c0249a0546997fdda5a30fbcb40f23926df0a874a60a8a185bc3a87d93"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:fff5aaa6becf2c6a1699ae6a39e2e6fb0672c2d42eca8eb0cafa91cf2e9bd312"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ea53151d87c52e98133eb8ac78f1206498c015849662ca8dc246255265d9c3c4"}, - {file = "coverage-7.2.3-cp311-cp311-win32.whl", hash = "sha256:8f6c930fd70d91ddee53194e93029e3ef2aabe26725aa3c2753df057e296b925"}, - {file = "coverage-7.2.3-cp311-cp311-win_amd64.whl", hash = "sha256:fa546d66639d69aa967bf08156eb8c9d0cd6f6de84be9e8c9819f52ad499c910"}, - {file = "coverage-7.2.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2317d5ed777bf5a033e83d4f1389fd4ef045763141d8f10eb09a7035cee774c"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be9824c1c874b73b96288c6d3de793bf7f3a597770205068c6163ea1f326e8b9"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2c3b2803e730dc2797a017335827e9da6da0e84c745ce0f552e66400abdfb9a1"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f69770f5ca1994cb32c38965e95f57504d3aea96b6c024624fdd5bb1aa494a1"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1127b16220f7bfb3f1049ed4a62d26d81970a723544e8252db0efde853268e21"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:aa784405f0c640940595fa0f14064d8e84aff0b0f762fa18393e2760a2cf5841"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3146b8e16fa60427e03884301bf8209221f5761ac754ee6b267642a2fd354c48"}, - {file = "coverage-7.2.3-cp37-cp37m-win32.whl", hash = "sha256:1fd78b911aea9cec3b7e1e2622c8018d51c0d2bbcf8faaf53c2497eb114911c1"}, - {file = "coverage-7.2.3-cp37-cp37m-win_amd64.whl", hash = "sha256:0f3736a5d34e091b0a611964c6262fd68ca4363df56185902528f0b75dbb9c1f"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:981b4df72c93e3bc04478153df516d385317628bd9c10be699c93c26ddcca8ab"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c0045f8f23a5fb30b2eb3b8a83664d8dc4fb58faddf8155d7109166adb9f2040"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f760073fcf8f3d6933178d67754f4f2d4e924e321f4bb0dcef0424ca0215eba1"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c86bd45d1659b1ae3d0ba1909326b03598affbc9ed71520e0ff8c31a993ad911"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:172db976ae6327ed4728e2507daf8a4de73c7cc89796483e0a9198fd2e47b462"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:d2a3a6146fe9319926e1d477842ca2a63fe99af5ae690b1f5c11e6af074a6b5c"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:f649dd53833b495c3ebd04d6eec58479454a1784987af8afb77540d6c1767abd"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7c4ed4e9f3b123aa403ab424430b426a1992e6f4c8fd3cb56ea520446e04d152"}, - {file = "coverage-7.2.3-cp38-cp38-win32.whl", hash = "sha256:eb0edc3ce9760d2f21637766c3aa04822030e7451981ce569a1b3456b7053f22"}, - {file = "coverage-7.2.3-cp38-cp38-win_amd64.whl", hash = "sha256:63cdeaac4ae85a179a8d6bc09b77b564c096250d759eed343a89d91bce8b6367"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:20d1a2a76bb4eb00e4d36b9699f9b7aba93271c9c29220ad4c6a9581a0320235"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ea748802cc0de4de92ef8244dd84ffd793bd2e7be784cd8394d557a3c751e21"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21b154aba06df42e4b96fc915512ab39595105f6c483991287021ed95776d934"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd214917cabdd6f673a29d708574e9fbdb892cb77eb426d0eae3490d95ca7859"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c2e58e45fe53fab81f85474e5d4d226eeab0f27b45aa062856c89389da2f0d9"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:87ecc7c9a1a9f912e306997ffee020297ccb5ea388421fe62a2a02747e4d5539"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:387065e420aed3c71b61af7e82c7b6bc1c592f7e3c7a66e9f78dd178699da4fe"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ea3f5bc91d7d457da7d48c7a732beaf79d0c8131df3ab278e6bba6297e23c6c4"}, - {file = "coverage-7.2.3-cp39-cp39-win32.whl", hash = "sha256:ae7863a1d8db6a014b6f2ff9c1582ab1aad55a6d25bac19710a8df68921b6e30"}, - {file = "coverage-7.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:3f04becd4fcda03c0160d0da9c8f0c246bc78f2f7af0feea1ec0930e7c93fa4a"}, - {file = "coverage-7.2.3-pp37.pp38.pp39-none-any.whl", hash = "sha256:965ee3e782c7892befc25575fa171b521d33798132692df428a09efacaffe8d0"}, - {file = "coverage-7.2.3.tar.gz", hash = "sha256:d298c2815fa4891edd9abe5ad6e6cb4207104c7dd9fd13aea3fdebf6f9b91259"}, + {file = "coverage-7.2.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:883123d0bbe1c136f76b56276074b0c79b5817dd4238097ffa64ac67257f4b6c"}, + {file = "coverage-7.2.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d2fbc2a127e857d2f8898aaabcc34c37771bf78a4d5e17d3e1f5c30cd0cbc62a"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f3671662dc4b422b15776cdca89c041a6349b4864a43aa2350b6b0b03bbcc7f"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780551e47d62095e088f251f5db428473c26db7829884323e56d9c0c3118791a"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:066b44897c493e0dcbc9e6a6d9f8bbb6607ef82367cf6810d387c09f0cd4fe9a"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b9a4ee55174b04f6af539218f9f8083140f61a46eabcaa4234f3c2a452c4ed11"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:706ec567267c96717ab9363904d846ec009a48d5f832140b6ad08aad3791b1f5"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ae453f655640157d76209f42c62c64c4d4f2c7f97256d3567e3b439bd5c9b06c"}, + {file = "coverage-7.2.5-cp310-cp310-win32.whl", hash = "sha256:f81c9b4bd8aa747d417407a7f6f0b1469a43b36a85748145e144ac4e8d303cb5"}, + {file = "coverage-7.2.5-cp310-cp310-win_amd64.whl", hash = "sha256:dc945064a8783b86fcce9a0a705abd7db2117d95e340df8a4333f00be5efb64c"}, + {file = "coverage-7.2.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:40cc0f91c6cde033da493227797be2826cbf8f388eaa36a0271a97a332bfd7ce"}, + {file = "coverage-7.2.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a66e055254a26c82aead7ff420d9fa8dc2da10c82679ea850d8feebf11074d88"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c10fbc8a64aa0f3ed136b0b086b6b577bc64d67d5581acd7cc129af52654384e"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a22cbb5ede6fade0482111fa7f01115ff04039795d7092ed0db43522431b4f2"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:292300f76440651529b8ceec283a9370532f4ecba9ad67d120617021bb5ef139"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:7ff8f3fb38233035028dbc93715551d81eadc110199e14bbbfa01c5c4a43f8d8"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:a08c7401d0b24e8c2982f4e307124b671c6736d40d1c39e09d7a8687bddf83ed"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ef9659d1cda9ce9ac9585c045aaa1e59223b143f2407db0eaee0b61a4f266fb6"}, + {file = "coverage-7.2.5-cp311-cp311-win32.whl", hash = "sha256:30dcaf05adfa69c2a7b9f7dfd9f60bc8e36b282d7ed25c308ef9e114de7fc23b"}, + {file = "coverage-7.2.5-cp311-cp311-win_amd64.whl", hash = "sha256:97072cc90f1009386c8a5b7de9d4fc1a9f91ba5ef2146c55c1f005e7b5c5e068"}, + {file = "coverage-7.2.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bebea5f5ed41f618797ce3ffb4606c64a5de92e9c3f26d26c2e0aae292f015c1"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:828189fcdda99aae0d6bf718ea766b2e715eabc1868670a0a07bf8404bf58c33"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e8a95f243d01ba572341c52f89f3acb98a3b6d1d5d830efba86033dd3687ade"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e8834e5f17d89e05697c3c043d3e58a8b19682bf365048837383abfe39adaed5"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d1f25ee9de21a39b3a8516f2c5feb8de248f17da7eead089c2e04aa097936b47"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1637253b11a18f453e34013c665d8bf15904c9e3c44fbda34c643fbdc9d452cd"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8e575a59315a91ccd00c7757127f6b2488c2f914096077c745c2f1ba5b8c0969"}, + {file = "coverage-7.2.5-cp37-cp37m-win32.whl", hash = "sha256:509ecd8334c380000d259dc66feb191dd0a93b21f2453faa75f7f9cdcefc0718"}, + {file = "coverage-7.2.5-cp37-cp37m-win_amd64.whl", hash = "sha256:12580845917b1e59f8a1c2ffa6af6d0908cb39220f3019e36c110c943dc875b0"}, + {file = "coverage-7.2.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b5016e331b75310610c2cf955d9f58a9749943ed5f7b8cfc0bb89c6134ab0a84"}, + {file = "coverage-7.2.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:373ea34dca98f2fdb3e5cb33d83b6d801007a8074f992b80311fc589d3e6b790"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a063aad9f7b4c9f9da7b2550eae0a582ffc7623dca1c925e50c3fbde7a579771"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:38c0a497a000d50491055805313ed83ddba069353d102ece8aef5d11b5faf045"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2b3b05e22a77bb0ae1a3125126a4e08535961c946b62f30985535ed40e26614"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:0342a28617e63ad15d96dca0f7ae9479a37b7d8a295f749c14f3436ea59fdcb3"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf97ed82ca986e5c637ea286ba2793c85325b30f869bf64d3009ccc1a31ae3fd"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:c2c41c1b1866b670573657d584de413df701f482574bad7e28214a2362cb1fd1"}, + {file = "coverage-7.2.5-cp38-cp38-win32.whl", hash = "sha256:10b15394c13544fce02382360cab54e51a9e0fd1bd61ae9ce012c0d1e103c813"}, + {file = "coverage-7.2.5-cp38-cp38-win_amd64.whl", hash = "sha256:a0b273fe6dc655b110e8dc89b8ec7f1a778d78c9fd9b4bda7c384c8906072212"}, + {file = "coverage-7.2.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c587f52c81211d4530fa6857884d37f514bcf9453bdeee0ff93eaaf906a5c1b"}, + {file = "coverage-7.2.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4436cc9ba5414c2c998eaedee5343f49c02ca93b21769c5fdfa4f9d799e84200"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6599bf92f33ab041e36e06d25890afbdf12078aacfe1f1d08c713906e49a3fe5"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:857abe2fa6a4973f8663e039ead8d22215d31db613ace76e4a98f52ec919068e"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6f5cab2d7f0c12f8187a376cc6582c477d2df91d63f75341307fcdcb5d60303"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:aa387bd7489f3e1787ff82068b295bcaafbf6f79c3dad3cbc82ef88ce3f48ad3"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:156192e5fd3dbbcb11cd777cc469cf010a294f4c736a2b2c891c77618cb1379a"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:bd3b4b8175c1db502adf209d06136c000df4d245105c8839e9d0be71c94aefe1"}, + {file = "coverage-7.2.5-cp39-cp39-win32.whl", hash = "sha256:ddc5a54edb653e9e215f75de377354e2455376f416c4378e1d43b08ec50acc31"}, + {file = "coverage-7.2.5-cp39-cp39-win_amd64.whl", hash = "sha256:338aa9d9883aaaad53695cb14ccdeb36d4060485bb9388446330bef9c361c252"}, + {file = "coverage-7.2.5-pp37.pp38.pp39-none-any.whl", hash = "sha256:8877d9b437b35a85c18e3c6499b23674684bf690f5d96c1006a1ef61f9fdf0f3"}, + {file = "coverage-7.2.5.tar.gz", hash = "sha256:f99ef080288f09ffc687423b8d60978cf3a465d3f404a18d1a05474bd8575a47"}, ] [package.dependencies] @@ -368,14 +368,14 @@ wmi = ["wmi (>=1.5.1,<2.0.0)"] [[package]] name = "email-validator" -version = "2.0.0.post1" +version = "2.0.0.post2" description = "A robust email address syntax and deliverability validation library." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "email_validator-2.0.0.post1-py3-none-any.whl", hash = "sha256:26efa040ae50e65cc130667080fa0f372f0ac3d852923a76166a54cf6a0ee780"}, - {file = "email_validator-2.0.0.post1.tar.gz", hash = "sha256:314114acd9421728ae6f74d0c0a5d6ec547d44ef4f20425af4093828af2266f3"}, + {file = "email_validator-2.0.0.post2-py3-none-any.whl", hash = "sha256:2466ba57cda361fb7309fd3d5a225723c788ca4bbad32a0ebd5373b99730285c"}, + {file = "email_validator-2.0.0.post2.tar.gz", hash = "sha256:1ff6e86044200c56ae23595695c54e9614f4a9551e0e393614f764860b3d7900"}, ] [package.dependencies] @@ -414,19 +414,19 @@ testing = ["pre-commit"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "genson" @@ -1001,19 +1001,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"}, + {file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -1037,14 +1037,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "prance" @@ -1179,14 +1181,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -1194,18 +1196,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -1238,14 +1240,14 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.306" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.306-py3-none-any.whl", hash = "sha256:008eb2a29584ae274a154d749cf81476a3073fb562a462eac8d43a753378b9db"}, + {file = "pyright-1.1.306.tar.gz", hash = "sha256:16d5d198be64de497d5f9002000a271176c381e21b977ca5566cf779b643c9ed"}, ] [package.dependencies] @@ -1417,21 +1419,21 @@ files = [ [[package]] name = "requests" -version = "2.28.2" +version = "2.30.0" description = "Python HTTP for Humans." category = "dev" optional = false -python-versions = ">=3.7, <4" +python-versions = ">=3.7" files = [ - {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, - {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, + {file = "requests-2.30.0-py3-none-any.whl", hash = "sha256:10e94cc4f3121ee6da529d358cdaeaff2f1c409cd377dbc72b825852f2f7e294"}, + {file = "requests-2.30.0.tar.gz", hash = "sha256:239d7d4458afcb28a692cdd298d87542235f4ca8d36d03a15bfc128a6559a2f4"}, ] [package.dependencies] certifi = ">=2017.4.17" charset-normalizer = ">=2,<4" idna = ">=2.5,<4" -urllib3 = ">=1.21.1,<1.27" +urllib3 = ">=1.21.1,<3" [package.extras] socks = ["PySocks (>=1.5.6,!=1.5.7)"] @@ -1439,14 +1441,14 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -1458,18 +1460,18 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruamel-yaml" -version = "0.17.21" +version = "0.17.24" description = "ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order" category = "dev" optional = false python-versions = ">=3" files = [ - {file = "ruamel.yaml-0.17.21-py3-none-any.whl", hash = "sha256:742b35d3d665023981bd6d16b3d24248ce5df75fdb4e2924e93a05c1f8b61ca7"}, - {file = "ruamel.yaml-0.17.21.tar.gz", hash = "sha256:8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af"}, + {file = "ruamel.yaml-0.17.24-py3-none-any.whl", hash = "sha256:f251bd9096207af604af69d6495c3c650a3338d0493d27b04bc55477d7a884ed"}, + {file = "ruamel.yaml-0.17.24.tar.gz", hash = "sha256:90e398ee24524ebe20fc48cd1861cedd25520457b9a36cfb548613e57fde30a0"}, ] [package.dependencies] -"ruamel.yaml.clib" = {version = ">=0.2.6", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.11\""} +"ruamel.yaml.clib" = {version = ">=0.2.7", markers = "platform_python_implementation == \"CPython\" and python_version < \"3.12\""} [package.extras] docs = ["ryd"] @@ -1535,14 +1537,14 @@ files = [ [[package]] name = "setuptools" -version = "67.6.1" +version = "67.7.2" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, ] [package.extras] @@ -1627,14 +1629,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1768,41 +1770,42 @@ typing-extensions = ">=3.7.4" [[package]] name = "urllib3" -version = "1.26.15" +version = "2.0.2" description = "HTTP library with thread-safe connection pooling, file post, and more." category = "dev" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +python-versions = ">=3.7" files = [ - {file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"}, - {file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"}, + {file = "urllib3-2.0.2-py3-none-any.whl", hash = "sha256:d055c2f9d38dc53c808f6fdc8eab7360b6fdbbde02340ed25cfbcd817c62469e"}, + {file = "urllib3-2.0.2.tar.gz", hash = "sha256:61717a1095d7e155cdb737ac7bb2f4324a858a1e2e6466f6d03ff630ca68d3cc"}, ] [package.extras] -brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] -secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] -socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wrapt" @@ -1892,4 +1895,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "bc99782f9d7ddf82a08ec6d42aa923839093bcc435a9e4361129e33571fee427" +content-hash = "24823609dd2e915662d783a087ef84230b11f8720ee5441ecac7fa758ae01270" diff --git a/packages/polywrap-manifest/polywrap_manifest/deserialize.py b/packages/polywrap-manifest/polywrap_manifest/deserialize.py index 1f2f169e..d8996505 100644 --- a/packages/polywrap-manifest/polywrap_manifest/deserialize.py +++ b/packages/polywrap-manifest/polywrap_manifest/deserialize.py @@ -53,3 +53,6 @@ def deserialize_wrap_manifest( raise NotImplementedError( f"Version {manifest_version.value} is not implemented" ) + + +__all__ = ["deserialize_wrap_manifest"] diff --git a/packages/polywrap-manifest/polywrap_manifest/errors.py b/packages/polywrap-manifest/polywrap_manifest/errors.py index 0bdbff49..19015dde 100644 --- a/packages/polywrap-manifest/polywrap_manifest/errors.py +++ b/packages/polywrap-manifest/polywrap_manifest/errors.py @@ -7,3 +7,6 @@ class ManifestError(Exception): class DeserializeManifestError(ManifestError): """Raised when a manifest cannot be deserialized.""" + + +__all__ = ["ManifestError", "DeserializeManifestError"] diff --git a/packages/polywrap-manifest/polywrap_manifest/manifest.py b/packages/polywrap-manifest/polywrap_manifest/manifest.py index 29268c31..5e21da18 100644 --- a/packages/polywrap-manifest/polywrap_manifest/manifest.py +++ b/packages/polywrap-manifest/polywrap_manifest/manifest.py @@ -15,18 +15,7 @@ class DeserializeManifestOptions: """Options for deserializing a manifest from msgpack encoded bytes. - Attributes: - no_validate: If true, do not validate the manifest. - """ - - no_validate: Optional[bool] = None - - -@dataclass(slots=True, kw_only=True) -class SerializeManifestOptions: - """Options for serializing a manifest to msgpack encoded bytes. - - Attributes: + Args: no_validate: If true, do not validate the manifest. """ @@ -68,3 +57,24 @@ class WrapAbiVersions(Enum): LATEST_WRAP_MANIFEST_VERSION = "0.1" LATEST_WRAP_ABI_VERSION = "0.1" + +__all__ = [ + # Options + "DeserializeManifestOptions", + # Enums + "WrapManifestVersions", + "WrapManifestAbiVersions", + "WrapAbiVersions", + # Concrete Versions + "WrapManifest_0_1", + "WrapAbi_0_1_0_1", + # Any Versions + "AnyWrapManifest", + "AnyWrapAbi", + # Latest Versions + "WrapManifest", + "WrapAbi", + # Latest Version constants + "LATEST_WRAP_MANIFEST_VERSION", + "LATEST_WRAP_ABI_VERSION", +] diff --git a/packages/polywrap-manifest/pyproject.toml b/packages/polywrap-manifest/pyproject.toml index 50a097e0..075f9bd9 100644 --- a/packages/polywrap-manifest/pyproject.toml +++ b/packages/polywrap-manifest/pyproject.toml @@ -12,7 +12,7 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" pydantic = "^1.10.2" -polywrap-msgpack = "^0.1.0a29" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} [tool.poetry.dev-dependencies] pytest = "^7.1.2" pytest-asyncio = "^0.19.0" diff --git a/packages/polywrap-msgpack/poetry.lock b/packages/polywrap-msgpack/poetry.lock index 7dbf4f2a..797d9ad8 100644 --- a/packages/polywrap-msgpack/poetry.lock +++ b/packages/polywrap-msgpack/poetry.lock @@ -2,14 +2,14 @@ [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.4" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.4-py3-none-any.whl", hash = "sha256:a1b8543ef9d36ea777194bc9b17f5f8678d2c56ee6a45b2c2f17eec96f242347"}, + {file = "astroid-2.15.4.tar.gz", hash = "sha256:c81e1c7fbac615037744d067a9bb5f9aeb655edf59b63ee8b59585475d6f80d8"}, ] [package.dependencies] @@ -128,63 +128,63 @@ files = [ [[package]] name = "coverage" -version = "7.2.3" +version = "7.2.5" description = "Code coverage measurement for Python" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "coverage-7.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e58c0d41d336569d63d1b113bd573db8363bc4146f39444125b7f8060e4e04f5"}, - {file = "coverage-7.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:344e714bd0fe921fc72d97404ebbdbf9127bac0ca1ff66d7b79efc143cf7c0c4"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:974bc90d6f6c1e59ceb1516ab00cf1cdfbb2e555795d49fa9571d611f449bcb2"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0743b0035d4b0e32bc1df5de70fba3059662ace5b9a2a86a9f894cfe66569013"}, - {file = "coverage-7.2.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5d0391fb4cfc171ce40437f67eb050a340fdbd0f9f49d6353a387f1b7f9dd4fa"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:4a42e1eff0ca9a7cb7dc9ecda41dfc7cbc17cb1d02117214be0561bd1134772b"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:be19931a8dcbe6ab464f3339966856996b12a00f9fe53f346ab3be872d03e257"}, - {file = "coverage-7.2.3-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:72fcae5bcac3333a4cf3b8f34eec99cea1187acd55af723bcbd559adfdcb5535"}, - {file = "coverage-7.2.3-cp310-cp310-win32.whl", hash = "sha256:aeae2aa38395b18106e552833f2a50c27ea0000122bde421c31d11ed7e6f9c91"}, - {file = "coverage-7.2.3-cp310-cp310-win_amd64.whl", hash = "sha256:83957d349838a636e768251c7e9979e899a569794b44c3728eaebd11d848e58e"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:dfd393094cd82ceb9b40df4c77976015a314b267d498268a076e940fe7be6b79"}, - {file = "coverage-7.2.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:182eb9ac3f2b4874a1f41b78b87db20b66da6b9cdc32737fbbf4fea0c35b23fc"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1bb1e77a9a311346294621be905ea8a2c30d3ad371fc15bb72e98bfcfae532df"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ca0f34363e2634deffd390a0fef1aa99168ae9ed2af01af4a1f5865e362f8623"}, - {file = "coverage-7.2.3-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:55416d7385774285b6e2a5feca0af9652f7f444a4fa3d29d8ab052fafef9d00d"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:06ddd9c0249a0546997fdda5a30fbcb40f23926df0a874a60a8a185bc3a87d93"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:fff5aaa6becf2c6a1699ae6a39e2e6fb0672c2d42eca8eb0cafa91cf2e9bd312"}, - {file = "coverage-7.2.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ea53151d87c52e98133eb8ac78f1206498c015849662ca8dc246255265d9c3c4"}, - {file = "coverage-7.2.3-cp311-cp311-win32.whl", hash = "sha256:8f6c930fd70d91ddee53194e93029e3ef2aabe26725aa3c2753df057e296b925"}, - {file = "coverage-7.2.3-cp311-cp311-win_amd64.whl", hash = "sha256:fa546d66639d69aa967bf08156eb8c9d0cd6f6de84be9e8c9819f52ad499c910"}, - {file = "coverage-7.2.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2317d5ed777bf5a033e83d4f1389fd4ef045763141d8f10eb09a7035cee774c"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be9824c1c874b73b96288c6d3de793bf7f3a597770205068c6163ea1f326e8b9"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2c3b2803e730dc2797a017335827e9da6da0e84c745ce0f552e66400abdfb9a1"}, - {file = "coverage-7.2.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f69770f5ca1994cb32c38965e95f57504d3aea96b6c024624fdd5bb1aa494a1"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1127b16220f7bfb3f1049ed4a62d26d81970a723544e8252db0efde853268e21"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:aa784405f0c640940595fa0f14064d8e84aff0b0f762fa18393e2760a2cf5841"}, - {file = "coverage-7.2.3-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:3146b8e16fa60427e03884301bf8209221f5761ac754ee6b267642a2fd354c48"}, - {file = "coverage-7.2.3-cp37-cp37m-win32.whl", hash = "sha256:1fd78b911aea9cec3b7e1e2622c8018d51c0d2bbcf8faaf53c2497eb114911c1"}, - {file = "coverage-7.2.3-cp37-cp37m-win_amd64.whl", hash = "sha256:0f3736a5d34e091b0a611964c6262fd68ca4363df56185902528f0b75dbb9c1f"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:981b4df72c93e3bc04478153df516d385317628bd9c10be699c93c26ddcca8ab"}, - {file = "coverage-7.2.3-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c0045f8f23a5fb30b2eb3b8a83664d8dc4fb58faddf8155d7109166adb9f2040"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f760073fcf8f3d6933178d67754f4f2d4e924e321f4bb0dcef0424ca0215eba1"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c86bd45d1659b1ae3d0ba1909326b03598affbc9ed71520e0ff8c31a993ad911"}, - {file = "coverage-7.2.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:172db976ae6327ed4728e2507daf8a4de73c7cc89796483e0a9198fd2e47b462"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:d2a3a6146fe9319926e1d477842ca2a63fe99af5ae690b1f5c11e6af074a6b5c"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:f649dd53833b495c3ebd04d6eec58479454a1784987af8afb77540d6c1767abd"}, - {file = "coverage-7.2.3-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:7c4ed4e9f3b123aa403ab424430b426a1992e6f4c8fd3cb56ea520446e04d152"}, - {file = "coverage-7.2.3-cp38-cp38-win32.whl", hash = "sha256:eb0edc3ce9760d2f21637766c3aa04822030e7451981ce569a1b3456b7053f22"}, - {file = "coverage-7.2.3-cp38-cp38-win_amd64.whl", hash = "sha256:63cdeaac4ae85a179a8d6bc09b77b564c096250d759eed343a89d91bce8b6367"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:20d1a2a76bb4eb00e4d36b9699f9b7aba93271c9c29220ad4c6a9581a0320235"}, - {file = "coverage-7.2.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4ea748802cc0de4de92ef8244dd84ffd793bd2e7be784cd8394d557a3c751e21"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:21b154aba06df42e4b96fc915512ab39595105f6c483991287021ed95776d934"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:fd214917cabdd6f673a29d708574e9fbdb892cb77eb426d0eae3490d95ca7859"}, - {file = "coverage-7.2.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c2e58e45fe53fab81f85474e5d4d226eeab0f27b45aa062856c89389da2f0d9"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:87ecc7c9a1a9f912e306997ffee020297ccb5ea388421fe62a2a02747e4d5539"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:387065e420aed3c71b61af7e82c7b6bc1c592f7e3c7a66e9f78dd178699da4fe"}, - {file = "coverage-7.2.3-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ea3f5bc91d7d457da7d48c7a732beaf79d0c8131df3ab278e6bba6297e23c6c4"}, - {file = "coverage-7.2.3-cp39-cp39-win32.whl", hash = "sha256:ae7863a1d8db6a014b6f2ff9c1582ab1aad55a6d25bac19710a8df68921b6e30"}, - {file = "coverage-7.2.3-cp39-cp39-win_amd64.whl", hash = "sha256:3f04becd4fcda03c0160d0da9c8f0c246bc78f2f7af0feea1ec0930e7c93fa4a"}, - {file = "coverage-7.2.3-pp37.pp38.pp39-none-any.whl", hash = "sha256:965ee3e782c7892befc25575fa171b521d33798132692df428a09efacaffe8d0"}, - {file = "coverage-7.2.3.tar.gz", hash = "sha256:d298c2815fa4891edd9abe5ad6e6cb4207104c7dd9fd13aea3fdebf6f9b91259"}, + {file = "coverage-7.2.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:883123d0bbe1c136f76b56276074b0c79b5817dd4238097ffa64ac67257f4b6c"}, + {file = "coverage-7.2.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d2fbc2a127e857d2f8898aaabcc34c37771bf78a4d5e17d3e1f5c30cd0cbc62a"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f3671662dc4b422b15776cdca89c041a6349b4864a43aa2350b6b0b03bbcc7f"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780551e47d62095e088f251f5db428473c26db7829884323e56d9c0c3118791a"}, + {file = "coverage-7.2.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:066b44897c493e0dcbc9e6a6d9f8bbb6607ef82367cf6810d387c09f0cd4fe9a"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b9a4ee55174b04f6af539218f9f8083140f61a46eabcaa4234f3c2a452c4ed11"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:706ec567267c96717ab9363904d846ec009a48d5f832140b6ad08aad3791b1f5"}, + {file = "coverage-7.2.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ae453f655640157d76209f42c62c64c4d4f2c7f97256d3567e3b439bd5c9b06c"}, + {file = "coverage-7.2.5-cp310-cp310-win32.whl", hash = "sha256:f81c9b4bd8aa747d417407a7f6f0b1469a43b36a85748145e144ac4e8d303cb5"}, + {file = "coverage-7.2.5-cp310-cp310-win_amd64.whl", hash = "sha256:dc945064a8783b86fcce9a0a705abd7db2117d95e340df8a4333f00be5efb64c"}, + {file = "coverage-7.2.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:40cc0f91c6cde033da493227797be2826cbf8f388eaa36a0271a97a332bfd7ce"}, + {file = "coverage-7.2.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a66e055254a26c82aead7ff420d9fa8dc2da10c82679ea850d8feebf11074d88"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c10fbc8a64aa0f3ed136b0b086b6b577bc64d67d5581acd7cc129af52654384e"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9a22cbb5ede6fade0482111fa7f01115ff04039795d7092ed0db43522431b4f2"}, + {file = "coverage-7.2.5-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:292300f76440651529b8ceec283a9370532f4ecba9ad67d120617021bb5ef139"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:7ff8f3fb38233035028dbc93715551d81eadc110199e14bbbfa01c5c4a43f8d8"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:a08c7401d0b24e8c2982f4e307124b671c6736d40d1c39e09d7a8687bddf83ed"}, + {file = "coverage-7.2.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:ef9659d1cda9ce9ac9585c045aaa1e59223b143f2407db0eaee0b61a4f266fb6"}, + {file = "coverage-7.2.5-cp311-cp311-win32.whl", hash = "sha256:30dcaf05adfa69c2a7b9f7dfd9f60bc8e36b282d7ed25c308ef9e114de7fc23b"}, + {file = "coverage-7.2.5-cp311-cp311-win_amd64.whl", hash = "sha256:97072cc90f1009386c8a5b7de9d4fc1a9f91ba5ef2146c55c1f005e7b5c5e068"}, + {file = "coverage-7.2.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:bebea5f5ed41f618797ce3ffb4606c64a5de92e9c3f26d26c2e0aae292f015c1"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:828189fcdda99aae0d6bf718ea766b2e715eabc1868670a0a07bf8404bf58c33"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6e8a95f243d01ba572341c52f89f3acb98a3b6d1d5d830efba86033dd3687ade"}, + {file = "coverage-7.2.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e8834e5f17d89e05697c3c043d3e58a8b19682bf365048837383abfe39adaed5"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:d1f25ee9de21a39b3a8516f2c5feb8de248f17da7eead089c2e04aa097936b47"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1637253b11a18f453e34013c665d8bf15904c9e3c44fbda34c643fbdc9d452cd"}, + {file = "coverage-7.2.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8e575a59315a91ccd00c7757127f6b2488c2f914096077c745c2f1ba5b8c0969"}, + {file = "coverage-7.2.5-cp37-cp37m-win32.whl", hash = "sha256:509ecd8334c380000d259dc66feb191dd0a93b21f2453faa75f7f9cdcefc0718"}, + {file = "coverage-7.2.5-cp37-cp37m-win_amd64.whl", hash = "sha256:12580845917b1e59f8a1c2ffa6af6d0908cb39220f3019e36c110c943dc875b0"}, + {file = "coverage-7.2.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b5016e331b75310610c2cf955d9f58a9749943ed5f7b8cfc0bb89c6134ab0a84"}, + {file = "coverage-7.2.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:373ea34dca98f2fdb3e5cb33d83b6d801007a8074f992b80311fc589d3e6b790"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a063aad9f7b4c9f9da7b2550eae0a582ffc7623dca1c925e50c3fbde7a579771"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:38c0a497a000d50491055805313ed83ddba069353d102ece8aef5d11b5faf045"}, + {file = "coverage-7.2.5-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2b3b05e22a77bb0ae1a3125126a4e08535961c946b62f30985535ed40e26614"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:0342a28617e63ad15d96dca0f7ae9479a37b7d8a295f749c14f3436ea59fdcb3"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf97ed82ca986e5c637ea286ba2793c85325b30f869bf64d3009ccc1a31ae3fd"}, + {file = "coverage-7.2.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:c2c41c1b1866b670573657d584de413df701f482574bad7e28214a2362cb1fd1"}, + {file = "coverage-7.2.5-cp38-cp38-win32.whl", hash = "sha256:10b15394c13544fce02382360cab54e51a9e0fd1bd61ae9ce012c0d1e103c813"}, + {file = "coverage-7.2.5-cp38-cp38-win_amd64.whl", hash = "sha256:a0b273fe6dc655b110e8dc89b8ec7f1a778d78c9fd9b4bda7c384c8906072212"}, + {file = "coverage-7.2.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5c587f52c81211d4530fa6857884d37f514bcf9453bdeee0ff93eaaf906a5c1b"}, + {file = "coverage-7.2.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:4436cc9ba5414c2c998eaedee5343f49c02ca93b21769c5fdfa4f9d799e84200"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6599bf92f33ab041e36e06d25890afbdf12078aacfe1f1d08c713906e49a3fe5"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:857abe2fa6a4973f8663e039ead8d22215d31db613ace76e4a98f52ec919068e"}, + {file = "coverage-7.2.5-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f6f5cab2d7f0c12f8187a376cc6582c477d2df91d63f75341307fcdcb5d60303"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:aa387bd7489f3e1787ff82068b295bcaafbf6f79c3dad3cbc82ef88ce3f48ad3"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:156192e5fd3dbbcb11cd777cc469cf010a294f4c736a2b2c891c77618cb1379a"}, + {file = "coverage-7.2.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:bd3b4b8175c1db502adf209d06136c000df4d245105c8839e9d0be71c94aefe1"}, + {file = "coverage-7.2.5-cp39-cp39-win32.whl", hash = "sha256:ddc5a54edb653e9e215f75de377354e2455376f416c4378e1d43b08ec50acc31"}, + {file = "coverage-7.2.5-cp39-cp39-win_amd64.whl", hash = "sha256:338aa9d9883aaaad53695cb14ccdeb36d4060485bb9388446330bef9c361c252"}, + {file = "coverage-7.2.5-pp37.pp38.pp39-none-any.whl", hash = "sha256:8877d9b437b35a85c18e3c6499b23674684bf690f5d96c1006a1ef61f9fdf0f3"}, + {file = "coverage-7.2.5.tar.gz", hash = "sha256:f99ef080288f09ffc687423b8d60978cf3a465d3f404a18d1a05474bd8575a47"}, ] [package.dependencies] @@ -252,19 +252,19 @@ testing = ["pre-commit"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -298,14 +298,14 @@ gitdb = ">=4.0.1,<5" [[package]] name = "hypothesis" -version = "6.72.0" +version = "6.75.2" description = "A library for property-based testing" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "hypothesis-6.72.0-py3-none-any.whl", hash = "sha256:12d2a7d72eed477701f66ca48e5b212ea49e2e57ad63903d9bc36f08a5ca2bdb"}, - {file = "hypothesis-6.72.0.tar.gz", hash = "sha256:1fb102fe1fdf5c00206507e2719ddfa118d84cf4b9799ef5c28e4aff020964e0"}, + {file = "hypothesis-6.75.2-py3-none-any.whl", hash = "sha256:29fee1fabf764eb021665d20e633ef7ba931c5841de20f9ff3e01e8a512d6a4d"}, + {file = "hypothesis-6.75.2.tar.gz", hash = "sha256:50c270b38d724ce0fefa71b8e3511d123f7a31a9af9ea003447d4e1489292fbc"}, ] [package.dependencies] @@ -314,7 +314,7 @@ exceptiongroup = {version = ">=1.0.0", markers = "python_version < \"3.11\""} sortedcontainers = ">=2.1.0,<3.0.0" [package.extras] -all = ["backports.zoneinfo (>=0.2.1)", "black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "importlib-metadata (>=3.6)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.9.0)", "pandas (>=1.0)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2023.3)"] +all = ["backports.zoneinfo (>=0.2.1)", "black (>=19.10b0)", "click (>=7.0)", "django (>=3.2)", "dpcontracts (>=0.4)", "importlib-metadata (>=3.6)", "lark (>=0.10.1)", "libcst (>=0.3.16)", "numpy (>=1.16.0)", "pandas (>=1.1)", "pytest (>=4.6)", "python-dateutil (>=1.4)", "pytz (>=2014.1)", "redis (>=3.0.0)", "rich (>=9.0.0)", "tzdata (>=2023.3)"] cli = ["black (>=19.10b0)", "click (>=7.0)", "rich (>=9.0.0)"] codemods = ["libcst (>=0.3.16)"] dateutil = ["python-dateutil (>=1.4)"] @@ -322,8 +322,8 @@ django = ["django (>=3.2)"] dpcontracts = ["dpcontracts (>=0.4)"] ghostwriter = ["black (>=19.10b0)"] lark = ["lark (>=0.10.1)"] -numpy = ["numpy (>=1.9.0)"] -pandas = ["pandas (>=1.0)"] +numpy = ["numpy (>=1.16.0)"] +pandas = ["pandas (>=1.1)"] pytest = ["pytest (>=4.6)"] pytz = ["pytz (>=2014.1)"] redis = ["redis (>=3.0.0)"] @@ -652,19 +652,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"}, + {file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -733,14 +733,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -748,18 +748,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -777,14 +777,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.306" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.306-py3-none-any.whl", hash = "sha256:008eb2a29584ae274a154d749cf81476a3073fb562a462eac8d43a753378b9db"}, + {file = "pyright-1.1.306.tar.gz", hash = "sha256:16d5d198be64de497d5f9002000a271176c381e21b977ca5566cf779b643c9ed"}, ] [package.dependencies] @@ -927,14 +927,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -946,14 +946,14 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.7.2" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, ] [package.extras] @@ -1050,14 +1050,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1157,24 +1157,24 @@ typing-extensions = ">=3.7.4" [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wrapt" diff --git a/packages/polywrap-msgpack/polywrap_msgpack/__init__.py b/packages/polywrap-msgpack/polywrap_msgpack/__init__.py index fbf10d10..5d8019c8 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/__init__.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/__init__.py @@ -12,18 +12,3 @@ from .errors import * from .extensions import * from .sanitize import * - -__all__ = [ - "msgpack_decode", - "msgpack_encode", - "decode_ext_hook", - "encode_ext_hook", - "sanitize", - "ExtensionTypes", - "GenericMap", - "MsgpackError", - "MsgpackDecodeError", - "MsgpackEncodeError", - "MsgpackExtError", - "MsgpackSanitizeError", -] diff --git a/packages/polywrap-msgpack/polywrap_msgpack/decoder.py b/packages/polywrap-msgpack/polywrap_msgpack/decoder.py index 9d78a9d7..5de64824 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/decoder.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/decoder.py @@ -10,7 +10,7 @@ from .extensions import ExtensionTypes, GenericMap -def decode_ext_hook(code: int, data: bytes) -> Any: +def _decode_ext_hook(code: int, data: bytes) -> Any: """Extension hook for extending the msgpack supported types. Args: @@ -30,7 +30,7 @@ def decode_ext_hook(code: int, data: bytes) -> Any: def msgpack_decode(val: bytes) -> Any: - """Decode msgpack bytes into a valid python object. + r"""Decode msgpack bytes into a valid python object. Args: val (bytes): msgpack encoded bytes @@ -41,10 +41,30 @@ def msgpack_decode(val: bytes) -> Any: Returns: Any: any python object + + Examples: + >>> from polywrap_msgpack import msgpack_encode + >>> from polywrap_msgpack import msgpack_decode + >>> from polywrap_msgpack import GenericMap + >>> msgpack_decode(msgpack_encode({"a": 1})) + {'a': 1} + >>> msgpack_decode(msgpack_encode(GenericMap({"a": 1}))) + GenericMap({'a': 1}) + >>> msgpack_decode(msgpack_encode([{"a": 2}, {"b": 4}])) + [{'a': 2}, {'b': 4}] + >>> msgpack_decode(b"\xc1") + Traceback (most recent call last): + ... + polywrap_msgpack.errors.MsgpackDecodeError: Failed to decode msgpack data """ try: - return msgpack.unpackb( - val, ext_hook=decode_ext_hook - ) # pyright: reportUnknownMemberType=false + return msgpack.unpackb( # pyright: ignore[reportUnknownMemberType] + val, ext_hook=_decode_ext_hook + ) except Exception as e: raise MsgpackDecodeError("Failed to decode msgpack data") from e + + +__all__ = [ + "msgpack_decode", +] diff --git a/packages/polywrap-msgpack/polywrap_msgpack/encoder.py b/packages/polywrap-msgpack/polywrap_msgpack/encoder.py index a74642b1..a210ca0e 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/encoder.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/encoder.py @@ -12,7 +12,7 @@ from .sanitize import sanitize -def encode_ext_hook(obj: Any) -> ExtType: +def _encode_ext_hook(obj: Any) -> ExtType: """Extension hook for extending the msgpack supported types. Args: @@ -28,23 +28,41 @@ def encode_ext_hook(obj: Any) -> ExtType: return ExtType( ExtensionTypes.GENERIC_MAP.value, # pylint: disable=protected-access - msgpack_encode(cast(GenericMap[Any, Any], obj)._map), - ) # pyright: reportPrivateUsage=false + msgpack_encode( + cast( + GenericMap[Any, Any], obj + )._map # pyright: ignore[reportPrivateUsage] + ), + ) raise MsgpackExtError(f"Object of type {type(obj)} is not supported") def msgpack_encode(value: Any) -> bytes: - """Encode any python object into msgpack bytes. + r"""Encode any python object into msgpack bytes. Args: value (Any): any valid python object Raises: + MsgpackExtError: when given object is not a supported extension type MsgpackEncodeError: when sanitized object is not msgpack serializable MsgpackSanitizeError: when given object is not sanitizable Returns: bytes: encoded msgpack value + + Examples: + >>> from polywrap_msgpack import msgpack_encode + >>> from polywrap_msgpack import msgpack_decode + >>> from polywrap_msgpack import GenericMap + >>> msgpack_encode({"a": 1}) + b'\x81\xa1a\x01' + >>> msgpack_encode(GenericMap({"a": 1})) + b'\xd6\x01\x81\xa1a\x01' + >>> msgpack_encode({1.0: 1}) + Traceback (most recent call last): + ... + polywrap_msgpack.errors.MsgpackSanitizeError: Failed to sanitize object """ try: sanitized = sanitize(value) @@ -52,6 +70,11 @@ def msgpack_encode(value: Any) -> bytes: raise MsgpackSanitizeError("Failed to sanitize object") from e try: - return msgpack.packb(sanitized, default=encode_ext_hook, use_bin_type=True) + return msgpack.packb(sanitized, default=_encode_ext_hook, use_bin_type=True) except Exception as e: raise MsgpackEncodeError("Failed to encode object") from e + + +__all__ = [ + "msgpack_encode", +] diff --git a/packages/polywrap-msgpack/polywrap_msgpack/errors.py b/packages/polywrap-msgpack/polywrap_msgpack/errors.py index c008c6e0..ab0540bd 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/errors.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/errors.py @@ -20,3 +20,12 @@ class MsgpackExtError(MsgpackError): class MsgpackSanitizeError(MsgpackError): """Raised when there is an error sanitizing a python object\ into a msgpack encoder compatible format.""" + + +__all__ = [ + "MsgpackError", + "MsgpackDecodeError", + "MsgpackEncodeError", + "MsgpackExtError", + "MsgpackSanitizeError", +] diff --git a/packages/polywrap-msgpack/polywrap_msgpack/extensions/generic_map.py b/packages/polywrap-msgpack/polywrap_msgpack/extensions/generic_map.py index ec6c294f..01bb974e 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/extensions/generic_map.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/extensions/generic_map.py @@ -6,7 +6,34 @@ class GenericMap(MutableMapping[K, V]): - """GenericMap is a type that can be used to represent generic map extension type in msgpack.""" + """GenericMap is a type that can be used to represent generic map extension type in msgpack. + + Examples: + >>> from polywrap_msgpack import GenericMap + >>> GenericMap({1: 2, 3: 4}) + GenericMap({1: 2, 3: 4}) + >>> map = GenericMap({1: 2, 3: 4}) + >>> map[5] = 6 + >>> map + GenericMap({1: 2, 3: 4, 5: 6}) + >>> map[7] + Traceback (most recent call last): + ... + KeyError: 7 + >>> 7 in map + False + >>> 1 in map + True + >>> len(map) + 3 + >>> del map[1] + >>> map + GenericMap({3: 4, 5: 6}) + >>> del map[7] + Traceback (most recent call last): + ... + KeyError: 7 + """ _map: Dict[K, V] diff --git a/packages/polywrap-msgpack/polywrap_msgpack/sanitize.py b/packages/polywrap-msgpack/polywrap_msgpack/sanitize.py index e2982e36..6c7407a2 100644 --- a/packages/polywrap-msgpack/polywrap_msgpack/sanitize.py +++ b/packages/polywrap-msgpack/polywrap_msgpack/sanitize.py @@ -18,11 +18,34 @@ def sanitize(value: Any) -> Any: Returns: Any: msgpack compatible sanitized value + + Examples: + >>> sanitize({"a": 1}) + {'a': 1} + >>> sanitize({1, 2, 3}) + [1, 2, 3] + >>> sanitize((1, 2, 3)) + [1, 2, 3] + >>> sanitize([{1}, (2, 3), [4]]) + [[1], [2, 3], [4]] + >>> class Foo: pass + >>> foo = Foo() + >>> foo.bar = 1 + >>> sanitize(foo) + {'bar': 1} + >>> sanitize({1: 1}) + Traceback (most recent call last): + ... + ValueError: Dict key must be string, got 1 of type + >>> sanitize(GenericMap({1: 2})) + Traceback (most recent call last): + ... + ValueError: GenericMap key must be string, got 1 of type """ if isinstance(value, GenericMap): dictionary: Dict[Any, Any] = cast( GenericMap[Any, Any], value - )._map # pyright: reportPrivateUsage=false + )._map # pyright: ignore[reportPrivateUsage] new_map: GenericMap[str, Any] = GenericMap({}) for key, val in dictionary.items(): if not isinstance(key, str): @@ -61,3 +84,6 @@ def sanitize(value: Any) -> Any: if hasattr(value, "__dict__"): return {k: sanitize(v) for k, v in cast(Dict[Any, Any], vars(value)).items()} return value + + +__all__ = ["sanitize"] diff --git a/packages/polywrap-msgpack/tests/run_doctest.py b/packages/polywrap-msgpack/tests/run_doctest.py new file mode 100644 index 00000000..3fc4848e --- /dev/null +++ b/packages/polywrap-msgpack/tests/run_doctest.py @@ -0,0 +1,24 @@ +# test_all.py +import doctest +from typing import Any +import unittest +import pkgutil +import polywrap_msgpack + +def load_tests(loader: Any, tests: Any, ignore: Any) -> Any: + """Load doctests and return TestSuite object.""" + modules = pkgutil.walk_packages( + path=polywrap_msgpack.__path__, + prefix=f"{polywrap_msgpack.__name__}.", + onerror=lambda x: None, + ) + for _, modname, _ in modules: + try: + module = __import__(modname, fromlist="dummy") + tests.addTests(doctest.DocTestSuite(module)) + except (ImportError, ValueError, AttributeError): + continue + return tests + +if __name__ == "__main__": + unittest.main() diff --git a/packages/polywrap-msgpack/tox.ini b/packages/polywrap-msgpack/tox.ini index 3f8af3b6..aab2128e 100644 --- a/packages/polywrap-msgpack/tox.ini +++ b/packages/polywrap-msgpack/tox.ini @@ -10,7 +10,7 @@ commands = commands = isort --check-only polywrap_msgpack black --check polywrap_msgpack - pycln --check polywrap_msgpack --disable-all-dunder-policy + ; pycln --check polywrap_msgpack --disable-all-dunder-policy pylint polywrap_msgpack pydocstyle polywrap_msgpack @@ -26,4 +26,4 @@ commands = commands = isort polywrap_msgpack black polywrap_msgpack - pycln polywrap_msgpack --disable-all-dunder-policy + ; pycln polywrap_msgpack --disable-all-dunder-policy diff --git a/packages/polywrap-plugin/README.md b/packages/polywrap-plugin/README.md index 00bdf773..01a90aa4 100644 --- a/packages/polywrap-plugin/README.md +++ b/packages/polywrap-plugin/README.md @@ -1,4 +1,4 @@ -# polywrap-wasm +# polywrap-plugin Python implementation of the plugin wrapper runtime. @@ -10,7 +10,7 @@ Python implementation of the plugin wrapper runtime. from typing import Any, Dict, List, Union, Optional from polywrap_manifest import AnyWrapManifest from polywrap_plugin import PluginModule -from polywrap_core import Invoker, Uri, InvokerOptions, UriPackageOrWrapper, Env +from polywrap_core import InvokerClient, Uri, InvokerOptions, UriPackageOrWrapper, Env class GreetingModule(PluginModule[None]): def __init__(self, config: None): @@ -24,13 +24,13 @@ wrapper = PluginWrapper(greeting_module, manifest) args = { "name": "Joe" } -options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions( +client: InvokerClient = ... + +result = await wrapper.invoke( uri=Uri.from_str("ens/greeting.eth"), method="greeting", - args=args + args=args, + client=client ) -invoker: Invoker = ... - -result = await wrapper.invoke(options, invoker) assert result, "Greetings from: Joe" ``` diff --git a/packages/polywrap-plugin/node_modules/.yarn-integrity b/packages/polywrap-plugin/node_modules/.yarn-integrity deleted file mode 100644 index 103d87c5..00000000 --- a/packages/polywrap-plugin/node_modules/.yarn-integrity +++ /dev/null @@ -1,30 +0,0 @@ -{ - "systemParams": "darwin-arm64-93", - "modulesFolders": [], - "flags": [], - "linkedModules": [ - "@coordinape/hardhat", - "@polywrap/client-js", - "@polywrap/core-js", - "@polywrap/msgpack-js", - "@polywrap/polywrap-manifest-types-js", - "@polywrap/schema-bind", - "@polywrap/schema-compose", - "@polywrap/schema-parse", - "@polywrap/wrap-manifest-types-js", - "@web3api/cli", - "@web3api/client-js", - "@web3api/core-js", - "@web3api/ethereum-plugin-js", - "@web3api/ipfs-plugin-js", - "@web3api/schema-bind", - "@web3api/schema-compose", - "@web3api/test-env-js", - "@web3api/wasm-as", - "polywrap" - ], - "topLevelPatterns": [], - "lockfileEntries": {}, - "files": [], - "artifacts": {} -} \ No newline at end of file diff --git a/packages/polywrap-plugin/poetry.lock b/packages/polywrap-plugin/poetry.lock index f28b17c1..97b7dda8 100644 --- a/packages/polywrap-plugin/poetry.lock +++ b/packages/polywrap-plugin/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.5" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.5-py3-none-any.whl", hash = "sha256:078e5212f9885fa85fbb0cf0101978a336190aadea6e13305409d099f71b2324"}, + {file = "astroid-2.15.5.tar.gz", hash = "sha256:1039262575027b441137ab4a62a793a9b43defb42c32d5670f38686207cd780f"}, ] [package.dependencies] @@ -151,19 +151,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -273,42 +273,41 @@ files = [ [[package]] name = "libcst" -version = "0.4.9" +version = "0.4.10" description = "A concrete syntax tree with AST-like properties for Python 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10 programs." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "libcst-0.4.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4f9e42085c403e22201e5c41e707ef73e4ea910ad9fc67983ceee2368097f54e"}, - {file = "libcst-0.4.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1266530bf840cc40633a04feb578bb4cac1aa3aea058cc3729e24eab09a8e996"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9679177391ccb9b0cdde3185c22bf366cb672457c4b7f4031fcb3b5e739fbd6"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d67bc87e0d8db9434f2ea063734938a320f541f4c6da1074001e372f840f385d"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e316da5a126f2a9e1d7680f95f907b575f082a35e2f8bd5620c59b2aaaebfe0a"}, - {file = "libcst-0.4.9-cp310-cp310-win_amd64.whl", hash = "sha256:7415569ab998a85b0fc9af3a204611ea7fadb2d719a12532c448f8fc98f5aca4"}, - {file = "libcst-0.4.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:15ded11ff7f4572f91635e02b519ae959f782689fdb4445bbebb7a3cc5c71d75"}, - {file = "libcst-0.4.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b266867b712a120fad93983de432ddb2ccb062eb5fd2bea748c9a94cb200c36"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045b3b0b06413cdae6e9751b5f417f789ffa410f2cb2815e3e0e0ea6bef10ec0"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e799add8fba4976628b9c1a6768d73178bf898f0ed1bd1322930c2d3db9063ba"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:10479371d04ee8dc978c889c1774bbf6a83df88fa055fcb0159a606f6679c565"}, - {file = "libcst-0.4.9-cp311-cp311-win_amd64.whl", hash = "sha256:7a98286cbbfa90a42d376900c875161ad02a5a2a6b7c94c0f7afd9075e329ce4"}, - {file = "libcst-0.4.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:400166fc4efb9aa06ce44498d443aa78519082695b1894202dd73cd507d2d712"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46123863fba35cc84f7b54dd68826419cabfd9504d8a101c7fe3313ea03776f9"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27be8db54c0e5fe440021a771a38b81a7dbc23cd630eb8b0e9828b7717f9b702"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:132bec627b064bd567e7e4cd6c89524d02842151eb0d8f5f3f7ffd2579ec1b09"}, - {file = "libcst-0.4.9-cp37-cp37m-win_amd64.whl", hash = "sha256:596860090aeed3ee6ad1e59c35c6c4110a57e4e896abf51b91cae003ec720a11"}, - {file = "libcst-0.4.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f4487608258109f774300466d4ca97353df29ae6ac23d1502e13e5509423c9d5"}, - {file = "libcst-0.4.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:aa53993e9a2853efb3ed3605da39f2e7125df6430f613eb67ef886c1ce4f94b5"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f6ce794483d4c605ef0f5b199a49fb6996f9586ca938b7bfef213bd13858d7ab"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:786e562b54bbcd17a060d1244deeef466b7ee07fe544074c252c4a169e38f1ee"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:794250d2359edd518fb698e5d21c38a5bdfc5e4a75d0407b4c19818271ce6742"}, - {file = "libcst-0.4.9-cp38-cp38-win_amd64.whl", hash = "sha256:76491f67431318c3145442e97dddcead7075b074c59eac51be7cc9e3fffec6ee"}, - {file = "libcst-0.4.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3cf48d7aec6dc54b02aec0b1bb413c5bb3b02d852fd6facf1f05c7213e61a176"}, - {file = "libcst-0.4.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9b3348c6b7711a5235b133bd8e11d22e903c388db42485b8ceb5f2aa0fae9b9f"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7e33b66762efaa014c38819efae5d8f726dd823e32d5d691035484411d2a2a69"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1350d375d3fb9b20a6cf10c09b2964baca9be753a033dde7c1aced49d8e58387"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3822056dc13326082362db35b3f649e0f4a97e36ddb4e487441da8e0fb9db7b3"}, - {file = "libcst-0.4.9-cp39-cp39-win_amd64.whl", hash = "sha256:183636141b839aa35b639e100883813744523bc7c12528906621121731b28443"}, - {file = "libcst-0.4.9.tar.gz", hash = "sha256:01786c403348f76f274dbaf3888ae237ffb73e6ed6973e65eba5c1fc389861dd"}, + {file = "libcst-0.4.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8fa0ec646ed7bce984d0ee9dbf514af278050bdb16a4fb986e916ace534eebc6"}, + {file = "libcst-0.4.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3cb3b7821eac00713844cda079583230c546a589b22ed5f03f2ddc4f985c384b"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7acfa747112ae40b032739661abd7c81aff37191294f7c2dab8bbd72372e78f"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1312e293b864ef3cb4b09534ed5f104c2dc45b680233c68bf76237295041c781"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:76884b1afe475e8e68e704bf26eb9f9a2867029643e58f2f26a0286e3b6e998e"}, + {file = "libcst-0.4.10-cp310-cp310-win_amd64.whl", hash = "sha256:1069b808a711db5cd47538f27eb2c73206317aa0d8b5a3500b23aab24f86eb2e"}, + {file = "libcst-0.4.10-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:50be085346a35812535c7f876319689e15a7bfd1bd8efae8fd70589281d944b6"}, + {file = "libcst-0.4.10-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bb9f10e5763e361e8bd8ff765fc0f1bcf744f242ff8b6d3e50ffec4dda3972ac"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfeeabb528b5df7b4be1817b584ce79e9a1a66687bd72f6de9c22272462812f1"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5648aeae8c90a2abab1f7b1bf205769a0179ed2cfe1ea7f681f6885e87b8b193"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a144f20aff4643b00374facf8409d30c7935db8176e5b2a07e1fd44004db2c1f"}, + {file = "libcst-0.4.10-cp311-cp311-win_amd64.whl", hash = "sha256:a10adc2e8ea2dda2b70eabec631ead2fc4a7a7ab633d6c2b690823c698b8431a"}, + {file = "libcst-0.4.10-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:58fe90458a26a55358207f74abf8a05dff51d662069f070b4bd308a000a80c09"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:999fbbe467f61cbce9e6e054f86cd1c5ffa3740fd3dc8ebdd600db379f699256"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:83ee7e7be4efac4c140a97d772e1f6b3553f98fa5f46ad78df5dfe51e5a4aa4d"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:158478e8f45578fb26621b3dc0fe275f9e004297e9afdcf08936ecda05681174"}, + {file = "libcst-0.4.10-cp37-cp37m-win_amd64.whl", hash = "sha256:5ed101fee1af7abea3684fcff7fab5b170ceea4040756f54c15c870539daec66"}, + {file = "libcst-0.4.10-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:349f2b4ee4b982fe254c65c78d941fc96299f3c422b79f95ef8c7bba2b7f0f90"}, + {file = "libcst-0.4.10-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7cfa4d4beb84d0d63247aca27f1a15c63984512274c5b23040f8b4ba511036d7"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:24582506da24e31f2644f862f11413a6b80fbad68d15194bfcc3f7dfebf2ec5e"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cdf2d0157438d3d52d310b0b6be31ff99bed19de489b2ebd3e2a4cd9946da45"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a677103d2f1ab0e50bc3a7cc6c96c7d64bcbac826d785e4cbf5ee9aaa9fcfa25"}, + {file = "libcst-0.4.10-cp38-cp38-win_amd64.whl", hash = "sha256:a8fdfd4a7d301adb785aa4b98e4a7cca45c5ff8cfb460b485d081efcfaaeeab7"}, + {file = "libcst-0.4.10-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b1569d87536bed4e9c11dd5c94a137dc0bce2a2b05961489c6016bf4521bb7cf"}, + {file = "libcst-0.4.10-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:72dff8783ac79cd10f2bd2fde0b28f262e9a22718ae26990948ba6131b85ca8b"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76adc53660ef094ff83f77a2550a7e00d1cab8e5e63336e071c17c09b5a89fe2"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3e9d9fdd9a9b9b8991936ff1c07527ce7ef396c8233280ba9a7137e72c2e48e"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7e1b4cbaf7b1cdad5fa3eababe42d5b46c0d52afe13c5ba4eac2495fc57630ea"}, + {file = "libcst-0.4.10-cp39-cp39-win_amd64.whl", hash = "sha256:bcbd07cec3d7a7be6f0299b0c246e085e3d6cc8af367e2c96059183b97c2e2fe"}, ] [package.dependencies] @@ -317,7 +316,7 @@ typing-extensions = ">=3.7.4.2" typing-inspect = ">=0.4.0" [package.extras] -dev = ["Sphinx (>=5.1.1)", "black (==22.10.0)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8,<5)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "jinja2 (==3.1.2)", "jupyter (>=1.0.0)", "maturin (>=0.8.3,<0.14)", "nbsphinx (>=0.4.2)", "prompt-toolkit (>=2.0.9)", "pyre-check (==0.9.9)", "setuptools-rust (>=1.5.2)", "setuptools-scm (>=6.0.1)", "slotscheck (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "ufmt (==2.0.1)", "usort (==1.0.5)"] +dev = ["Sphinx (>=5.1.1)", "black (==23.1.0)", "build (>=0.10.0)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8,<5)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "jinja2 (==3.1.2)", "jupyter (>=1.0.0)", "maturin (>=0.8.3,<0.14)", "nbsphinx (>=0.4.2)", "prompt-toolkit (>=2.0.9)", "pyre-check (==0.9.10)", "setuptools-rust (>=1.5.2)", "setuptools-scm (>=6.0.1)", "slotscheck (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "ufmt (==2.1.0)", "usort (==1.0.6)"] [[package]] name = "markdown-it-py" @@ -455,14 +454,14 @@ files = [ [[package]] name = "nodeenv" -version = "1.7.0" +version = "1.8.0" description = "Node.js virtual environment builder" category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ - {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, - {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, ] [package.dependencies] @@ -506,19 +505,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, + {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -542,15 +541,17 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_core-0.1.0a29-py3-none-any.whl", hash = "sha256:ea3111a0a2a4287c0f7a180fd7bb024530e720cd5ec97767b52502679d42a097"}, - {file = "polywrap_core-0.1.0a29.tar.gz", hash = "sha256:b879c8b621eaa4ae5ad1cc48a6b304596fe9586163395782584207886e793eba"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-core" [[package]] name = "polywrap-manifest" @@ -558,15 +559,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -574,14 +577,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "py" @@ -687,14 +692,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -702,18 +707,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -731,14 +736,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.309" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.309-py3-none-any.whl", hash = "sha256:a8b052c1997f7334e80074998ea0f93bd149550e8cf27ccb5481d3b2e1aad161"}, + {file = "pyright-1.1.309.tar.gz", hash = "sha256:1abcfa83814d792a5d70b38621cc6489acfade94ebb2279e55ba1f394d54296c"}, ] [package.dependencies] @@ -841,14 +846,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -860,19 +865,19 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.8.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] @@ -913,14 +918,14 @@ files = [ [[package]] name = "stevedore" -version = "5.0.0" +version = "5.1.0" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false python-versions = ">=3.8" files = [ - {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, - {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, + {file = "stevedore-5.1.0-py3-none-any.whl", hash = "sha256:8cc040628f3cea5d7128f2e76cf486b2251a4e543c7b938f58d9a377f6694a2d"}, + {file = "stevedore-5.1.0.tar.gz", hash = "sha256:a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c"}, ] [package.dependencies] @@ -952,14 +957,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1031,14 +1036,14 @@ test = ["black (>=22.3.0,<23.0.0)", "coverage (>=6.2,<7.0)", "isort (>=5.0.6,<6. [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.0" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.0-py3-none-any.whl", hash = "sha256:6ad00b63f849b7dcc313b70b6b304ed67b2b2963b3098a33efe18056b1a9a223"}, + {file = "typing_extensions-4.6.0.tar.gz", hash = "sha256:ff6b238610c747e44c268aa4bb23c8c735d665a63726df3f9431ce707f2aa768"}, ] [[package]] @@ -1059,24 +1064,24 @@ typing-extensions = ">=3.7.4" [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wrapt" @@ -1166,4 +1171,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "0cde3f4675f7c42b7976d1b2f14e8ecca5c453782a388416a9206cb3939c92ce" +content-hash = "53aac71c5c265f0b9e4c5b59213df4bb56fbebc32d573f959ca08d74b3d5a8d9" diff --git a/packages/polywrap-plugin/polywrap_plugin/module.py b/packages/polywrap-plugin/polywrap_plugin/module.py index 8fe6ec06..4af8484b 100644 --- a/packages/polywrap-plugin/polywrap_plugin/module.py +++ b/packages/polywrap-plugin/polywrap_plugin/module.py @@ -1,52 +1,76 @@ """This module contains the PluginModule class.""" # pylint: disable=invalid-name from abc import ABC -from typing import Any, Generic, TypeVar +from dataclasses import dataclass +from typing import Any, Generic, Optional, TypeVar from polywrap_core import ( - InvokeOptions, - Invoker, - UriPackageOrWrapper, + InvokerClient, + Uri, + UriResolutionContext, WrapAbortError, WrapInvocationError, - execute_maybe_async_function, ) from polywrap_msgpack import msgpack_decode TConfig = TypeVar("TConfig") +@dataclass(kw_only=True, slots=True) +class PluginInvokeOptions: + """PluginInvokeOptions is a dataclass that holds the options for an invocation. + + Args: + uri (URI): The URI of the wrapper. + method (str): The method to invoke. + args (Optional[Any]): The arguments to pass to the method. + env (Optional[Any]): The environment variables to set\ + for the invocation. + resolution_context (Optional[UriResolutionContext]): \ + A URI resolution context. + client (Optional[InvokerClient]): The client to use\ + for subinvocations. + """ + + uri: Uri + method: str + args: Optional[Any] = None + env: Optional[Any] = None + resolution_context: Optional[UriResolutionContext] = None + client: Optional[InvokerClient] = None + + class PluginModule(Generic[TConfig], ABC): """PluginModule is the base class for all plugin modules. - Attributes: - config: The configuration of the plugin. + Args: + config (TConfig): The configuration of the plugin. """ config: TConfig def __init__(self, config: TConfig): - """Initialize a new PluginModule instance. - - Args: - config: The configuration of the plugin. - """ + """Initialize a new PluginModule instance.""" self.config = config - async def __wrap_invoke__( + def __wrap_invoke__( self, - options: InvokeOptions[UriPackageOrWrapper], - invoker: Invoker[UriPackageOrWrapper], + options: PluginInvokeOptions, ) -> Any: """Invoke a method on the plugin. Args: - method: The name of the method to invoke. - args: The arguments to pass to the method. - invoker: The invoker to use for subinvocations. + options (PluginInvokeOptions): The options\ + to use when invoking the plugin. Returns: - The result of the plugin method invocation or an error. + The result of the plugin method invocation. + + Raises: + WrapInvocationError: If the plugin method is not defined\ + or is not callable. + WrapAbortError: If the plugin method raises an exception. + MsgpackDecodeError: If the plugin method returns invalid msgpack. """ if not hasattr(self, options.method): raise WrapInvocationError( @@ -61,11 +85,12 @@ async def __wrap_invoke__( if isinstance(options.args, bytes) else options.args ) - return await execute_maybe_async_function( - callable_method, decoded_args, invoker, options.env - ) + return callable_method(decoded_args, options.client, options.env) except Exception as err: raise WrapAbortError(options, repr(err)) from err raise WrapInvocationError( options, f"{options.method} is not a callable method in plugin module" ) + + +__all__ = ["PluginModule"] diff --git a/packages/polywrap-plugin/polywrap_plugin/package.py b/packages/polywrap-plugin/polywrap_plugin/package.py index 609da1ad..ef18d9c5 100644 --- a/packages/polywrap-plugin/polywrap_plugin/package.py +++ b/packages/polywrap-plugin/polywrap_plugin/package.py @@ -2,8 +2,8 @@ # pylint: disable=invalid-name from typing import Generic, Optional, TypeVar -from polywrap_core import GetManifestOptions, UriPackageOrWrapper, WrapPackage, Wrapper -from polywrap_manifest import AnyWrapManifest +from polywrap_core import WrapPackage, Wrapper +from polywrap_manifest import AnyWrapManifest, DeserializeManifestOptions from .module import PluginModule from .wrapper import PluginWrapper @@ -11,33 +11,28 @@ TConfig = TypeVar("TConfig") -class PluginPackage(Generic[TConfig], WrapPackage[UriPackageOrWrapper]): +class PluginPackage(WrapPackage, Generic[TConfig]): """PluginPackage implements IWrapPackage interface for the plugin. - Attributes: - module: The plugin module. - manifest: The manifest of the plugin. + Args: + module (PluginModule[TConfig]): The plugin module. + manifest (AnyWrapManifest): The manifest of the plugin. """ module: PluginModule[TConfig] manifest: AnyWrapManifest def __init__(self, module: PluginModule[TConfig], manifest: AnyWrapManifest): - """Initialize a new PluginPackage instance. - - Args: - module: The plugin module. - manifest: The manifest of the plugin. - """ + """Initialize a new PluginPackage instance.""" self.module = module self.manifest = manifest - async def create_wrapper(self) -> Wrapper[UriPackageOrWrapper]: + def create_wrapper(self) -> Wrapper: """Create a new plugin wrapper instance.""" return PluginWrapper(module=self.module, manifest=self.manifest) - async def get_manifest( - self, options: Optional[GetManifestOptions] = None + def get_manifest( + self, options: Optional[DeserializeManifestOptions] = None ) -> AnyWrapManifest: """Get the manifest of the plugin. @@ -48,3 +43,6 @@ async def get_manifest( The manifest of the plugin. """ return self.manifest + + +__all__ = ["PluginPackage"] diff --git a/packages/polywrap-plugin/polywrap_plugin/resolution_context_override_client.py b/packages/polywrap-plugin/polywrap_plugin/resolution_context_override_client.py new file mode 100644 index 00000000..53456685 --- /dev/null +++ b/packages/polywrap-plugin/polywrap_plugin/resolution_context_override_client.py @@ -0,0 +1,91 @@ +"""This module defines the ResolutionContextOverrideClient class.""" +from typing import Any, List, Optional + +from polywrap_core import InvokerClient, Uri, UriResolutionContext + + +class ResolutionContextOverrideClient(InvokerClient): + """A client that overrides the resolution context of the wrapped client. + + Args: + client (InvokerClient): The wrapped client. + resolution_context (Optional[UriResolutionContext]): \ + The resolution context to use. + """ + + client: InvokerClient + resolution_context: Optional[UriResolutionContext] + + __slots__ = ("client", "resolution_context") + + def __init__( + self, client: InvokerClient, resolution_context: Optional[UriResolutionContext] + ): + """Initialize a new ResolutionContextOverrideClient instance.""" + self.client = client + self.resolution_context = resolution_context + + def invoke( + self, + uri: Uri, + method: str, + args: Optional[Any] = None, + env: Optional[Any] = None, + resolution_context: Optional[UriResolutionContext] = None, + encode_result: Optional[bool] = False, + ) -> Any: + """Invoke the Wrapper based on the provided InvokerOptions. + + Args: + uri (Uri): Uri of the wrapper + method (str): Method to be executed + args (Optional[Any]) : Arguments for the method, structured as a dictionary + env (Optional[Any]): Override the client's config for all invokes within this invoke. + resolution_context (Optional[UriResolutionContext]): A URI resolution context + encode_result (Optional[bool]): If True, the result will be encoded + + Returns: + Any: invocation result. + + Raises: + WrapInvocationError: If the plugin method is not defined\ + or is not callable. + WrapAbortError: If the plugin method raises an exception. + MsgpackDecodeError: If the plugin method returns invalid msgpack. + """ + return self.client.invoke( + uri, + method, + args, + env, + self.resolution_context, + encode_result, + ) + + def get_implementations( + self, uri: Uri, apply_resolution: bool = True + ) -> Optional[List[Uri]]: + """Get implementations of an interface with its URI. + + Args: + uri (Uri): URI of the interface. + apply_resolution (bool): If True, apply resolution to the URI and interfaces. + + Returns: + Optional[List[Uri]]: List of implementations or None if not found. + """ + return self.client.get_implementations(uri, apply_resolution) + + def try_resolve_uri( + self, uri: Uri, resolution_context: UriResolutionContext | None = None + ) -> Any: + """Try to resolve a URI to a wrap package, a wrapper, or a URI. + + Args: + uri (Uri): The URI to resolve. + resolution_context (UriResolutionContext): The resolution context. + + Returns: + Any: URI Resolution Result. + """ + return self.client.try_resolve_uri(uri, self.resolution_context) diff --git a/packages/polywrap-plugin/polywrap_plugin/wrapper.py b/packages/polywrap-plugin/polywrap_plugin/wrapper.py index 49604e45..d8b9dd9d 100644 --- a/packages/polywrap-plugin/polywrap_plugin/wrapper.py +++ b/packages/polywrap-plugin/polywrap_plugin/wrapper.py @@ -1,29 +1,30 @@ """This module contains the PluginWrapper class.""" # pylint: disable=invalid-name -from typing import Generic, TypeVar, Union +# pylint: disable=too-many-arguments +from typing import Any, Generic, Optional, TypeVar, Union from polywrap_core import ( - GetFileOptions, InvocableResult, - InvokeOptions, - Invoker, - UriPackageOrWrapper, + InvokerClient, + Uri, + UriResolutionContext, Wrapper, ) from polywrap_manifest import AnyWrapManifest -from .module import PluginModule +from .module import PluginInvokeOptions, PluginModule +from .resolution_context_override_client import ResolutionContextOverrideClient TConfig = TypeVar("TConfig") TResult = TypeVar("TResult") -class PluginWrapper(Generic[TConfig], Wrapper[UriPackageOrWrapper]): +class PluginWrapper(Wrapper, Generic[TConfig]): """PluginWrapper implements the Wrapper interface for plugin wrappers. - Attributes: - module: The plugin module. - manifest: The manifest of the plugin. + Args: + module (PluginModule[TConfig]): The plugin module. + manifest (AnyWrapManifest): The manifest of the plugin. """ module: PluginModule[TConfig] @@ -32,40 +33,66 @@ class PluginWrapper(Generic[TConfig], Wrapper[UriPackageOrWrapper]): def __init__( self, module: PluginModule[TConfig], manifest: AnyWrapManifest ) -> None: - """Initialize a new PluginWrapper instance. - - Args: - module: The plugin module. - manifest: The manifest of the plugin. - """ + """Initialize a new PluginWrapper instance.""" self.module = module self.manifest = manifest - async def invoke( + def invoke( self, - options: InvokeOptions[UriPackageOrWrapper], - invoker: Invoker[UriPackageOrWrapper], + uri: Uri, + method: str, + args: Optional[Any] = None, + env: Optional[Any] = None, + resolution_context: Optional[UriResolutionContext] = None, + client: Optional[InvokerClient] = None, ) -> InvocableResult: - """Invoke a method on the plugin. + """Invoke the Wrapper based on the provided InvokeOptions. Args: - options (InvokeOptions): options to use when invoking the plugin. - invoker (Invoker): the invoker to use when invoking the plugin. + uri (Uri): Uri of the wrapper + method (str): Method to be executed + args (Optional[Any]) : Arguments for the method, structured as a dictionary + env (Optional[Any]): Override the client's config for all invokes within this invoke. + resolution_context (Optional[UriResolutionContext]): A URI resolution context + client (Optional[Invoker]): The invoker instance requesting this invocation.\ + This invoker will be used for any subinvocation that may occur. Returns: - Result[InvocableResult]: the result of the invocation. + InvocableResult: Result of the invocation. + + Raises: + WrapInvocationError: If the plugin method is not defined\ + or is not callable. + WrapAbortError: If the plugin method raises an exception. + MsgpackDecodeError: If the plugin method returns invalid msgpack. """ - result = await self.module.__wrap_invoke__(options, invoker) + options = PluginInvokeOptions( + uri=uri, + method=method, + args=args, + env=env, + resolution_context=resolution_context, + client=ResolutionContextOverrideClient(client, resolution_context) + if client + else None, + ) + result = self.module.__wrap_invoke__(options) return InvocableResult(result=result, encoded=False) - async def get_file(self, options: GetFileOptions) -> Union[str, bytes]: - """Get a file from the plugin. + def get_file( + self, path: str, encoding: Optional[str] = "utf-8" + ) -> Union[str, bytes]: + """Get a file from the wrapper. Args: - options (GetFileOptions): options to use when getting the file. + path (str): Path to the file. + encoding (Optional[str]): Encoding of the file. Returns: - Result[Union[str, bytes]]: the file contents or an error. + Union[str, bytes]: The file contents + + Raises: + NotImplementedError: This method is not implemented for plugins. """ raise NotImplementedError("client.get_file(..) is not implemented for plugins") @@ -76,3 +103,6 @@ def get_manifest(self) -> AnyWrapManifest: Result[AnyWrapManifest]: the manifest of the plugin. """ return self.manifest + + +__all__ = ["PluginWrapper"] diff --git a/packages/polywrap-plugin/pyproject.toml b/packages/polywrap-plugin/pyproject.toml index 8c20bdd5..2f579e76 100644 --- a/packages/polywrap-plugin/pyproject.toml +++ b/packages/polywrap-plugin/pyproject.toml @@ -11,9 +11,9 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -polywrap-msgpack = "^0.1.0a29" -polywrap-manifest = "^0.1.0a29" -polywrap-core = "^0.1.0a29" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-core = {path = "../polywrap-core", develop = true} [tool.poetry.dev-dependencies] pytest = "^7.1.2" pytest-asyncio = "^0.19.0" @@ -50,6 +50,7 @@ disable = [ "too-many-return-statements", "broad-exception-caught", "too-few-public-methods", + "too-many-arguments", ] ignore = [ "tests/" diff --git a/packages/polywrap-plugin/tests/conftest.py b/packages/polywrap-plugin/tests/conftest.py index 6fc7aa3b..d15900c0 100644 --- a/packages/polywrap-plugin/tests/conftest.py +++ b/packages/polywrap-plugin/tests/conftest.py @@ -2,15 +2,15 @@ from typing import Any, Dict, List, Union, Optional from polywrap_plugin import PluginModule -from polywrap_core import Invoker, Uri, InvokerOptions, UriPackageOrWrapper, Env +from polywrap_core import InvokerClient, Uri @fixture -def invoker() -> Invoker[UriPackageOrWrapper]: - class MockInvoker(Invoker[UriPackageOrWrapper]): - async def invoke(self, options: InvokerOptions[UriPackageOrWrapper]) -> Any: +def client() -> InvokerClient: + class MockInvoker(InvokerClient): + async def invoke(self, *args: Any) -> Any: raise NotImplementedError() - def get_implementations(self, uri: Uri) -> Union[List[Uri], None]: + def get_implementations(self, *args: Any) -> Union[List[Uri], None]: raise NotImplementedError() return MockInvoker() @@ -22,7 +22,7 @@ class GreetingModule(PluginModule[None]): def __init__(self, config: None): super().__init__(config) - def greeting(self, args: Dict[str, Any], client: Invoker[UriPackageOrWrapper], env: Optional[Env] = None): + def greeting(self, args: Dict[str, Any], client: InvokerClient, env: Optional[Any] = None): return f"Greetings from: {args['name']}" return GreetingModule(None) \ No newline at end of file diff --git a/packages/polywrap-plugin/tests/test_plugin_module.py b/packages/polywrap-plugin/tests/test_plugin_module.py index ef18454b..c61d619c 100644 --- a/packages/polywrap-plugin/tests/test_plugin_module.py +++ b/packages/polywrap-plugin/tests/test_plugin_module.py @@ -1,16 +1,14 @@ -import pytest -from polywrap_core import Invoker, Uri, UriPackageOrWrapper, InvokeOptions +from polywrap_core import InvokerClient, Uri from polywrap_plugin import PluginModule +from polywrap_plugin.module import PluginInvokeOptions -@pytest.mark.asyncio -async def test_plugin_module( - greeting_module: PluginModule[None], invoker: Invoker[UriPackageOrWrapper] +def test_plugin_module( + greeting_module: PluginModule[None], client: InvokerClient ): - result = await greeting_module.__wrap_invoke__( - InvokeOptions( - uri=Uri.from_str("plugin/greeting"), method="greeting", args={"name": "Joe"} + result = greeting_module.__wrap_invoke__( + PluginInvokeOptions( + uri=Uri.from_str("plugin/greeting"), method="greeting", args={"name": "Joe"}, client=client ), - invoker, ) assert result, "Greetings from: Joe" diff --git a/packages/polywrap-plugin/tests/test_plugin_package.py b/packages/polywrap-plugin/tests/test_plugin_package.py index aa4dc9f4..5af64b23 100644 --- a/packages/polywrap-plugin/tests/test_plugin_package.py +++ b/packages/polywrap-plugin/tests/test_plugin_package.py @@ -1,24 +1,31 @@ from typing import cast -import pytest -from polywrap_core import InvokeOptions, Uri, Invoker, UriPackageOrWrapper +from polywrap_core import Uri, InvokerClient from polywrap_manifest import AnyWrapManifest from polywrap_plugin import PluginPackage, PluginModule -@pytest.mark.asyncio -async def test_plugin_package_invoke(greeting_module: PluginModule[None], invoker: Invoker[UriPackageOrWrapper]): +def test_plugin_package_invoke( + greeting_module: PluginModule[None], client: InvokerClient +): manifest = cast(AnyWrapManifest, {}) plugin_package = PluginPackage(greeting_module, manifest) - wrapper = await plugin_package.create_wrapper() - args = { - "name": "Joe" - } - options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions( + wrapper = plugin_package.create_wrapper() + args = {"name": "Joe"} + + result = wrapper.invoke( uri=Uri.from_str("ens/greeting.eth"), method="greeting", - args=args + args=args, + client=client, ) + assert result, "Greetings from: Joe" + - result = await wrapper.invoke(options, invoker) - assert result, "Greetings from: Joe" \ No newline at end of file +def test_plugin_package_get_manifest( + greeting_module: PluginModule[None], client: InvokerClient +): + manifest = cast(AnyWrapManifest, {}) + plugin_package = PluginPackage(greeting_module, manifest) + + assert plugin_package.get_manifest() is manifest diff --git a/packages/polywrap-plugin/tests/test_plugin_wrapper.py b/packages/polywrap-plugin/tests/test_plugin_wrapper.py index 779b7328..25dcd8cf 100644 --- a/packages/polywrap-plugin/tests/test_plugin_wrapper.py +++ b/packages/polywrap-plugin/tests/test_plugin_wrapper.py @@ -1,24 +1,48 @@ from typing import cast -import pytest -from polywrap_core import InvokeOptions, Uri, Invoker, UriPackageOrWrapper +from polywrap_core import Uri, InvokerClient from polywrap_manifest import AnyWrapManifest from polywrap_plugin import PluginWrapper, PluginModule +import pytest -@pytest.mark.asyncio -async def test_plugin_wrapper_invoke(greeting_module: PluginModule[None], invoker: Invoker[UriPackageOrWrapper]): + +def test_plugin_wrapper_invoke( + greeting_module: PluginModule[None], client: InvokerClient +): manifest = cast(AnyWrapManifest, {}) wrapper = PluginWrapper(greeting_module, manifest) - args = { - "name": "Joe" - } - options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions( + args = {"name": "Joe"} + + result = wrapper.invoke( uri=Uri.from_str("ens/greeting.eth"), method="greeting", - args=args + args=args, + client=client, ) + assert result, "Greetings from: Joe" + + +def test_plugin_wrapper_get_file( + greeting_module: PluginModule[None], client: InvokerClient +): + manifest = cast(AnyWrapManifest, {}) + + wrapper = PluginWrapper(greeting_module, manifest) + + with pytest.raises(NotImplementedError): + wrapper.get_file( + path="greeting.txt", + encoding="utf-8", + ) + + +def test_plugin_wrapper_manifest( + greeting_module: PluginModule[None], client: InvokerClient +): + manifest = cast(AnyWrapManifest, {}) + + wrapper = PluginWrapper(greeting_module, manifest) - result = await wrapper.invoke(options, invoker) - assert result, "Greetings from: Joe" \ No newline at end of file + assert wrapper.manifest is manifest diff --git a/packages/polywrap-test-cases/.gitignore b/packages/polywrap-test-cases/.gitignore new file mode 100644 index 00000000..4faabeff --- /dev/null +++ b/packages/polywrap-test-cases/.gitignore @@ -0,0 +1 @@ +wrappers/ \ No newline at end of file diff --git a/packages/polywrap-test-cases/README.md b/packages/polywrap-test-cases/README.md new file mode 100644 index 00000000..75dc5edc --- /dev/null +++ b/packages/polywrap-test-cases/README.md @@ -0,0 +1,3 @@ +# polywrap-test-cases + +This package allows fetching wrap test-cases from the wrap-test-harness. diff --git a/packages/polywrap-test-cases/poetry.lock b/packages/polywrap-test-cases/poetry.lock new file mode 100644 index 00000000..204c9efd --- /dev/null +++ b/packages/polywrap-test-cases/poetry.lock @@ -0,0 +1,996 @@ +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "astroid" +version = "2.15.4" +description = "An abstract syntax tree for Python with inference support." +category = "dev" +optional = false +python-versions = ">=3.7.2" +files = [ + {file = "astroid-2.15.4-py3-none-any.whl", hash = "sha256:a1b8543ef9d36ea777194bc9b17f5f8678d2c56ee6a45b2c2f17eec96f242347"}, + {file = "astroid-2.15.4.tar.gz", hash = "sha256:c81e1c7fbac615037744d067a9bb5f9aeb655edf59b63ee8b59585475d6f80d8"}, +] + +[package.dependencies] +lazy-object-proxy = ">=1.4.0" +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} +wrapt = [ + {version = ">=1.11,<2", markers = "python_version < \"3.11\""}, + {version = ">=1.14,<2", markers = "python_version >= \"3.11\""}, +] + +[[package]] +name = "bandit" +version = "1.7.5" +description = "Security oriented static analyser for python code." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "bandit-1.7.5-py3-none-any.whl", hash = "sha256:75665181dc1e0096369112541a056c59d1c5f66f9bb74a8d686c3c362b83f549"}, + {file = "bandit-1.7.5.tar.gz", hash = "sha256:bdfc739baa03b880c2d15d0431b31c658ffc348e907fe197e54e0389dd59e11e"}, +] + +[package.dependencies] +colorama = {version = ">=0.3.9", markers = "platform_system == \"Windows\""} +GitPython = ">=1.0.1" +PyYAML = ">=5.3.1" +rich = "*" +stevedore = ">=1.20.0" +tomli = {version = ">=1.1.0", optional = true, markers = "python_version < \"3.11\" and extra == \"toml\""} + +[package.extras] +test = ["beautifulsoup4 (>=4.8.0)", "coverage (>=4.5.4)", "fixtures (>=3.0.0)", "flake8 (>=4.0.0)", "pylint (==1.9.4)", "stestr (>=2.5.0)", "testscenarios (>=0.5.0)", "testtools (>=2.3.0)", "tomli (>=1.1.0)"] +toml = ["tomli (>=1.1.0)"] +yaml = ["PyYAML"] + +[[package]] +name = "black" +version = "22.12.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "black-22.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9eedd20838bd5d75b80c9f5487dbcb06836a43833a37846cf1d8c1cc01cef59d"}, + {file = "black-22.12.0-cp310-cp310-win_amd64.whl", hash = "sha256:159a46a4947f73387b4d83e87ea006dbb2337eab6c879620a3ba52699b1f4351"}, + {file = "black-22.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d30b212bffeb1e252b31dd269dfae69dd17e06d92b87ad26e23890f3efea366f"}, + {file = "black-22.12.0-cp311-cp311-win_amd64.whl", hash = "sha256:7412e75863aa5c5411886804678b7d083c7c28421210180d67dfd8cf1221e1f4"}, + {file = "black-22.12.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c116eed0efb9ff870ded8b62fe9f28dd61ef6e9ddd28d83d7d264a38417dcee2"}, + {file = "black-22.12.0-cp37-cp37m-win_amd64.whl", hash = "sha256:1f58cbe16dfe8c12b7434e50ff889fa479072096d79f0a7f25e4ab8e94cd8350"}, + {file = "black-22.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:77d86c9f3db9b1bf6761244bc0b3572a546f5fe37917a044e02f3166d5aafa7d"}, + {file = "black-22.12.0-cp38-cp38-win_amd64.whl", hash = "sha256:82d9fe8fee3401e02e79767016b4907820a7dc28d70d137eb397b92ef3cc5bfc"}, + {file = "black-22.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:101c69b23df9b44247bd88e1d7e90154336ac4992502d4197bdac35dd7ee3320"}, + {file = "black-22.12.0-cp39-cp39-win_amd64.whl", hash = "sha256:559c7a1ba9a006226f09e4916060982fd27334ae1998e7a38b3f33a37f7a2148"}, + {file = "black-22.12.0-py3-none-any.whl", hash = "sha256:436cc9167dd28040ad90d3b404aec22cedf24a6e4d7de221bec2730ec0c97bcf"}, + {file = "black-22.12.0.tar.gz", hash = "sha256:229351e5a18ca30f447bf724d007f890f97e13af070bb6ad4c0a441cd7596a2f"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +pathspec = ">=0.9.0" +platformdirs = ">=2" +tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + +[[package]] +name = "click" +version = "8.1.3" +description = "Composable command line interface toolkit" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, + {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "dill" +version = "0.3.6" +description = "serialize all of python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "dill-0.3.6-py3-none-any.whl", hash = "sha256:a07ffd2351b8c678dfc4a856a3005f8067aea51d6ba6c700796a4d9e280f39f0"}, + {file = "dill-0.3.6.tar.gz", hash = "sha256:e5db55f3687856d8fbdab002ed78544e1c4559a130302693d839dfe8f93f2373"}, +] + +[package.extras] +graph = ["objgraph (>=1.7.2)"] + +[[package]] +name = "distlib" +version = "0.3.6" +description = "Distribution utilities" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.6-py2.py3-none-any.whl", hash = "sha256:f35c4b692542ca110de7ef0bea44d73981caeb34ca0b9b6b2e6d7790dda8f80e"}, + {file = "distlib-0.3.6.tar.gz", hash = "sha256:14bad2d9b04d3a36127ac97f30b12a19268f211063d8f8ee4f47108896e11b46"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.1" +description = "Backport of PEP 654 (exception groups)" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"}, + {file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "filelock" +version = "3.12.0" +description = "A platform independent file lock." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, +] + +[package.extras] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] + +[[package]] +name = "gitdb" +version = "4.0.10" +description = "Git Object Database" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "gitdb-4.0.10-py3-none-any.whl", hash = "sha256:c286cf298426064079ed96a9e4a9d39e7f3e9bf15ba60701e95f5492f28415c7"}, + {file = "gitdb-4.0.10.tar.gz", hash = "sha256:6eb990b69df4e15bad899ea868dc46572c3f75339735663b81de79b06f17eb9a"}, +] + +[package.dependencies] +smmap = ">=3.0.1,<6" + +[[package]] +name = "gitpython" +version = "3.1.31" +description = "GitPython is a Python library used to interact with Git repositories" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "GitPython-3.1.31-py3-none-any.whl", hash = "sha256:f04893614f6aa713a60cbbe1e6a97403ef633103cdd0ef5eb6efe0deb98dbe8d"}, + {file = "GitPython-3.1.31.tar.gz", hash = "sha256:8ce3bcf69adfdf7c7d503e78fd3b1c492af782d58893b650adb2ac8912ddd573"}, +] + +[package.dependencies] +gitdb = ">=4.0.1,<5" + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "isort" +version = "5.12.0" +description = "A Python utility / library to sort Python imports." +category = "dev" +optional = false +python-versions = ">=3.8.0" +files = [ + {file = "isort-5.12.0-py3-none-any.whl", hash = "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"}, + {file = "isort-5.12.0.tar.gz", hash = "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504"}, +] + +[package.extras] +colors = ["colorama (>=0.4.3)"] +pipfile-deprecated-finder = ["pip-shims (>=0.5.2)", "pipreqs", "requirementslib"] +plugins = ["setuptools"] +requirements-deprecated-finder = ["pip-api", "pipreqs"] + +[[package]] +name = "lazy-object-proxy" +version = "1.9.0" +description = "A fast and thorough lazy object proxy." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "lazy-object-proxy-1.9.0.tar.gz", hash = "sha256:659fb5809fa4629b8a1ac5106f669cfc7bef26fbb389dda53b3e010d1ac4ebae"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b40387277b0ed2d0602b8293b94d7257e17d1479e257b4de114ea11a8cb7f2d7"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e8c6cfb338b133fbdbc5cfaa10fe3c6aeea827db80c978dbd13bc9dd8526b7d4"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:721532711daa7db0d8b779b0bb0318fa87af1c10d7fe5e52ef30f8eff254d0cd"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:66a3de4a3ec06cd8af3f61b8e1ec67614fbb7c995d02fa224813cb7afefee701"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1aa3de4088c89a1b69f8ec0dcc169aa725b0ff017899ac568fe44ddc1396df46"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-win32.whl", hash = "sha256:f0705c376533ed2a9e5e97aacdbfe04cecd71e0aa84c7c0595d02ef93b6e4455"}, + {file = "lazy_object_proxy-1.9.0-cp310-cp310-win_amd64.whl", hash = "sha256:ea806fd4c37bf7e7ad82537b0757999264d5f70c45468447bb2b91afdbe73a6e"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:946d27deaff6cf8452ed0dba83ba38839a87f4f7a9732e8f9fd4107b21e6ff07"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79a31b086e7e68b24b99b23d57723ef7e2c6d81ed21007b6281ebcd1688acb0a"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f699ac1c768270c9e384e4cbd268d6e67aebcfae6cd623b4d7c3bfde5a35db59"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:bfb38f9ffb53b942f2b5954e0f610f1e721ccebe9cce9025a38c8ccf4a5183a4"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:189bbd5d41ae7a498397287c408617fe5c48633e7755287b21d741f7db2706a9"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-win32.whl", hash = "sha256:81fc4d08b062b535d95c9ea70dbe8a335c45c04029878e62d744bdced5141586"}, + {file = "lazy_object_proxy-1.9.0-cp311-cp311-win_amd64.whl", hash = "sha256:f2457189d8257dd41ae9b434ba33298aec198e30adf2dcdaaa3a28b9994f6adb"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:d9e25ef10a39e8afe59a5c348a4dbf29b4868ab76269f81ce1674494e2565a6e"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cbf9b082426036e19c6924a9ce90c740a9861e2bdc27a4834fd0a910742ac1e8"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9f5fa4a61ce2438267163891961cfd5e32ec97a2c444e5b842d574251ade27d2"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:8fa02eaab317b1e9e03f69aab1f91e120e7899b392c4fc19807a8278a07a97e8"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e7c21c95cae3c05c14aafffe2865bbd5e377cfc1348c4f7751d9dc9a48ca4bda"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win32.whl", hash = "sha256:f12ad7126ae0c98d601a7ee504c1122bcef553d1d5e0c3bfa77b16b3968d2734"}, + {file = "lazy_object_proxy-1.9.0-cp37-cp37m-win_amd64.whl", hash = "sha256:edd20c5a55acb67c7ed471fa2b5fb66cb17f61430b7a6b9c3b4a1e40293b1671"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2d0daa332786cf3bb49e10dc6a17a52f6a8f9601b4cf5c295a4f85854d61de63"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9cd077f3d04a58e83d04b20e334f678c2b0ff9879b9375ed107d5d07ff160171"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:660c94ea760b3ce47d1855a30984c78327500493d396eac4dfd8bd82041b22be"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:212774e4dfa851e74d393a2370871e174d7ff0ebc980907723bb67d25c8a7c30"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:f0117049dd1d5635bbff65444496c90e0baa48ea405125c088e93d9cf4525b11"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-win32.whl", hash = "sha256:0a891e4e41b54fd5b8313b96399f8b0e173bbbfc03c7631f01efbe29bb0bcf82"}, + {file = "lazy_object_proxy-1.9.0-cp38-cp38-win_amd64.whl", hash = "sha256:9990d8e71b9f6488e91ad25f322898c136b008d87bf852ff65391b004da5e17b"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9e7551208b2aded9c1447453ee366f1c4070602b3d932ace044715d89666899b"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f83ac4d83ef0ab017683d715ed356e30dd48a93746309c8f3517e1287523ef4"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7322c3d6f1766d4ef1e51a465f47955f1e8123caee67dd641e67d539a534d006"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:18b78ec83edbbeb69efdc0e9c1cb41a3b1b1ed11ddd8ded602464c3fc6020494"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:09763491ce220c0299688940f8dc2c5d05fd1f45af1e42e636b2e8b2303e4382"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-win32.whl", hash = "sha256:9090d8e53235aa280fc9239a86ae3ea8ac58eff66a705fa6aa2ec4968b95c821"}, + {file = "lazy_object_proxy-1.9.0-cp39-cp39-win_amd64.whl", hash = "sha256:db1c1722726f47e10e0b5fdbf15ac3b8adb58c091d12b3ab713965795036985f"}, +] + +[[package]] +name = "libcst" +version = "0.4.9" +description = "A concrete syntax tree with AST-like properties for Python 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10 programs." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "libcst-0.4.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4f9e42085c403e22201e5c41e707ef73e4ea910ad9fc67983ceee2368097f54e"}, + {file = "libcst-0.4.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1266530bf840cc40633a04feb578bb4cac1aa3aea058cc3729e24eab09a8e996"}, + {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9679177391ccb9b0cdde3185c22bf366cb672457c4b7f4031fcb3b5e739fbd6"}, + {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d67bc87e0d8db9434f2ea063734938a320f541f4c6da1074001e372f840f385d"}, + {file = "libcst-0.4.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e316da5a126f2a9e1d7680f95f907b575f082a35e2f8bd5620c59b2aaaebfe0a"}, + {file = "libcst-0.4.9-cp310-cp310-win_amd64.whl", hash = "sha256:7415569ab998a85b0fc9af3a204611ea7fadb2d719a12532c448f8fc98f5aca4"}, + {file = "libcst-0.4.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:15ded11ff7f4572f91635e02b519ae959f782689fdb4445bbebb7a3cc5c71d75"}, + {file = "libcst-0.4.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b266867b712a120fad93983de432ddb2ccb062eb5fd2bea748c9a94cb200c36"}, + {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045b3b0b06413cdae6e9751b5f417f789ffa410f2cb2815e3e0e0ea6bef10ec0"}, + {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e799add8fba4976628b9c1a6768d73178bf898f0ed1bd1322930c2d3db9063ba"}, + {file = "libcst-0.4.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:10479371d04ee8dc978c889c1774bbf6a83df88fa055fcb0159a606f6679c565"}, + {file = "libcst-0.4.9-cp311-cp311-win_amd64.whl", hash = "sha256:7a98286cbbfa90a42d376900c875161ad02a5a2a6b7c94c0f7afd9075e329ce4"}, + {file = "libcst-0.4.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:400166fc4efb9aa06ce44498d443aa78519082695b1894202dd73cd507d2d712"}, + {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46123863fba35cc84f7b54dd68826419cabfd9504d8a101c7fe3313ea03776f9"}, + {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27be8db54c0e5fe440021a771a38b81a7dbc23cd630eb8b0e9828b7717f9b702"}, + {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:132bec627b064bd567e7e4cd6c89524d02842151eb0d8f5f3f7ffd2579ec1b09"}, + {file = "libcst-0.4.9-cp37-cp37m-win_amd64.whl", hash = "sha256:596860090aeed3ee6ad1e59c35c6c4110a57e4e896abf51b91cae003ec720a11"}, + {file = "libcst-0.4.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f4487608258109f774300466d4ca97353df29ae6ac23d1502e13e5509423c9d5"}, + {file = "libcst-0.4.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:aa53993e9a2853efb3ed3605da39f2e7125df6430f613eb67ef886c1ce4f94b5"}, + {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f6ce794483d4c605ef0f5b199a49fb6996f9586ca938b7bfef213bd13858d7ab"}, + {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:786e562b54bbcd17a060d1244deeef466b7ee07fe544074c252c4a169e38f1ee"}, + {file = "libcst-0.4.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:794250d2359edd518fb698e5d21c38a5bdfc5e4a75d0407b4c19818271ce6742"}, + {file = "libcst-0.4.9-cp38-cp38-win_amd64.whl", hash = "sha256:76491f67431318c3145442e97dddcead7075b074c59eac51be7cc9e3fffec6ee"}, + {file = "libcst-0.4.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3cf48d7aec6dc54b02aec0b1bb413c5bb3b02d852fd6facf1f05c7213e61a176"}, + {file = "libcst-0.4.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9b3348c6b7711a5235b133bd8e11d22e903c388db42485b8ceb5f2aa0fae9b9f"}, + {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7e33b66762efaa014c38819efae5d8f726dd823e32d5d691035484411d2a2a69"}, + {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1350d375d3fb9b20a6cf10c09b2964baca9be753a033dde7c1aced49d8e58387"}, + {file = "libcst-0.4.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3822056dc13326082362db35b3f649e0f4a97e36ddb4e487441da8e0fb9db7b3"}, + {file = "libcst-0.4.9-cp39-cp39-win_amd64.whl", hash = "sha256:183636141b839aa35b639e100883813744523bc7c12528906621121731b28443"}, + {file = "libcst-0.4.9.tar.gz", hash = "sha256:01786c403348f76f274dbaf3888ae237ffb73e6ed6973e65eba5c1fc389861dd"}, +] + +[package.dependencies] +pyyaml = ">=5.2" +typing-extensions = ">=3.7.4.2" +typing-inspect = ">=0.4.0" + +[package.extras] +dev = ["Sphinx (>=5.1.1)", "black (==22.10.0)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8,<5)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "jinja2 (==3.1.2)", "jupyter (>=1.0.0)", "maturin (>=0.8.3,<0.14)", "nbsphinx (>=0.4.2)", "prompt-toolkit (>=2.0.9)", "pyre-check (==0.9.9)", "setuptools-rust (>=1.5.2)", "setuptools-scm (>=6.0.1)", "slotscheck (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "ufmt (==2.0.1)", "usort (==1.0.5)"] + +[[package]] +name = "markdown-it-py" +version = "2.2.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "markdown-it-py-2.2.0.tar.gz", hash = "sha256:7c9a5e412688bc771c67432cbfebcdd686c93ce6484913dccf06cb5a0bea35a1"}, + {file = "markdown_it_py-2.2.0-py3-none-any.whl", hash = "sha256:5a35f8d1870171d9acc47b99612dc146129b631baf04970128b568f190d0cc30"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["attrs", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +category = "dev" +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "nodeenv" +version = "1.7.0" +description = "Node.js virtual environment builder" +category = "dev" +optional = false +python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" +files = [ + {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, + {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, +] + +[package.dependencies] +setuptools = "*" + +[[package]] +name = "packaging" +version = "23.1" +description = "Core utilities for Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"}, + {file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"}, +] + +[[package]] +name = "pathspec" +version = "0.10.3" +description = "Utility library for gitignore style pattern matching of file paths." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pathspec-0.10.3-py3-none-any.whl", hash = "sha256:3c95343af8b756205e2aba76e843ba9520a24dd84f68c22b9f93251507509dd6"}, + {file = "pathspec-0.10.3.tar.gz", hash = "sha256:56200de4077d9d0791465aa9095a01d421861e405b5096955051deefd697d6f6"}, +] + +[[package]] +name = "pbr" +version = "5.11.1" +description = "Python Build Reasonableness" +category = "dev" +optional = false +python-versions = ">=2.6" +files = [ + {file = "pbr-5.11.1-py2.py3-none-any.whl", hash = "sha256:567f09558bae2b3ab53cb3c1e2e33e726ff3338e7bae3db5dc954b3a44eef12b"}, + {file = "pbr-5.11.1.tar.gz", hash = "sha256:aefc51675b0b533d56bb5fd1c8c6c0522fe31896679882e1c4c63d5e4a0fccb3"}, +] + +[[package]] +name = "platformdirs" +version = "3.5.0" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"}, + {file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"}, +] + +[package.extras] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pluggy" +version = "1.0.0" +description = "plugin and hook calling mechanisms for python" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pluggy-1.0.0-py2.py3-none-any.whl", hash = "sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"}, + {file = "pluggy-1.0.0.tar.gz", hash = "sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, +] + +[[package]] +name = "pycln" +version = "2.1.3" +description = "A formatter for finding and removing unused import statements." +category = "dev" +optional = false +python-versions = ">=3.6.2,<4" +files = [ + {file = "pycln-2.1.3-py3-none-any.whl", hash = "sha256:161142502e4ff9853cd462a38401e29eb56235919856df2cb7fa4c84e463717f"}, + {file = "pycln-2.1.3.tar.gz", hash = "sha256:a33bfc64ded74a623b7cf49eca38b58db4348facc60c35af26d45de149b256f5"}, +] + +[package.dependencies] +libcst = {version = ">=0.3.10,<0.5.0", markers = "python_version >= \"3.7\""} +pathspec = ">=0.9.0,<0.11.0" +pyyaml = ">=5.3.1,<7.0.0" +tomlkit = ">=0.11.1,<0.12.0" +typer = ">=0.4.1,<0.8.0" + +[[package]] +name = "pydocstyle" +version = "6.3.0" +description = "Python docstring style checker" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pydocstyle-6.3.0-py3-none-any.whl", hash = "sha256:118762d452a49d6b05e194ef344a55822987a462831ade91ec5c06fd2169d019"}, + {file = "pydocstyle-6.3.0.tar.gz", hash = "sha256:7ce43f0c0ac87b07494eb9c0b462c0b73e6ff276807f204d6b53edc72b7e44e1"}, +] + +[package.dependencies] +snowballstemmer = ">=2.2.0" + +[package.extras] +toml = ["tomli (>=1.2.3)"] + +[[package]] +name = "pygments" +version = "2.15.1" +description = "Pygments is a syntax highlighting package written in Python." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, +] + +[package.extras] +plugins = ["importlib-metadata"] + +[[package]] +name = "pylint" +version = "2.17.3" +description = "python code static checker" +category = "dev" +optional = false +python-versions = ">=3.7.2" +files = [ + {file = "pylint-2.17.3-py3-none-any.whl", hash = "sha256:a6cbb4c6e96eab4a3c7de7c6383c512478f58f88d95764507d84c899d656a89a"}, + {file = "pylint-2.17.3.tar.gz", hash = "sha256:761907349e699f8afdcd56c4fe02f3021ab5b3a0fc26d19a9bfdc66c7d0d5cd5"}, +] + +[package.dependencies] +astroid = ">=2.15.4,<=2.17.0-dev0" +colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} +dill = [ + {version = ">=0.2", markers = "python_version < \"3.11\""}, + {version = ">=0.3.6", markers = "python_version >= \"3.11\""}, +] +isort = ">=4.2.5,<6" +mccabe = ">=0.6,<0.8" +platformdirs = ">=2.2.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +tomlkit = ">=0.10.1" + +[package.extras] +spelling = ["pyenchant (>=3.2,<4.0)"] +testutils = ["gitpython (>3)"] + +[[package]] +name = "pyright" +version = "1.1.305" +description = "Command line wrapper for pyright" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pyright-1.1.305-py3-none-any.whl", hash = "sha256:147da3aac44ba0516423613cad5fbb7a0abba6b71c53718a1e151f456d4ab12e"}, + {file = "pyright-1.1.305.tar.gz", hash = "sha256:924d554253ecc4fafdfbfa76989d173cc15d426aa808630c0dd669fdc3227ef7"}, +] + +[package.dependencies] +nodeenv = ">=1.6.0" + +[package.extras] +all = ["twine (>=3.4.1)"] +dev = ["twine (>=3.4.1)"] + +[[package]] +name = "pytest" +version = "7.3.1" +description = "pytest: simple powerful testing with Python" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.3.1-py3-none-any.whl", hash = "sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362"}, + {file = "pytest-7.3.1.tar.gz", hash = "sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] + +[[package]] +name = "pytest-asyncio" +version = "0.19.0" +description = "Pytest support for asyncio" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-asyncio-0.19.0.tar.gz", hash = "sha256:ac4ebf3b6207259750bc32f4c1d8fcd7e79739edbc67ad0c58dd150b1d072fed"}, + {file = "pytest_asyncio-0.19.0-py3-none-any.whl", hash = "sha256:7a97e37cfe1ed296e2e84941384bdd37c376453912d397ed39293e0916f521fa"}, +] + +[package.dependencies] +pytest = ">=6.1.0" + +[package.extras] +testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] + +[[package]] +name = "pyyaml" +version = "6.0" +description = "YAML parser and emitter for Python" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "PyYAML-6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53"}, + {file = "PyYAML-6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b"}, + {file = "PyYAML-6.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"}, + {file = "PyYAML-6.0-cp310-cp310-win32.whl", hash = "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513"}, + {file = "PyYAML-6.0-cp310-cp310-win_amd64.whl", hash = "sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358"}, + {file = "PyYAML-6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f"}, + {file = "PyYAML-6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782"}, + {file = "PyYAML-6.0-cp311-cp311-win32.whl", hash = "sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7"}, + {file = "PyYAML-6.0-cp311-cp311-win_amd64.whl", hash = "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf"}, + {file = "PyYAML-6.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92"}, + {file = "PyYAML-6.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4"}, + {file = "PyYAML-6.0-cp36-cp36m-win32.whl", hash = "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293"}, + {file = "PyYAML-6.0-cp36-cp36m-win_amd64.whl", hash = "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57"}, + {file = "PyYAML-6.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4"}, + {file = "PyYAML-6.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9"}, + {file = "PyYAML-6.0-cp37-cp37m-win32.whl", hash = "sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737"}, + {file = "PyYAML-6.0-cp37-cp37m-win_amd64.whl", hash = "sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d"}, + {file = "PyYAML-6.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34"}, + {file = "PyYAML-6.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287"}, + {file = "PyYAML-6.0-cp38-cp38-win32.whl", hash = "sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78"}, + {file = "PyYAML-6.0-cp38-cp38-win_amd64.whl", hash = "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b"}, + {file = "PyYAML-6.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3"}, + {file = "PyYAML-6.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0"}, + {file = "PyYAML-6.0-cp39-cp39-win32.whl", hash = "sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb"}, + {file = "PyYAML-6.0-cp39-cp39-win_amd64.whl", hash = "sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c"}, + {file = "PyYAML-6.0.tar.gz", hash = "sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2"}, +] + +[[package]] +name = "rich" +version = "13.3.5" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +category = "dev" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0,<3.0.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "setuptools" +version = "67.7.2" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "smmap" +version = "5.0.0" +description = "A pure Python implementation of a sliding window memory map manager" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "smmap-5.0.0-py3-none-any.whl", hash = "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94"}, + {file = "smmap-5.0.0.tar.gz", hash = "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"}, +] + +[[package]] +name = "snowballstemmer" +version = "2.2.0" +description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "snowballstemmer-2.2.0-py2.py3-none-any.whl", hash = "sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"}, + {file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"}, +] + +[[package]] +name = "stevedore" +version = "5.0.0" +description = "Manage dynamic plugins for Python applications" +category = "dev" +optional = false +python-versions = ">=3.8" +files = [ + {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, + {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, +] + +[package.dependencies] +pbr = ">=2.0.0,<2.1.0 || >2.1.0" + +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "tomlkit" +version = "0.11.8" +description = "Style preserving TOML library" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, +] + +[[package]] +name = "tox" +version = "3.28.0" +description = "tox is a generic virtualenv management and test command line tool" +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +files = [ + {file = "tox-3.28.0-py2.py3-none-any.whl", hash = "sha256:57b5ab7e8bb3074edc3c0c0b4b192a4f3799d3723b2c5b76f1fa9f2d40316eea"}, + {file = "tox-3.28.0.tar.gz", hash = "sha256:d0d28f3fe6d6d7195c27f8b054c3e99d5451952b54abdae673b71609a581f640"}, +] + +[package.dependencies] +colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} +filelock = ">=3.0.0" +packaging = ">=14" +pluggy = ">=0.12.0" +py = ">=1.4.17" +six = ">=1.14.0" +tomli = {version = ">=2.0.1", markers = "python_version >= \"3.7\" and python_version < \"3.11\""} +virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" + +[package.extras] +docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] +testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)"] + +[[package]] +name = "tox-poetry" +version = "0.4.1" +description = "Tox poetry plugin" +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "tox-poetry-0.4.1.tar.gz", hash = "sha256:2395808e1ce487b5894c10f2202e14702bfa6d6909c0d1e525170d14809ac7ef"}, + {file = "tox_poetry-0.4.1-py2.py3-none-any.whl", hash = "sha256:11d9cd4e51d4cd9484b3ba63f2650ab4cfb4096e5f0682ecf561ddfc3c8e8c92"}, +] + +[package.dependencies] +pluggy = "*" +toml = "*" +tox = {version = ">=3.7.0", markers = "python_version >= \"3\""} + +[package.extras] +test = ["coverage", "pycodestyle", "pylint", "pytest"] + +[[package]] +name = "typer" +version = "0.7.0" +description = "Typer, build great CLIs. Easy to code. Based on Python type hints." +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typer-0.7.0-py3-none-any.whl", hash = "sha256:b5e704f4e48ec263de1c0b3a2387cd405a13767d2f907f44c1a08cbad96f606d"}, + {file = "typer-0.7.0.tar.gz", hash = "sha256:ff797846578a9f2a201b53442aedeb543319466870fbe1c701eab66dd7681165"}, +] + +[package.dependencies] +click = ">=7.1.1,<9.0.0" + +[package.extras] +all = ["colorama (>=0.4.3,<0.5.0)", "rich (>=10.11.0,<13.0.0)", "shellingham (>=1.3.0,<2.0.0)"] +dev = ["autoflake (>=1.3.1,<2.0.0)", "flake8 (>=3.8.3,<4.0.0)", "pre-commit (>=2.17.0,<3.0.0)"] +doc = ["cairosvg (>=2.5.2,<3.0.0)", "mdx-include (>=1.4.1,<2.0.0)", "mkdocs (>=1.1.2,<2.0.0)", "mkdocs-material (>=8.1.4,<9.0.0)", "pillow (>=9.3.0,<10.0.0)"] +test = ["black (>=22.3.0,<23.0.0)", "coverage (>=6.2,<7.0)", "isort (>=5.0.6,<6.0.0)", "mypy (==0.910)", "pytest (>=4.4.0,<8.0.0)", "pytest-cov (>=2.10.0,<5.0.0)", "pytest-sugar (>=0.9.4,<0.10.0)", "pytest-xdist (>=1.32.0,<4.0.0)", "rich (>=10.11.0,<13.0.0)", "shellingham (>=1.3.0,<2.0.0)"] + +[[package]] +name = "typing-extensions" +version = "4.5.0" +description = "Backported and Experimental Type Hints for Python 3.7+" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, + {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, +] + +[[package]] +name = "typing-inspect" +version = "0.8.0" +description = "Runtime inspection utilities for typing module." +category = "dev" +optional = false +python-versions = "*" +files = [ + {file = "typing_inspect-0.8.0-py3-none-any.whl", hash = "sha256:5fbf9c1e65d4fa01e701fe12a5bca6c6e08a4ffd5bc60bfac028253a447c5188"}, + {file = "typing_inspect-0.8.0.tar.gz", hash = "sha256:8b1ff0c400943b6145df8119c41c244ca8207f1f10c9c057aeed1560e4806e3d"}, +] + +[package.dependencies] +mypy-extensions = ">=0.3.0" +typing-extensions = ">=3.7.4" + +[[package]] +name = "virtualenv" +version = "20.23.0" +description = "Virtual Python Environment builder" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, +] + +[package.dependencies] +distlib = ">=0.3.6,<1" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" + +[package.extras] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] + +[[package]] +name = "wrapt" +version = "1.15.0" +description = "Module for decorators, wrappers and monkey patching." +category = "dev" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +files = [ + {file = "wrapt-1.15.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:ca1cccf838cd28d5a0883b342474c630ac48cac5df0ee6eacc9c7290f76b11c1"}, + {file = "wrapt-1.15.0-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:e826aadda3cae59295b95343db8f3d965fb31059da7de01ee8d1c40a60398b29"}, + {file = "wrapt-1.15.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5fc8e02f5984a55d2c653f5fea93531e9836abbd84342c1d1e17abc4a15084c2"}, + {file = "wrapt-1.15.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:96e25c8603a155559231c19c0349245eeb4ac0096fe3c1d0be5c47e075bd4f46"}, + {file = "wrapt-1.15.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:40737a081d7497efea35ab9304b829b857f21558acfc7b3272f908d33b0d9d4c"}, + {file = "wrapt-1.15.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:f87ec75864c37c4c6cb908d282e1969e79763e0d9becdfe9fe5473b7bb1e5f09"}, + {file = "wrapt-1.15.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:1286eb30261894e4c70d124d44b7fd07825340869945c79d05bda53a40caa079"}, + {file = "wrapt-1.15.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:493d389a2b63c88ad56cdc35d0fa5752daac56ca755805b1b0c530f785767d5e"}, + {file = "wrapt-1.15.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:58d7a75d731e8c63614222bcb21dd992b4ab01a399f1f09dd82af17bbfc2368a"}, + {file = "wrapt-1.15.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:21f6d9a0d5b3a207cdf7acf8e58d7d13d463e639f0c7e01d82cdb671e6cb7923"}, + {file = "wrapt-1.15.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ce42618f67741d4697684e501ef02f29e758a123aa2d669e2d964ff734ee00ee"}, + {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:41d07d029dd4157ae27beab04d22b8e261eddfc6ecd64ff7000b10dc8b3a5727"}, + {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:54accd4b8bc202966bafafd16e69da9d5640ff92389d33d28555c5fd4f25ccb7"}, + {file = "wrapt-1.15.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2fbfbca668dd15b744418265a9607baa970c347eefd0db6a518aaf0cfbd153c0"}, + {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:76e9c727a874b4856d11a32fb0b389afc61ce8aaf281ada613713ddeadd1cfec"}, + {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e20076a211cd6f9b44a6be58f7eeafa7ab5720eb796975d0c03f05b47d89eb90"}, + {file = "wrapt-1.15.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a74d56552ddbde46c246b5b89199cb3fd182f9c346c784e1a93e4dc3f5ec9975"}, + {file = "wrapt-1.15.0-cp310-cp310-win32.whl", hash = "sha256:26458da5653aa5b3d8dc8b24192f574a58984c749401f98fff994d41d3f08da1"}, + {file = "wrapt-1.15.0-cp310-cp310-win_amd64.whl", hash = "sha256:75760a47c06b5974aa5e01949bf7e66d2af4d08cb8c1d6516af5e39595397f5e"}, + {file = "wrapt-1.15.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:ba1711cda2d30634a7e452fc79eabcadaffedf241ff206db2ee93dd2c89a60e7"}, + {file = "wrapt-1.15.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:56374914b132c702aa9aa9959c550004b8847148f95e1b824772d453ac204a72"}, + {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a89ce3fd220ff144bd9d54da333ec0de0399b52c9ac3d2ce34b569cf1a5748fb"}, + {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bbe623731d03b186b3d6b0d6f51865bf598587c38d6f7b0be2e27414f7f214e"}, + {file = "wrapt-1.15.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3abbe948c3cbde2689370a262a8d04e32ec2dd4f27103669a45c6929bcdbfe7c"}, + {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:b67b819628e3b748fd3c2192c15fb951f549d0f47c0449af0764d7647302fda3"}, + {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:7eebcdbe3677e58dd4c0e03b4f2cfa346ed4049687d839adad68cc38bb559c92"}, + {file = "wrapt-1.15.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:74934ebd71950e3db69960a7da29204f89624dde411afbfb3b4858c1409b1e98"}, + {file = "wrapt-1.15.0-cp311-cp311-win32.whl", hash = "sha256:bd84395aab8e4d36263cd1b9308cd504f6cf713b7d6d3ce25ea55670baec5416"}, + {file = "wrapt-1.15.0-cp311-cp311-win_amd64.whl", hash = "sha256:a487f72a25904e2b4bbc0817ce7a8de94363bd7e79890510174da9d901c38705"}, + {file = "wrapt-1.15.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:4ff0d20f2e670800d3ed2b220d40984162089a6e2c9646fdb09b85e6f9a8fc29"}, + {file = "wrapt-1.15.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:9ed6aa0726b9b60911f4aed8ec5b8dd7bf3491476015819f56473ffaef8959bd"}, + {file = "wrapt-1.15.0-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:896689fddba4f23ef7c718279e42f8834041a21342d95e56922e1c10c0cc7afb"}, + {file = "wrapt-1.15.0-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:75669d77bb2c071333417617a235324a1618dba66f82a750362eccbe5b61d248"}, + {file = "wrapt-1.15.0-cp35-cp35m-win32.whl", hash = "sha256:fbec11614dba0424ca72f4e8ba3c420dba07b4a7c206c8c8e4e73f2e98f4c559"}, + {file = "wrapt-1.15.0-cp35-cp35m-win_amd64.whl", hash = "sha256:fd69666217b62fa5d7c6aa88e507493a34dec4fa20c5bd925e4bc12fce586639"}, + {file = "wrapt-1.15.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:b0724f05c396b0a4c36a3226c31648385deb6a65d8992644c12a4963c70326ba"}, + {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bbeccb1aa40ab88cd29e6c7d8585582c99548f55f9b2581dfc5ba68c59a85752"}, + {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:38adf7198f8f154502883242f9fe7333ab05a5b02de7d83aa2d88ea621f13364"}, + {file = "wrapt-1.15.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:578383d740457fa790fdf85e6d346fda1416a40549fe8db08e5e9bd281c6a475"}, + {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:a4cbb9ff5795cd66f0066bdf5947f170f5d63a9274f99bdbca02fd973adcf2a8"}, + {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_i686.whl", hash = "sha256:af5bd9ccb188f6a5fdda9f1f09d9f4c86cc8a539bd48a0bfdc97723970348418"}, + {file = "wrapt-1.15.0-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:b56d5519e470d3f2fe4aa7585f0632b060d532d0696c5bdfb5e8319e1d0f69a2"}, + {file = "wrapt-1.15.0-cp36-cp36m-win32.whl", hash = "sha256:77d4c1b881076c3ba173484dfa53d3582c1c8ff1f914c6461ab70c8428b796c1"}, + {file = "wrapt-1.15.0-cp36-cp36m-win_amd64.whl", hash = "sha256:077ff0d1f9d9e4ce6476c1a924a3332452c1406e59d90a2cf24aeb29eeac9420"}, + {file = "wrapt-1.15.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:5c5aa28df055697d7c37d2099a7bc09f559d5053c3349b1ad0c39000e611d317"}, + {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a8564f283394634a7a7054b7983e47dbf39c07712d7b177b37e03f2467a024e"}, + {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:780c82a41dc493b62fc5884fb1d3a3b81106642c5c5c78d6a0d4cbe96d62ba7e"}, + {file = "wrapt-1.15.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e169e957c33576f47e21864cf3fc9ff47c223a4ebca8960079b8bd36cb014fd0"}, + {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:b02f21c1e2074943312d03d243ac4388319f2456576b2c6023041c4d57cd7019"}, + {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:f2e69b3ed24544b0d3dbe2c5c0ba5153ce50dcebb576fdc4696d52aa22db6034"}, + {file = "wrapt-1.15.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d787272ed958a05b2c86311d3a4135d3c2aeea4fc655705f074130aa57d71653"}, + {file = "wrapt-1.15.0-cp37-cp37m-win32.whl", hash = "sha256:02fce1852f755f44f95af51f69d22e45080102e9d00258053b79367d07af39c0"}, + {file = "wrapt-1.15.0-cp37-cp37m-win_amd64.whl", hash = "sha256:abd52a09d03adf9c763d706df707c343293d5d106aea53483e0ec8d9e310ad5e"}, + {file = "wrapt-1.15.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cdb4f085756c96a3af04e6eca7f08b1345e94b53af8921b25c72f096e704e145"}, + {file = "wrapt-1.15.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:230ae493696a371f1dbffaad3dafbb742a4d27a0afd2b1aecebe52b740167e7f"}, + {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:63424c681923b9f3bfbc5e3205aafe790904053d42ddcc08542181a30a7a51bd"}, + {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d6bcbfc99f55655c3d93feb7ef3800bd5bbe963a755687cbf1f490a71fb7794b"}, + {file = "wrapt-1.15.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c99f4309f5145b93eca6e35ac1a988f0dc0a7ccf9ccdcd78d3c0adf57224e62f"}, + {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b130fe77361d6771ecf5a219d8e0817d61b236b7d8b37cc045172e574ed219e6"}, + {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:96177eb5645b1c6985f5c11d03fc2dbda9ad24ec0f3a46dcce91445747e15094"}, + {file = "wrapt-1.15.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:d5fe3e099cf07d0fb5a1e23d399e5d4d1ca3e6dfcbe5c8570ccff3e9208274f7"}, + {file = "wrapt-1.15.0-cp38-cp38-win32.whl", hash = "sha256:abd8f36c99512755b8456047b7be10372fca271bf1467a1caa88db991e7c421b"}, + {file = "wrapt-1.15.0-cp38-cp38-win_amd64.whl", hash = "sha256:b06fa97478a5f478fb05e1980980a7cdf2712015493b44d0c87606c1513ed5b1"}, + {file = "wrapt-1.15.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2e51de54d4fb8fb50d6ee8327f9828306a959ae394d3e01a1ba8b2f937747d86"}, + {file = "wrapt-1.15.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:0970ddb69bba00670e58955f8019bec4a42d1785db3faa043c33d81de2bf843c"}, + {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76407ab327158c510f44ded207e2f76b657303e17cb7a572ffe2f5a8a48aa04d"}, + {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cd525e0e52a5ff16653a3fc9e3dd827981917d34996600bbc34c05d048ca35cc"}, + {file = "wrapt-1.15.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d37ac69edc5614b90516807de32d08cb8e7b12260a285ee330955604ed9dd29"}, + {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:078e2a1a86544e644a68422f881c48b84fef6d18f8c7a957ffd3f2e0a74a0d4a"}, + {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:2cf56d0e237280baed46f0b5316661da892565ff58309d4d2ed7dba763d984b8"}, + {file = "wrapt-1.15.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:7dc0713bf81287a00516ef43137273b23ee414fe41a3c14be10dd95ed98a2df9"}, + {file = "wrapt-1.15.0-cp39-cp39-win32.whl", hash = "sha256:46ed616d5fb42f98630ed70c3529541408166c22cdfd4540b88d5f21006b0eff"}, + {file = "wrapt-1.15.0-cp39-cp39-win_amd64.whl", hash = "sha256:eef4d64c650f33347c1f9266fa5ae001440b232ad9b98f1f43dfe7a79435c0a6"}, + {file = "wrapt-1.15.0-py3-none-any.whl", hash = "sha256:64b1df0f83706b4ef4cfb4fb0e4c2669100fd7ecacfb59e091fad300d4e04640"}, + {file = "wrapt-1.15.0.tar.gz", hash = "sha256:d06730c6aed78cee4126234cf2d071e01b44b915e725a6cb439a879ec9754a3a"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "da96c8da6df9a1e93509950d064ca803bad959afa8b85410e059156293a30447" diff --git a/packages/polywrap-test-cases/polywrap_test_cases/__init__.py b/packages/polywrap-test-cases/polywrap_test_cases/__init__.py new file mode 100644 index 00000000..b74016f8 --- /dev/null +++ b/packages/polywrap-test-cases/polywrap_test_cases/__init__.py @@ -0,0 +1,39 @@ +"""This package contains the utility functions to fetch the wrappers\ + from the wasm-test-harness repo.""" +import io +import os +import zipfile +from urllib.error import HTTPError +from urllib.request import urlopen + + +def get_path_to_test_wrappers() -> str: + """Get the path to the test wrappers.""" + return os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "wrappers")) + + +def fetch_file(url: str) -> bytes: + """Fetch a file using HTTP.""" + with urlopen(url) as response: + if response.status != 200: + raise HTTPError( + url, response.status, "Failed to fetch file", response.headers, None + ) + return response.read() + + +def unzip_file(file_buffer: bytes, destination: str) -> None: + """Unzip a file to a destination.""" + with zipfile.ZipFile(io.BytesIO(file_buffer), "r") as zip_ref: + zip_ref.extractall(destination) + + +def fetch_wrappers() -> None: + """Fetch the wrappers from the wasm-test-harness repo.""" + tag = "0.1.0" + repo_name = "wasm-test-harness" + url = f"https://github.com/polywrap/{repo_name}/releases/download/{tag}/wrappers" + + buffer = fetch_file(url) + zip_built_folder = get_path_to_test_wrappers() + unzip_file(buffer, zip_built_folder) diff --git a/packages/polywrap-test-cases/polywrap_test_cases/__main__.py b/packages/polywrap-test-cases/polywrap_test_cases/__main__.py new file mode 100644 index 00000000..3df55d7f --- /dev/null +++ b/packages/polywrap-test-cases/polywrap_test_cases/__main__.py @@ -0,0 +1,5 @@ +"""This module contains the main entry point of the package.""" +from . import fetch_wrappers + +if __name__ == "__main__": + fetch_wrappers() diff --git a/packages/polywrap-test-cases/polywrap_test_cases/py.typed b/packages/polywrap-test-cases/polywrap_test_cases/py.typed new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-test-cases/pyproject.toml b/packages/polywrap-test-cases/pyproject.toml new file mode 100644 index 00000000..73aad8e5 --- /dev/null +++ b/packages/polywrap-test-cases/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry] +name = "polywrap-test-cases" +version = "0.1.0a29" +description = "Plugin package" +authors = ["Cesar "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" + +[tool.poetry.dev-dependencies] +pytest = "^7.1.2" +pytest-asyncio = "^0.19.0" +pylint = "^2.15.4" +black = "^22.10.0" +bandit = { version = "^1.7.4", extras = ["toml"]} +tox = "^3.26.0" +tox-poetry = "^0.4.1" +isort = "^5.10.1" +pyright = "^1.1.275" +pydocstyle = "^6.1.1" + +[tool.poetry.group.dev.dependencies] +pycln = "^2.1.3" + +[tool.bandit] +exclude_dirs = ["tests"] +skips = ["B310"] + +[tool.black] +target-version = ["py310"] + +[tool.pyright] +typeCheckingMode = "strict" +reportShadowedImports = false + +[tool.pytest.ini_options] +asyncio_mode = "auto" +testpaths = [ + "tests" +] + +[tool.pylint] +disable = [ +] +ignore = [ + "tests/" +] + +[tool.isort] +profile = "black" +multi_line_output = 3 + +[tool.pydocstyle] +# default \ No newline at end of file diff --git a/packages/polywrap-test-cases/tests/test_sanity.py b/packages/polywrap-test-cases/tests/test_sanity.py new file mode 100644 index 00000000..176c6edf --- /dev/null +++ b/packages/polywrap-test-cases/tests/test_sanity.py @@ -0,0 +1,16 @@ +import os +from polywrap_test_cases import get_path_to_test_wrappers +import pytest + + +@pytest.mark.parametrize( + "wrapper", ["asyncify", "bigint-type", "enum-type", "map-type"] +) +@pytest.mark.parametrize("language", ["as", "rs"]) +def test_wrappers_exist(wrapper: str, language: str): + assert os.path.exists(get_path_to_test_wrappers()) + wrapper_path = os.path.join(get_path_to_test_wrappers(), wrapper, "implementations", language) + assert os.path.exists(wrapper_path) + assert os.path.isdir(wrapper_path) + assert os.path.exists(os.path.join(wrapper_path, "wrap.info")) + assert os.path.exists(os.path.join(wrapper_path, "wrap.wasm")) diff --git a/packages/polywrap-test-cases/tox.ini b/packages/polywrap-test-cases/tox.ini new file mode 100644 index 00000000..bc546a3c --- /dev/null +++ b/packages/polywrap-test-cases/tox.ini @@ -0,0 +1,34 @@ +[tox] +isolated_build = True +envlist = py310 + +[testenv] +commands = + python -m polywrap_test_cases + pytest tests/ + +[testenv:getwraps] +commands = + python -m polywrap_test_cases + +[testenv:lint] +commands = + isort --check-only polywrap_test_cases + black --check polywrap_test_cases + pycln --check polywrap_test_cases --disable-all-dunder-policy + pylint polywrap_test_cases + pydocstyle polywrap_test_cases + +[testenv:typecheck] +commands = + pyright polywrap_test_cases + +[testenv:secure] +commands = + bandit -r polywrap_test_cases -c pyproject.toml + +[testenv:dev] +commands = + isort polywrap_test_cases + black polywrap_test_cases + pycln polywrap_test_cases --disable-all-dunder-policy diff --git a/packages/polywrap-uri-resolvers/assets/style.css b/packages/polywrap-uri-resolvers/assets/style.css new file mode 100644 index 00000000..3edac88e --- /dev/null +++ b/packages/polywrap-uri-resolvers/assets/style.css @@ -0,0 +1,186 @@ +body { + font-family: Helvetica, Arial, sans-serif; + font-size: 12px; + /* do not increase min-width as some may use split screens */ + min-width: 800px; + color: #999; +} + +h1 { + font-size: 24px; + color: black; +} + +h2 { + font-size: 16px; + color: black; +} + +p { + color: black; +} + +a { + color: #999; +} + +table { + border-collapse: collapse; +} + +/****************************** + * SUMMARY INFORMATION + ******************************/ +#environment td { + padding: 5px; + border: 1px solid #E6E6E6; +} +#environment tr:nth-child(odd) { + background-color: #f6f6f6; +} + +/****************************** + * TEST RESULT COLORS + ******************************/ +span.passed, +.passed .col-result { + color: green; +} + +span.skipped, +span.xfailed, +span.rerun, +.skipped .col-result, +.xfailed .col-result, +.rerun .col-result { + color: orange; +} + +span.error, +span.failed, +span.xpassed, +.error .col-result, +.failed .col-result, +.xpassed .col-result { + color: red; +} + +/****************************** + * RESULTS TABLE + * + * 1. Table Layout + * 2. Extra + * 3. Sorting items + * + ******************************/ +/*------------------ + * 1. Table Layout + *------------------*/ +#results-table { + border: 1px solid #e6e6e6; + color: #999; + font-size: 12px; + width: 100%; +} +#results-table th, +#results-table td { + padding: 5px; + border: 1px solid #E6E6E6; + text-align: left; +} +#results-table th { + font-weight: bold; +} + +/*------------------ + * 2. Extra + *------------------*/ +.log { + background-color: #e6e6e6; + border: 1px solid #e6e6e6; + color: black; + display: block; + font-family: "Courier New", Courier, monospace; + height: 230px; + overflow-y: scroll; + padding: 5px; + white-space: pre-wrap; +} +.log:only-child { + height: inherit; +} + +div.image { + border: 1px solid #e6e6e6; + float: right; + height: 240px; + margin-left: 5px; + overflow: hidden; + width: 320px; +} +div.image img { + width: 320px; +} + +div.video { + border: 1px solid #e6e6e6; + float: right; + height: 240px; + margin-left: 5px; + overflow: hidden; + width: 320px; +} +div.video video { + overflow: hidden; + width: 320px; + height: 240px; +} + +.collapsed { + display: none; +} + +.expander::after { + content: " (show details)"; + color: #BBB; + font-style: italic; + cursor: pointer; +} + +.collapser::after { + content: " (hide details)"; + color: #BBB; + font-style: italic; + cursor: pointer; +} + +/*------------------ + * 3. Sorting items + *------------------*/ +.sortable { + cursor: pointer; +} + +.sort-icon { + font-size: 0px; + float: left; + margin-right: 5px; + margin-top: 5px; + /*triangle*/ + width: 0; + height: 0; + border-left: 8px solid transparent; + border-right: 8px solid transparent; +} +.inactive .sort-icon { + /*finish triangle*/ + border-top: 8px solid #E6E6E6; +} +.asc.active .sort-icon { + /*finish triangle*/ + border-bottom: 8px solid #999; +} +.desc.active .sort-icon { + /*finish triangle*/ + border-top: 8px solid #999; +} diff --git a/packages/polywrap-uri-resolvers/poetry.lock b/packages/polywrap-uri-resolvers/poetry.lock index 21696baf..9b354d05 100644 --- a/packages/polywrap-uri-resolvers/poetry.lock +++ b/packages/polywrap-uri-resolvers/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. +# This file is automatically @generated by Poetry and should not be changed by hand. [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.5" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.5-py3-none-any.whl", hash = "sha256:078e5212f9885fa85fbb0cf0101978a336190aadea6e13305409d099f71b2324"}, + {file = "astroid-2.15.5.tar.gz", hash = "sha256:1039262575027b441137ab4a62a793a9b43defb42c32d5670f38686207cd780f"}, ] [package.dependencies] @@ -151,19 +151,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -273,42 +273,41 @@ files = [ [[package]] name = "libcst" -version = "0.4.9" +version = "0.4.10" description = "A concrete syntax tree with AST-like properties for Python 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10 programs." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "libcst-0.4.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4f9e42085c403e22201e5c41e707ef73e4ea910ad9fc67983ceee2368097f54e"}, - {file = "libcst-0.4.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1266530bf840cc40633a04feb578bb4cac1aa3aea058cc3729e24eab09a8e996"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f9679177391ccb9b0cdde3185c22bf366cb672457c4b7f4031fcb3b5e739fbd6"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d67bc87e0d8db9434f2ea063734938a320f541f4c6da1074001e372f840f385d"}, - {file = "libcst-0.4.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e316da5a126f2a9e1d7680f95f907b575f082a35e2f8bd5620c59b2aaaebfe0a"}, - {file = "libcst-0.4.9-cp310-cp310-win_amd64.whl", hash = "sha256:7415569ab998a85b0fc9af3a204611ea7fadb2d719a12532c448f8fc98f5aca4"}, - {file = "libcst-0.4.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:15ded11ff7f4572f91635e02b519ae959f782689fdb4445bbebb7a3cc5c71d75"}, - {file = "libcst-0.4.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b266867b712a120fad93983de432ddb2ccb062eb5fd2bea748c9a94cb200c36"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045b3b0b06413cdae6e9751b5f417f789ffa410f2cb2815e3e0e0ea6bef10ec0"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e799add8fba4976628b9c1a6768d73178bf898f0ed1bd1322930c2d3db9063ba"}, - {file = "libcst-0.4.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:10479371d04ee8dc978c889c1774bbf6a83df88fa055fcb0159a606f6679c565"}, - {file = "libcst-0.4.9-cp311-cp311-win_amd64.whl", hash = "sha256:7a98286cbbfa90a42d376900c875161ad02a5a2a6b7c94c0f7afd9075e329ce4"}, - {file = "libcst-0.4.9-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:400166fc4efb9aa06ce44498d443aa78519082695b1894202dd73cd507d2d712"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46123863fba35cc84f7b54dd68826419cabfd9504d8a101c7fe3313ea03776f9"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27be8db54c0e5fe440021a771a38b81a7dbc23cd630eb8b0e9828b7717f9b702"}, - {file = "libcst-0.4.9-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:132bec627b064bd567e7e4cd6c89524d02842151eb0d8f5f3f7ffd2579ec1b09"}, - {file = "libcst-0.4.9-cp37-cp37m-win_amd64.whl", hash = "sha256:596860090aeed3ee6ad1e59c35c6c4110a57e4e896abf51b91cae003ec720a11"}, - {file = "libcst-0.4.9-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f4487608258109f774300466d4ca97353df29ae6ac23d1502e13e5509423c9d5"}, - {file = "libcst-0.4.9-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:aa53993e9a2853efb3ed3605da39f2e7125df6430f613eb67ef886c1ce4f94b5"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f6ce794483d4c605ef0f5b199a49fb6996f9586ca938b7bfef213bd13858d7ab"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:786e562b54bbcd17a060d1244deeef466b7ee07fe544074c252c4a169e38f1ee"}, - {file = "libcst-0.4.9-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:794250d2359edd518fb698e5d21c38a5bdfc5e4a75d0407b4c19818271ce6742"}, - {file = "libcst-0.4.9-cp38-cp38-win_amd64.whl", hash = "sha256:76491f67431318c3145442e97dddcead7075b074c59eac51be7cc9e3fffec6ee"}, - {file = "libcst-0.4.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3cf48d7aec6dc54b02aec0b1bb413c5bb3b02d852fd6facf1f05c7213e61a176"}, - {file = "libcst-0.4.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:9b3348c6b7711a5235b133bd8e11d22e903c388db42485b8ceb5f2aa0fae9b9f"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7e33b66762efaa014c38819efae5d8f726dd823e32d5d691035484411d2a2a69"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1350d375d3fb9b20a6cf10c09b2964baca9be753a033dde7c1aced49d8e58387"}, - {file = "libcst-0.4.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3822056dc13326082362db35b3f649e0f4a97e36ddb4e487441da8e0fb9db7b3"}, - {file = "libcst-0.4.9-cp39-cp39-win_amd64.whl", hash = "sha256:183636141b839aa35b639e100883813744523bc7c12528906621121731b28443"}, - {file = "libcst-0.4.9.tar.gz", hash = "sha256:01786c403348f76f274dbaf3888ae237ffb73e6ed6973e65eba5c1fc389861dd"}, + {file = "libcst-0.4.10-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8fa0ec646ed7bce984d0ee9dbf514af278050bdb16a4fb986e916ace534eebc6"}, + {file = "libcst-0.4.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3cb3b7821eac00713844cda079583230c546a589b22ed5f03f2ddc4f985c384b"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e7acfa747112ae40b032739661abd7c81aff37191294f7c2dab8bbd72372e78f"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1312e293b864ef3cb4b09534ed5f104c2dc45b680233c68bf76237295041c781"}, + {file = "libcst-0.4.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:76884b1afe475e8e68e704bf26eb9f9a2867029643e58f2f26a0286e3b6e998e"}, + {file = "libcst-0.4.10-cp310-cp310-win_amd64.whl", hash = "sha256:1069b808a711db5cd47538f27eb2c73206317aa0d8b5a3500b23aab24f86eb2e"}, + {file = "libcst-0.4.10-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:50be085346a35812535c7f876319689e15a7bfd1bd8efae8fd70589281d944b6"}, + {file = "libcst-0.4.10-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bb9f10e5763e361e8bd8ff765fc0f1bcf744f242ff8b6d3e50ffec4dda3972ac"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfeeabb528b5df7b4be1817b584ce79e9a1a66687bd72f6de9c22272462812f1"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5648aeae8c90a2abab1f7b1bf205769a0179ed2cfe1ea7f681f6885e87b8b193"}, + {file = "libcst-0.4.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a144f20aff4643b00374facf8409d30c7935db8176e5b2a07e1fd44004db2c1f"}, + {file = "libcst-0.4.10-cp311-cp311-win_amd64.whl", hash = "sha256:a10adc2e8ea2dda2b70eabec631ead2fc4a7a7ab633d6c2b690823c698b8431a"}, + {file = "libcst-0.4.10-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:58fe90458a26a55358207f74abf8a05dff51d662069f070b4bd308a000a80c09"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:999fbbe467f61cbce9e6e054f86cd1c5ffa3740fd3dc8ebdd600db379f699256"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:83ee7e7be4efac4c140a97d772e1f6b3553f98fa5f46ad78df5dfe51e5a4aa4d"}, + {file = "libcst-0.4.10-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:158478e8f45578fb26621b3dc0fe275f9e004297e9afdcf08936ecda05681174"}, + {file = "libcst-0.4.10-cp37-cp37m-win_amd64.whl", hash = "sha256:5ed101fee1af7abea3684fcff7fab5b170ceea4040756f54c15c870539daec66"}, + {file = "libcst-0.4.10-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:349f2b4ee4b982fe254c65c78d941fc96299f3c422b79f95ef8c7bba2b7f0f90"}, + {file = "libcst-0.4.10-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7cfa4d4beb84d0d63247aca27f1a15c63984512274c5b23040f8b4ba511036d7"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:24582506da24e31f2644f862f11413a6b80fbad68d15194bfcc3f7dfebf2ec5e"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cdf2d0157438d3d52d310b0b6be31ff99bed19de489b2ebd3e2a4cd9946da45"}, + {file = "libcst-0.4.10-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a677103d2f1ab0e50bc3a7cc6c96c7d64bcbac826d785e4cbf5ee9aaa9fcfa25"}, + {file = "libcst-0.4.10-cp38-cp38-win_amd64.whl", hash = "sha256:a8fdfd4a7d301adb785aa4b98e4a7cca45c5ff8cfb460b485d081efcfaaeeab7"}, + {file = "libcst-0.4.10-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b1569d87536bed4e9c11dd5c94a137dc0bce2a2b05961489c6016bf4521bb7cf"}, + {file = "libcst-0.4.10-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:72dff8783ac79cd10f2bd2fde0b28f262e9a22718ae26990948ba6131b85ca8b"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:76adc53660ef094ff83f77a2550a7e00d1cab8e5e63336e071c17c09b5a89fe2"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f3e9d9fdd9a9b9b8991936ff1c07527ce7ef396c8233280ba9a7137e72c2e48e"}, + {file = "libcst-0.4.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7e1b4cbaf7b1cdad5fa3eababe42d5b46c0d52afe13c5ba4eac2495fc57630ea"}, + {file = "libcst-0.4.10-cp39-cp39-win_amd64.whl", hash = "sha256:bcbd07cec3d7a7be6f0299b0c246e085e3d6cc8af367e2c96059183b97c2e2fe"}, ] [package.dependencies] @@ -317,7 +316,7 @@ typing-extensions = ">=3.7.4.2" typing-inspect = ">=0.4.0" [package.extras] -dev = ["Sphinx (>=5.1.1)", "black (==22.10.0)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8,<5)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "jinja2 (==3.1.2)", "jupyter (>=1.0.0)", "maturin (>=0.8.3,<0.14)", "nbsphinx (>=0.4.2)", "prompt-toolkit (>=2.0.9)", "pyre-check (==0.9.9)", "setuptools-rust (>=1.5.2)", "setuptools-scm (>=6.0.1)", "slotscheck (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "ufmt (==2.0.1)", "usort (==1.0.5)"] +dev = ["Sphinx (>=5.1.1)", "black (==23.1.0)", "build (>=0.10.0)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8,<5)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "jinja2 (==3.1.2)", "jupyter (>=1.0.0)", "maturin (>=0.8.3,<0.14)", "nbsphinx (>=0.4.2)", "prompt-toolkit (>=2.0.9)", "pyre-check (==0.9.10)", "setuptools-rust (>=1.5.2)", "setuptools-scm (>=6.0.1)", "slotscheck (>=0.7.1)", "sphinx-rtd-theme (>=0.4.3)", "ufmt (==2.1.0)", "usort (==1.0.6)"] [[package]] name = "markdown-it-py" @@ -455,14 +454,14 @@ files = [ [[package]] name = "nodeenv" -version = "1.7.0" +version = "1.8.0" description = "Node.js virtual environment builder" category = "dev" optional = false python-versions = ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*" files = [ - {file = "nodeenv-1.7.0-py2.py3-none-any.whl", hash = "sha256:27083a7b96a25f2f5e1d8cb4b6317ee8aeda3bdd121394e5ac54e498028a042e"}, - {file = "nodeenv-1.7.0.tar.gz", hash = "sha256:e0e7f7dfb85fc5394c6fe1e8fa98131a2473e04311a45afb6508f7cf1836fa2b"}, + {file = "nodeenv-1.8.0-py2.py3-none-any.whl", hash = "sha256:df865724bb3c3adc86b3876fa209771517b0cfe596beff01a92700e0e8be4cec"}, + {file = "nodeenv-1.8.0.tar.gz", hash = "sha256:d51e0c37e64fbf47d017feac3145cdbb58836d7eee8c6f6d3b6880c5456227d2"}, ] [package.dependencies] @@ -506,19 +505,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.1" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"}, + {file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -536,21 +535,42 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "polywrap-client" +version = "0.1.0a29" +description = "" +category = "dev" +optional = false +python-versions = "^3.10" +files = [] +develop = true + +[package.dependencies] +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-client" + [[package]] name = "polywrap-core" version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_core-0.1.0a29-py3-none-any.whl", hash = "sha256:ea3111a0a2a4287c0f7a180fd7bb024530e720cd5ec97767b52502679d42a097"}, - {file = "polywrap_core-0.1.0a29.tar.gz", hash = "sha256:b879c8b621eaa4ae5ad1cc48a6b304596fe9586163395782584207886e793eba"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-core" [[package]] name = "polywrap-manifest" @@ -558,15 +578,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -574,14 +596,49 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" + +[[package]] +name = "polywrap-plugin" +version = "0.1.0a29" +description = "Plugin package" +category = "dev" +optional = false +python-versions = "^3.10" +files = [] +develop = true + +[package.dependencies] +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-plugin" + +[[package]] +name = "polywrap-test-cases" +version = "0.1.0a29" +description = "Plugin package" +category = "dev" +optional = false +python-versions = "^3.10" +files = [] +develop = true + +[package.source] +type = "directory" +url = "../polywrap-test-cases" [[package]] name = "polywrap-wasm" @@ -589,19 +646,21 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_wasm-0.1.0a29-py3-none-any.whl", hash = "sha256:462ae2d043abbed45f94b9615339834029af7d503d2f8e6037959fef953edd7b"}, - {file = "polywrap_wasm-0.1.0a29.tar.gz", hash = "sha256:97c2bb2c057e260376a99e5cea44ce2a78097c1ee670be1b6f0269f233f772fe"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-core = ">=0.1.0a29,<0.2.0" -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -unsync = ">=1.4.0,<2.0.0" -unsync-stubs = ">=0.1.2,<0.2.0" -wasmtime = ">=6.0.0,<7.0.0" +polywrap-core = {path = "../polywrap-core", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +unsync = "^1.4.0" +unsync-stubs = "^0.1.2" +wasmtime = "^6.0.0" + +[package.source] +type = "directory" +url = "../polywrap-wasm" [[package]] name = "py" @@ -636,48 +695,48 @@ typer = ">=0.4.1,<0.8.0" [[package]] name = "pydantic" -version = "1.10.7" +version = "1.10.8" description = "Data validation and settings management using python type hints" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "pydantic-1.10.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e79e999e539872e903767c417c897e729e015872040e56b96e67968c3b918b2d"}, - {file = "pydantic-1.10.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:01aea3a42c13f2602b7ecbbea484a98169fb568ebd9e247593ea05f01b884b2e"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:516f1ed9bc2406a0467dd777afc636c7091d71f214d5e413d64fef45174cfc7a"}, - {file = "pydantic-1.10.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae150a63564929c675d7f2303008d88426a0add46efd76c3fc797cd71cb1b46f"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:ecbbc51391248116c0a055899e6c3e7ffbb11fb5e2a4cd6f2d0b93272118a209"}, - {file = "pydantic-1.10.7-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:f4a2b50e2b03d5776e7f21af73e2070e1b5c0d0df255a827e7c632962f8315af"}, - {file = "pydantic-1.10.7-cp310-cp310-win_amd64.whl", hash = "sha256:a7cd2251439988b413cb0a985c4ed82b6c6aac382dbaff53ae03c4b23a70e80a"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:68792151e174a4aa9e9fc1b4e653e65a354a2fa0fed169f7b3d09902ad2cb6f1"}, - {file = "pydantic-1.10.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dfe2507b8ef209da71b6fb5f4e597b50c5a34b78d7e857c4f8f3115effaef5fe"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:10a86d8c8db68086f1e30a530f7d5f83eb0685e632e411dbbcf2d5c0150e8dcd"}, - {file = "pydantic-1.10.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d75ae19d2a3dbb146b6f324031c24f8a3f52ff5d6a9f22f0683694b3afcb16fb"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:464855a7ff7f2cc2cf537ecc421291b9132aa9c79aef44e917ad711b4a93163b"}, - {file = "pydantic-1.10.7-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:193924c563fae6ddcb71d3f06fa153866423ac1b793a47936656e806b64e24ca"}, - {file = "pydantic-1.10.7-cp311-cp311-win_amd64.whl", hash = "sha256:b4a849d10f211389502059c33332e91327bc154acc1845f375a99eca3afa802d"}, - {file = "pydantic-1.10.7-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cc1dde4e50a5fc1336ee0581c1612215bc64ed6d28d2c7c6f25d2fe3e7c3e918"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0cfe895a504c060e5d36b287ee696e2fdad02d89e0d895f83037245218a87fe"}, - {file = "pydantic-1.10.7-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:670bb4683ad1e48b0ecb06f0cfe2178dcf74ff27921cdf1606e527d2617a81ee"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:950ce33857841f9a337ce07ddf46bc84e1c4946d2a3bba18f8280297157a3fd1"}, - {file = "pydantic-1.10.7-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:c15582f9055fbc1bfe50266a19771bbbef33dd28c45e78afbe1996fd70966c2a"}, - {file = "pydantic-1.10.7-cp37-cp37m-win_amd64.whl", hash = "sha256:82dffb306dd20bd5268fd6379bc4bfe75242a9c2b79fec58e1041fbbdb1f7914"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8c7f51861d73e8b9ddcb9916ae7ac39fb52761d9ea0df41128e81e2ba42886cd"}, - {file = "pydantic-1.10.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6434b49c0b03a51021ade5c4daa7d70c98f7a79e95b551201fff682fc1661245"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:64d34ab766fa056df49013bb6e79921a0265204c071984e75a09cbceacbbdd5d"}, - {file = "pydantic-1.10.7-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:701daea9ffe9d26f97b52f1d157e0d4121644f0fcf80b443248434958fd03dc3"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:cf135c46099ff3f919d2150a948ce94b9ce545598ef2c6c7bf55dca98a304b52"}, - {file = "pydantic-1.10.7-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b0f85904f73161817b80781cc150f8b906d521fa11e3cdabae19a581c3606209"}, - {file = "pydantic-1.10.7-cp38-cp38-win_amd64.whl", hash = "sha256:9f6f0fd68d73257ad6685419478c5aece46432f4bdd8d32c7345f1986496171e"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c230c0d8a322276d6e7b88c3f7ce885f9ed16e0910354510e0bae84d54991143"}, - {file = "pydantic-1.10.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:976cae77ba6a49d80f461fd8bba183ff7ba79f44aa5cfa82f1346b5626542f8e"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d45fc99d64af9aaf7e308054a0067fdcd87ffe974f2442312372dfa66e1001d"}, - {file = "pydantic-1.10.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d2a5ebb48958754d386195fe9e9c5106f11275867051bf017a8059410e9abf1f"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:abfb7d4a7cd5cc4e1d1887c43503a7c5dd608eadf8bc615413fc498d3e4645cd"}, - {file = "pydantic-1.10.7-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:80b1fab4deb08a8292d15e43a6edccdffa5377a36a4597bb545b93e79c5ff0a5"}, - {file = "pydantic-1.10.7-cp39-cp39-win_amd64.whl", hash = "sha256:d71e69699498b020ea198468e2480a2f1e7433e32a3a99760058c6520e2bea7e"}, - {file = "pydantic-1.10.7-py3-none-any.whl", hash = "sha256:0cd181f1d0b1d00e2b705f1bf1ac7799a2d938cce3376b8007df62b29be3c2c6"}, - {file = "pydantic-1.10.7.tar.gz", hash = "sha256:cfc83c0678b6ba51b0532bea66860617c4cd4251ecf76e9846fa5a9f3454e97e"}, + {file = "pydantic-1.10.8-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1243d28e9b05003a89d72e7915fdb26ffd1d39bdd39b00b7dbe4afae4b557f9d"}, + {file = "pydantic-1.10.8-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c0ab53b609c11dfc0c060d94335993cc2b95b2150e25583bec37a49b2d6c6c3f"}, + {file = "pydantic-1.10.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f9613fadad06b4f3bc5db2653ce2f22e0de84a7c6c293909b48f6ed37b83c61f"}, + {file = "pydantic-1.10.8-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:df7800cb1984d8f6e249351139667a8c50a379009271ee6236138a22a0c0f319"}, + {file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:0c6fafa0965b539d7aab0a673a046466d23b86e4b0e8019d25fd53f4df62c277"}, + {file = "pydantic-1.10.8-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:e82d4566fcd527eae8b244fa952d99f2ca3172b7e97add0b43e2d97ee77f81ab"}, + {file = "pydantic-1.10.8-cp310-cp310-win_amd64.whl", hash = "sha256:ab523c31e22943713d80d8d342d23b6f6ac4b792a1e54064a8d0cf78fd64e800"}, + {file = "pydantic-1.10.8-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:666bdf6066bf6dbc107b30d034615d2627e2121506c555f73f90b54a463d1f33"}, + {file = "pydantic-1.10.8-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:35db5301b82e8661fa9c505c800d0990bc14e9f36f98932bb1d248c0ac5cada5"}, + {file = "pydantic-1.10.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f90c1e29f447557e9e26afb1c4dbf8768a10cc676e3781b6a577841ade126b85"}, + {file = "pydantic-1.10.8-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:93e766b4a8226e0708ef243e843105bf124e21331694367f95f4e3b4a92bbb3f"}, + {file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:88f195f582851e8db960b4a94c3e3ad25692c1c1539e2552f3df7a9e972ef60e"}, + {file = "pydantic-1.10.8-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:34d327c81e68a1ecb52fe9c8d50c8a9b3e90d3c8ad991bfc8f953fb477d42fb4"}, + {file = "pydantic-1.10.8-cp311-cp311-win_amd64.whl", hash = "sha256:d532bf00f381bd6bc62cabc7d1372096b75a33bc197a312b03f5838b4fb84edd"}, + {file = "pydantic-1.10.8-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:7d5b8641c24886d764a74ec541d2fc2c7fb19f6da2a4001e6d580ba4a38f7878"}, + {file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7b1f6cb446470b7ddf86c2e57cd119a24959af2b01e552f60705910663af09a4"}, + {file = "pydantic-1.10.8-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c33b60054b2136aef8cf190cd4c52a3daa20b2263917c49adad20eaf381e823b"}, + {file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:1952526ba40b220b912cdc43c1c32bcf4a58e3f192fa313ee665916b26befb68"}, + {file = "pydantic-1.10.8-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:bb14388ec45a7a0dc429e87def6396f9e73c8c77818c927b6a60706603d5f2ea"}, + {file = "pydantic-1.10.8-cp37-cp37m-win_amd64.whl", hash = "sha256:16f8c3e33af1e9bb16c7a91fc7d5fa9fe27298e9f299cff6cb744d89d573d62c"}, + {file = "pydantic-1.10.8-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1ced8375969673929809d7f36ad322934c35de4af3b5e5b09ec967c21f9f7887"}, + {file = "pydantic-1.10.8-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:93e6bcfccbd831894a6a434b0aeb1947f9e70b7468f274154d03d71fabb1d7c6"}, + {file = "pydantic-1.10.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:191ba419b605f897ede9892f6c56fb182f40a15d309ef0142212200a10af4c18"}, + {file = "pydantic-1.10.8-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:052d8654cb65174d6f9490cc9b9a200083a82cf5c3c5d3985db765757eb3b375"}, + {file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:ceb6a23bf1ba4b837d0cfe378329ad3f351b5897c8d4914ce95b85fba96da5a1"}, + {file = "pydantic-1.10.8-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:6f2e754d5566f050954727c77f094e01793bcb5725b663bf628fa6743a5a9108"}, + {file = "pydantic-1.10.8-cp38-cp38-win_amd64.whl", hash = "sha256:6a82d6cda82258efca32b40040228ecf43a548671cb174a1e81477195ed3ed56"}, + {file = "pydantic-1.10.8-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:3e59417ba8a17265e632af99cc5f35ec309de5980c440c255ab1ca3ae96a3e0e"}, + {file = "pydantic-1.10.8-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:84d80219c3f8d4cad44575e18404099c76851bc924ce5ab1c4c8bb5e2a2227d0"}, + {file = "pydantic-1.10.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2e4148e635994d57d834be1182a44bdb07dd867fa3c2d1b37002000646cc5459"}, + {file = "pydantic-1.10.8-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:12f7b0bf8553e310e530e9f3a2f5734c68699f42218bf3568ef49cd9b0e44df4"}, + {file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:42aa0c4b5c3025483240a25b09f3c09a189481ddda2ea3a831a9d25f444e03c1"}, + {file = "pydantic-1.10.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:17aef11cc1b997f9d574b91909fed40761e13fac438d72b81f902226a69dac01"}, + {file = "pydantic-1.10.8-cp39-cp39-win_amd64.whl", hash = "sha256:66a703d1983c675a6e0fed8953b0971c44dba48a929a2000a493c3772eb61a5a"}, + {file = "pydantic-1.10.8-py3-none-any.whl", hash = "sha256:7456eb22ed9aaa24ff3e7b4757da20d9e5ce2a81018c1b3ebd81a0b88a18f3b2"}, + {file = "pydantic-1.10.8.tar.gz", hash = "sha256:1410275520dfa70effadf4c21811d755e7ef9bb1f1d077a21958153a92c8d9ca"}, ] [package.dependencies] @@ -707,14 +766,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -722,18 +781,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -751,14 +810,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.311" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.311-py3-none-any.whl", hash = "sha256:04df30c6b31d05068effe5563411291c876f5e4221d0af225a267b61dce1ca85"}, + {file = "pyright-1.1.311.tar.gz", hash = "sha256:554b555d3f770e8da2e76d6bb94e2ac63b3edc7dcd5fb8de202f9dd53e36689a"}, ] [package.dependencies] @@ -809,6 +868,41 @@ pytest = ">=6.1.0" [package.extras] testing = ["coverage (>=6.2)", "flaky (>=3.5.0)", "hypothesis (>=5.7.1)", "mypy (>=0.931)", "pytest-trio (>=0.7.0)"] +[[package]] +name = "pytest-html" +version = "3.2.0" +description = "pytest plugin for generating HTML reports" +category = "dev" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pytest-html-3.2.0.tar.gz", hash = "sha256:c4e2f4bb0bffc437f51ad2174a8a3e71df81bbc2f6894604e604af18fbe687c3"}, + {file = "pytest_html-3.2.0-py3-none-any.whl", hash = "sha256:868c08564a68d8b2c26866f1e33178419bb35b1e127c33784a28622eb827f3f3"}, +] + +[package.dependencies] +py = ">=1.8.2" +pytest = ">=5.0,<6.0.0 || >6.0.0" +pytest-metadata = "*" + +[[package]] +name = "pytest-metadata" +version = "3.0.0" +description = "pytest plugin for test session metadata" +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest_metadata-3.0.0-py3-none-any.whl", hash = "sha256:a17b1e40080401dc23177599208c52228df463db191c1a573ccdffacd885e190"}, + {file = "pytest_metadata-3.0.0.tar.gz", hash = "sha256:769a9c65d2884bd583bc626b0ace77ad15dbe02dd91a9106d47fd46d9c2569ca"}, +] + +[package.dependencies] +pytest = ">=7.0.0" + +[package.extras] +test = ["black (>=22.1.0)", "flake8 (>=4.0.1)", "pre-commit (>=2.17.0)", "tox (>=3.24.5)"] + [[package]] name = "pyyaml" version = "6.0" @@ -861,14 +955,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -880,19 +974,19 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.8.0" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.8.0-py3-none-any.whl", hash = "sha256:5df61bf30bb10c6f756eb19e7c9f3b473051f48db77fddbe06ff2ca307df9a6f"}, + {file = "setuptools-67.8.0.tar.gz", hash = "sha256:62642358adc77ffa87233bc4d2354c4b2682d214048f500964dbe760ccedf102"}, ] [package.extras] docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] -testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] [[package]] @@ -933,14 +1027,14 @@ files = [ [[package]] name = "stevedore" -version = "5.0.0" +version = "5.1.0" description = "Manage dynamic plugins for Python applications" category = "dev" optional = false python-versions = ">=3.8" files = [ - {file = "stevedore-5.0.0-py3-none-any.whl", hash = "sha256:bd5a71ff5e5e5f5ea983880e4a1dd1bb47f8feebbb3d95b592398e2f02194771"}, - {file = "stevedore-5.0.0.tar.gz", hash = "sha256:2c428d2338976279e8eb2196f7a94910960d9f7ba2f41f3988511e95ca447021"}, + {file = "stevedore-5.1.0-py3-none-any.whl", hash = "sha256:8cc040628f3cea5d7128f2e76cf486b2251a4e543c7b938f58d9a377f6694a2d"}, + {file = "stevedore-5.1.0.tar.gz", hash = "sha256:a54534acf9b89bc7ed264807013b505bf07f74dbe4bcfa37d32bd063870b087c"}, ] [package.dependencies] @@ -972,14 +1066,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1051,26 +1145,26 @@ test = ["black (>=22.3.0,<23.0.0)", "coverage (>=6.2,<7.0)", "isort (>=5.0.6,<6. [[package]] name = "typing-extensions" -version = "4.5.0" +version = "4.6.2" description = "Backported and Experimental Type Hints for Python 3.7+" category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"}, - {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"}, + {file = "typing_extensions-4.6.2-py3-none-any.whl", hash = "sha256:3a8b36f13dd5fdc5d1b16fe317f5668545de77fa0b8e02006381fd49d731ab98"}, + {file = "typing_extensions-4.6.2.tar.gz", hash = "sha256:06006244c70ac8ee83fa8282cb188f697b8db25bc8b4df07be1873c43897060c"}, ] [[package]] name = "typing-inspect" -version = "0.8.0" +version = "0.9.0" description = "Runtime inspection utilities for typing module." category = "dev" optional = false python-versions = "*" files = [ - {file = "typing_inspect-0.8.0-py3-none-any.whl", hash = "sha256:5fbf9c1e65d4fa01e701fe12a5bca6c6e08a4ffd5bc60bfac028253a447c5188"}, - {file = "typing_inspect-0.8.0.tar.gz", hash = "sha256:8b1ff0c400943b6145df8119c41c244ca8207f1f10c9c057aeed1560e4806e3d"}, + {file = "typing_inspect-0.9.0-py3-none-any.whl", hash = "sha256:9ee6fc59062311ef8547596ab6b955e1b8aa46242d854bfc78f4f6b0eff35f9f"}, + {file = "typing_inspect-0.9.0.tar.gz", hash = "sha256:b23fc42ff6f6ef6954e4852c1fb512cdd18dbea03134f91f856a95ccc9461f78"}, ] [package.dependencies] @@ -1102,24 +1196,24 @@ files = [ [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wasmtime" @@ -1228,4 +1322,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "fe0ff56fdfea8c24f99eca11ef45f7191537144fe7bd072efb26e347b854d8d9" +content-hash = "79ae9ce53c2dd5d8fbaf60d88c5e2b7fe5f119f5ada10ff0ebd2515b76fe9d7c" diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/__init__.py index 0d1e90f6..79616fc5 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/__init__.py @@ -2,4 +2,3 @@ from .errors import * from .resolvers import * from .types import * -from .utils import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/errors.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/errors.py index b55063b7..c25490d5 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/errors.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/errors.py @@ -1,13 +1,8 @@ """This module contains all the errors related to URI resolution.""" import json -from dataclasses import asdict -from typing import List, TypeVar +from typing import List -from polywrap_core import IUriResolutionStep, Uri, UriLike - -from .utils import get_uri_resolution_path - -TUriLike = TypeVar("TUriLike", bound=UriLike) +from polywrap_core import Uri, UriResolutionStep, build_clean_uri_history class UriResolutionError(Exception): @@ -15,19 +10,23 @@ class UriResolutionError(Exception): class InfiniteLoopError(UriResolutionError): - """Raised when an infinite loop is detected while resolving a URI.""" + """Raised when an infinite loop is detected while resolving a URI. + + Args: + uri (Uri): The URI that caused the infinite loop. + history (List[UriResolutionStep]): The resolution history. + """ - def __init__(self, uri: Uri, history: List[IUriResolutionStep[TUriLike]]): - """Initialize a new InfiniteLoopError instance. + uri: Uri + history: List[UriResolutionStep] - Args: - uri (Uri): The URI that caused the infinite loop. - history (List[IUriResolutionStep[TUriLike]]): The resolution history. - """ - resolution_path = get_uri_resolution_path(history) + def __init__(self, uri: Uri, history: List[UriResolutionStep]): + """Initialize a new InfiniteLoopError instance.""" + self.uri = uri + self.history = history super().__init__( f"An infinite loop was detected while resolving the URI: {uri.uri}\n" - f"History: {json.dumps([asdict(step) for step in resolution_path], indent=2)}" + f"History: {json.dumps(build_clean_uri_history(history), indent=2)}" ) @@ -36,16 +35,29 @@ class UriResolverExtensionError(UriResolutionError): class UriResolverExtensionNotFoundError(UriResolverExtensionError): - """Raised when an extension resolver wrapper could not be found for a URI.""" + """Raised when an extension resolver wrapper could not be found for a URI. - def __init__(self, uri: Uri, history: List[IUriResolutionStep[TUriLike]]): - """Initialize a new UriResolverExtensionNotFoundError instance. + Args: + uri (Uri): The URI that caused the error. + history (List[UriResolutionStep]): The resolution history. + """ - Args: - uri (Uri): The URI that caused the error. - history (List[IUriResolutionStep[TUriLike]]): The resolution history. - """ + uri: Uri + history: List[UriResolutionStep] + + def __init__(self, uri: Uri, history: List[UriResolutionStep]): + """Initialize a new UriResolverExtensionNotFoundError instance.""" + self.uri = uri + self.history = history super().__init__( f"Could not find an extension resolver wrapper for the URI: {uri.uri}\n" - f"History: {json.dumps([asdict(step) for step in history], indent=2)}" + f"History: {json.dumps(build_clean_uri_history(history), indent=2)}" ) + + +__all__ = [ + "UriResolutionError", + "InfiniteLoopError", + "UriResolverExtensionError", + "UriResolverExtensionNotFoundError", +] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/abc/resolver_with_history.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/abc/resolver_with_history.py index f88ddc86..5cf67df6 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/abc/resolver_with_history.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/abc/resolver_with_history.py @@ -3,14 +3,13 @@ from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, UriResolver, ) -from ...types import UriResolutionStep - class ResolverWithHistory(UriResolver): """Defines an abstract resolver that tracks its steps in\ @@ -20,11 +19,11 @@ class ResolverWithHistory(UriResolver): their steps in the resolution context. """ - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI and \ update the resolution context with the result. @@ -35,15 +34,15 @@ async def try_resolve_uri( Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ + client (InvokerClient): The client to use for\ resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]):\ + resolution_context (IUriResolutionContext):\ The resolution context to update. Returns: UriPackageOrWrapper: The resolved URI package, wrapper, or URI. """ - result = await self._try_resolve_uri(uri, client, resolution_context) + result = self._try_resolve_uri(uri, client, resolution_context) step = UriResolutionStep( source_uri=uri, result=result, description=self.get_step_description() ) @@ -56,18 +55,21 @@ def get_step_description(self) -> str: """Get a description of the resolution step.""" @abstractmethod - async def _try_resolve_uri( + def _try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Resolve a URI to a wrap package, a wrapper, or a URI using an internal function. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ + client (InvokerClient): The client to use for\ resolving the URI. resolution_context (IUriResolutionContext[UriPackageOrWrapper]):\ The resolution context to update. """ + + +__all__ = ["ResolverWithHistory"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/__init__.py index dd95cc95..74139217 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/__init__.py @@ -1,2 +1,3 @@ """This package contains the resolvers for aggregator resolvers.""" from .uri_resolver_aggregator import * +from .uri_resolver_aggregator_base import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py index a49e9c49..d27f57f4 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator.py @@ -1,92 +1,46 @@ """This module contains the UriResolverAggregator Resolver.""" -from typing import List, Optional, cast +from typing import List, Optional -from polywrap_core import ( - InvokerClient, - IUriResolutionContext, - Uri, - UriPackage, - UriPackageOrWrapper, - UriResolver, - UriWrapper, -) +from polywrap_core import InvokerClient, UriResolutionContext, UriResolver -from ...types import UriResolutionStep +from .uri_resolver_aggregator_base import UriResolverAggregatorBase -class UriResolverAggregator(UriResolver): +class UriResolverAggregator(UriResolverAggregatorBase): """Defines a resolver that aggregates a list of resolvers. This resolver aggregates a list of resolvers and tries to resolve\ the uri with each of them. If a resolver returns a value\ other than the resolving uri, the value is returned. - Attributes: + Args: resolvers (List[UriResolver]): The list of resolvers to aggregate. step_description (Optional[str]): The description of the resolution\ step. Defaults to the class name. """ - __slots__ = ("resolvers", "step_description") + __slots__ = ("_resolvers", "_step_description") - resolvers: List[UriResolver] - step_description: Optional[str] + _resolvers: List[UriResolver] + _step_description: Optional[str] def __init__( self, resolvers: List[UriResolver], step_description: Optional[str] = None ): - """Initialize a new UriResolverAggregator instance. + """Initialize a new UriResolverAggregator instance.""" + self._step_description = step_description or self.__class__.__name__ + self._resolvers = resolvers + super().__init__() - Args: - resolvers (List[UriResolver]): The list of resolvers to aggregate. - step_description (Optional[str]): The description of the resolution\ - step. Defaults to the class name. - """ - self.step_description = step_description or self.__class__.__name__ - self.resolvers = resolvers + def get_step_description(self) -> Optional[str]: + """Get the description of the resolution step.""" + return self._step_description - async def try_resolve_uri( - self, - uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], - ) -> UriPackageOrWrapper: - """Try to resolve a URI to a wrap package, a wrapper, or a URI. + def get_resolvers( + self, client: InvokerClient, resolution_context: UriResolutionContext + ) -> List[UriResolver]: + """Get the list of resolvers to aggregate.""" + return self._resolvers - This method tries to resolve the uri with each of the aggregated\ - resolvers. If a resolver returns a value other than the resolving\ - uri, the value is returned. - - Args: - uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ - resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]):\ - The resolution context to update. - """ - sub_context = resolution_context.create_sub_history_context() - for resolver in self.resolvers: - uri_package_or_wrapper = await resolver.try_resolve_uri( - uri, client, sub_context - ) - if uri_package_or_wrapper != uri or isinstance( - uri_package_or_wrapper, (UriPackage, UriWrapper) - ): - step = UriResolutionStep( - source_uri=uri, - result=cast(UriPackageOrWrapper, uri_package_or_wrapper), - sub_history=sub_context.get_history(), - description=self.step_description, - ) - resolution_context.track_step(step) - return cast(UriPackageOrWrapper, uri_package_or_wrapper) - - step = UriResolutionStep( - source_uri=uri, - result=uri, - sub_history=sub_context.get_history(), - description=self.step_description, - ) - resolution_context.track_step(step) - return uri +__all__ = ["UriResolverAggregator"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator_base.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator_base.py new file mode 100644 index 00000000..53ceafb0 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/aggregator/uri_resolver_aggregator_base.py @@ -0,0 +1,84 @@ +"""This module contains the UriResolverAggregator Resolver.""" +# pylint: disable=unnecessary-ellipsis +from abc import ABC, abstractmethod +from typing import List, Optional + +from polywrap_core import ( + InvokerClient, + Uri, + UriPackage, + UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, + UriResolver, + UriWrapper, +) + + +class UriResolverAggregatorBase(UriResolver, ABC): + """Defines a base resolver that aggregates a list of resolvers. + + This resolver aggregates a list of resolvers and tries to resolve\ + the uri with each of them. If a resolver returns a value\ + other than the resolving uri, the value is returned. + """ + + @abstractmethod + def get_resolvers( + self, client: InvokerClient, resolution_context: UriResolutionContext + ) -> List[UriResolver]: + """Get the list of resolvers to aggregate.""" + ... + + @abstractmethod + def get_step_description(self) -> Optional[str]: + """Get the description of the resolution step. Defaults to the class name.""" + ... + + def try_resolve_uri( + self, + uri: Uri, + client: InvokerClient, + resolution_context: UriResolutionContext, + ) -> UriPackageOrWrapper: + """Try to resolve a URI to a wrap package, a wrapper, or a URI. + + This method tries to resolve the uri with each of the aggregated\ + resolvers. If a resolver returns a value other than the resolving\ + uri, the value is returned. + + Args: + uri (Uri): The URI to resolve. + client (InvokerClient): The client to use for\ + resolving the URI. + resolution_context (UriResolutionContext):\ + The resolution context to update. + """ + sub_context = resolution_context.create_sub_history_context() + + for resolver in self.get_resolvers(client, sub_context): + uri_package_or_wrapper = resolver.try_resolve_uri(uri, client, sub_context) + if ( + isinstance(uri_package_or_wrapper, (UriPackage, UriWrapper)) + or uri_package_or_wrapper != uri + ): + step = UriResolutionStep( + source_uri=uri, + result=uri_package_or_wrapper, + sub_history=sub_context.get_history(), + description=self.get_step_description(), + ) + resolution_context.track_step(step) + return uri_package_or_wrapper + + step = UriResolutionStep( + source_uri=uri, + result=uri, + sub_history=sub_context.get_history(), + description=self.get_step_description(), + ) + resolution_context.track_step(step) + return uri + + +__all__ = ["UriResolverAggregatorBase"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/__init__.py index a2b310c6..dc25fa1e 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/__init__.py @@ -1,3 +1,2 @@ """This package contains the resolvers for caching.""" -from .cache_resolver import * -from .request_synchronizer_resolver import * +from .resolution_result_cache_resolver import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/request_synchronizer_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/request_synchronizer_resolver.py deleted file mode 100644 index ebc3df99..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/request_synchronizer_resolver.py +++ /dev/null @@ -1,132 +0,0 @@ -"""This module contains the RequestSynchronizerResolver.""" -from asyncio import Future, ensure_future -from dataclasses import dataclass -from typing import Optional, Union - -from polywrap_core import ( - Dict, - InvokerClient, - IUriResolutionContext, - Uri, - UriPackageOrWrapper, - UriResolver, -) - -from ...types import UriResolutionStep - - -@dataclass(kw_only=True, slots=True) -class RequestSynchronizerResolverOptions: - """Defines the options for the RequestSynchronizerResolver. - - Attributes: - should_ignore_cache (Optional[bool]): Whether to ignore the cache.\ - Defaults to False. - """ - - should_ignore_cache: Optional[bool] - - -class RequestSynchronizerResolver(UriResolver): - """Defines a resolver that synchronizes requests. - - This resolver synchronizes requests to the same uri.\ - If a request is already in progress, it returns the future\ - of the existing request.\ - If a request is not in progress, it creates a new request\ - and returns the future of the new request. - - Attributes: - existing_requests (Dict[Uri, Future[UriPackageOrWrapper]]):\ - The existing requests. - resolver_to_synchronize (UriResolver): The URI resolver \ - to synchronize. - options (Optional[RequestSynchronizerResolverOptions]):\ - The options to use. - """ - - __slots__ = ("resolver_to_synchronize", "options") - - existing_requests: Dict[Uri, Future[UriPackageOrWrapper]] - resolver_to_synchronize: UriResolver - options: Optional[RequestSynchronizerResolverOptions] - - def __init__( - self, - resolver_to_synchronize: UriResolver, - options: Optional[RequestSynchronizerResolverOptions] = None, - ): - """Initialize a new RequestSynchronizerResolver instance. - - Args: - resolver_to_synchronize (UriResolver): The URI resolver \ - to synchronize. - options (Optional[RequestSynchronizerResolverOptions]):\ - The options to use. - """ - self.existing_requests = {} - self.resolver_to_synchronize = resolver_to_synchronize - self.options = options - - def get_options(self) -> Union[RequestSynchronizerResolverOptions, None]: - """Get the options. - - Returns: - Union[RequestSynchronizerResolverOptions, None]:\ - The options or None. - """ - return self.options - - async def try_resolve_uri( - self, - uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], - ) -> UriPackageOrWrapper: - """Try to resolve the given uri to a wrap package, wrapper or uri. - - Synchronize requests to the same uri.\ - If a request is already in progress, it returns the future\ - of the existing request.\ - If a request is not in progress, it creates a new request\ - and returns the future of the new request. - - Args: - uri (Uri): The uri to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]):\ - The resolution context. - - Returns: - UriPackageOrWrapper: The resolved uri package, wrapper or uri. - """ - sub_context = resolution_context.create_sub_history_context() - - if existing_request := self.existing_requests.get(uri): - uri_package_or_wrapper = await existing_request - resolution_context.track_step( - UriResolutionStep( - source_uri=uri, - result=uri_package_or_wrapper, - description="RequestSynchronizerResolver (Cache)", - ) - ) - return uri_package_or_wrapper - - request_future = ensure_future( - self.resolver_to_synchronize.try_resolve_uri( - uri, - client, - sub_context, - ) - ) - self.existing_requests[uri] = request_future - uri_package_or_wrapper = await request_future - resolution_context.track_step( - UriResolutionStep( - source_uri=uri, - result=uri_package_or_wrapper, - description="RequestSynchronizerResolver (Cache)", - ) - ) - return uri_package_or_wrapper diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/resolution_result_cache_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/resolution_result_cache_resolver.py new file mode 100644 index 00000000..cb3dd7d5 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/resolution_result_cache_resolver.py @@ -0,0 +1,116 @@ +"""This module contains the ResolutionResultCacheResolver.""" + +from polywrap_core import ( + InvokerClient, + Uri, + UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, + UriResolver, +) + +from ...errors import UriResolutionError +from ...types import ResolutionResultCache + + +class ResolutionResultCacheResolver(UriResolver): + """An implementation of IUriResolver that caches the URI resolution result. + + The URI resolution result can be a URI, IWrapPackage, Wrapper, or Error. + Errors are not cached by default and can be cached by setting the cache_errors option to True. + + Args: + resolver_to_cache (UriResolver): The URI resolver to cache. + cache (ResolutionResultCache): The resolution result cache. + cache_errors (bool): Whether to cache errors. + """ + + __slots__ = ("resolver_to_cache", "cache", "cache_errors") + + resolver_to_cache: UriResolver + """The URI resolver to cache.""" + + cache: ResolutionResultCache + """The resolution result cache.""" + + cache_errors: bool + """Whether to cache errors.""" + + def __init__( + self, + resolver_to_cache: UriResolver, + cache: ResolutionResultCache, + cache_errors: bool = False, + ): + """Initialize a new ResolutionResultCacheResolver instance.""" + self.resolver_to_cache = resolver_to_cache + self.cache = cache + self.cache_errors = cache_errors + + def try_resolve_uri( + self, + uri: Uri, + client: InvokerClient, + resolution_context: UriResolutionContext, + ) -> UriPackageOrWrapper: + """Try to resolve a URI to a wrap package, a wrapper, or a URI. + + This method tries to resolve the URI with the resolver to cache.\ + If the result is in the cache, it returns the cached result.\ + If the result is not in the cache, it resolves the URI using\ + the inner resolver and caches the result. + + Args: + uri (Uri): The URI to resolve. + client (InvokerClient): The client to use. + resolution_context (UriResolutionContext): The resolution context to use. + + Returns: + UriPackageOrWrapper: The result of the resolution. + """ + if cached_result := self.cache.get(uri): + if isinstance(cached_result, UriResolutionError): + raise cached_result + + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, + result=cached_result, + description="ResolutionResultCacheResolver (Cache)", + ) + ) + return cached_result + + sub_context = resolution_context.create_sub_history_context() + result: UriPackageOrWrapper + + if self.cache_errors: + try: + result = self.resolver_to_cache.try_resolve_uri( + uri, + client, + sub_context, + ) + except UriResolutionError as error: + self.cache.set(uri, error) + raise error + else: + result = self.resolver_to_cache.try_resolve_uri( + uri, + client, + sub_context, + ) + self.cache.set(uri, result) + + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, + result=result, + sub_history=sub_context.get_history(), + description="ResolutionResultCacheResolver", + ) + ) + return result + + +__all__ = ["ResolutionResultCacheResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extendable_uri_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extendable_uri_resolver.py index 29bff003..c89d931c 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extendable_uri_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extendable_uri_resolver.py @@ -1,19 +1,13 @@ """This module contains the ExtendableUriResolver class.""" -from typing import List, Optional, cast +from typing import List, Optional -from polywrap_core import ( - InvokerClient, - IUriResolutionContext, - Uri, - UriPackageOrWrapper, - UriResolver, -) +from polywrap_core import InvokerClient, Uri, UriResolutionContext, UriResolver -from ..aggregator import UriResolverAggregator +from ..aggregator import UriResolverAggregatorBase from .extension_wrapper_uri_resolver import ExtensionWrapperUriResolver -class ExtendableUriResolver(UriResolver): +class ExtendableUriResolver(UriResolverAggregatorBase): """Defines a resolver that resolves a uri to a wrapper by using extension wrappers. This resolver resolves a uri to a wrapper by using extension wrappers.\ @@ -22,65 +16,53 @@ class ExtendableUriResolver(UriResolver): The aggregated extension wrapper resolver is then used to resolve\ the uri to a wrapper. - Attributes: - DEFAULT_EXT_INTERFACE_URIS (List[Uri]): The default list of extension\ + Args: + ext_interface_uris (Optional[List[Uri]]): The list of extension\ + interface uris. Defaults to the default list of extension\ interface uris. - ext_interface_uris (List[Uri]): The list of extension interface uris. - resolver_name (str): The name of the resolver. + resolver_name (Optional[str]): The name of the resolver. Defaults\ + to the class name. """ DEFAULT_EXT_INTERFACE_URIS = [ Uri.from_str("wrap://ens/wraps.eth:uri-resolver-ext@1.1.0"), Uri.from_str("wrap://ens/wraps.eth:uri-resolver-ext@1.0.0"), ] + """The default list of extension interface uris.""" + ext_interface_uris: List[Uri] + """The list of extension interface uris.""" + resolver_name: str + """The name of the resolver.""" def __init__( self, ext_interface_uris: Optional[List[Uri]] = None, resolver_name: Optional[str] = None, ): - """Initialize a new ExtendableUriResolver instance. - - Args: - ext_interface_uris (Optional[List[Uri]]): The list of extension\ - interface uris. Defaults to the default list of extension\ - interface uris. - resolver_name (Optional[str]): The name of the resolver. Defaults\ - to the class name. - """ + """Initialize a new ExtendableUriResolver instance.""" self.ext_interface_uris = ext_interface_uris or self.DEFAULT_EXT_INTERFACE_URIS self.resolver_name = resolver_name or self.__class__.__name__ + super().__init__() - async def try_resolve_uri( - self, - uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], - ) -> UriPackageOrWrapper: - """Try to resolve a URI to a wrap package, a wrapper, or a URI. - - Args: - uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ - resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ - resolution context. - - Returns: - UriPackageOrWrapper: The resolved URI, wrap package, or wrapper. - """ + def get_step_description(self) -> Optional[str]: + """Get the description of the resolution step.""" + return self.resolver_name + + def get_resolvers( + self, client: InvokerClient, resolution_context: UriResolutionContext + ) -> List[UriResolver]: + """Get the list of resolvers to aggregate.""" uri_resolvers_uris: List[Uri] = [] for ext_interface_uri in self.ext_interface_uris: uri_resolvers_uris.extend( - client.get_implementations(ext_interface_uri) or [] + client.get_implementations(ext_interface_uri, apply_resolution=False) + or [] ) - resolvers = [ExtensionWrapperUriResolver(uri) for uri in uri_resolvers_uris] - aggregator = UriResolverAggregator( - cast(List[UriResolver], resolvers), self.resolver_name - ) + return [ExtensionWrapperUriResolver(uri) for uri in uri_resolvers_uris] + - return await aggregator.try_resolve_uri(uri, client, resolution_context) +__all__ = ["ExtendableUriResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extension_wrapper_uri_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extension_wrapper_uri_resolver.py index 1692df02..54b09854 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extension_wrapper_uri_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/extension_wrapper_uri_resolver.py @@ -1,28 +1,29 @@ """This module contains the ExtensionWrapperUriResolver class.""" -from typing import Optional, TypedDict, cast +from __future__ import annotations + +from typing import Optional, TypedDict from polywrap_core import ( - Client, - InvokeOptions, InvokerClient, - IUriResolutionContext, - TryResolveUriOptions, Uri, UriPackage, UriPackageOrWrapper, - UriWrapper, - Wrapper, + UriResolutionContext, + UriResolutionStep, + UriResolver, + WrapError, ) -from polywrap_msgpack import msgpack_decode from polywrap_wasm import WasmPackage -from ...errors import UriResolverExtensionError, UriResolverExtensionNotFoundError -from ...utils import get_env_from_uri_history -from ..abc import ResolverWithHistory +from ...errors import ( + InfiniteLoopError, + UriResolverExtensionError, + UriResolverExtensionNotFoundError, +) from .uri_resolver_extension_file_reader import UriResolverExtensionFileReader -class MaybeUriOrManifest(TypedDict): +class MaybeUriOrManifest(TypedDict, total=False): """Defines a type for the return value of the extension wrapper's\ tryResolveUri function. @@ -34,27 +35,24 @@ class MaybeUriOrManifest(TypedDict): manifest: Optional[bytes] -class ExtensionWrapperUriResolver(ResolverWithHistory): +class ExtensionWrapperUriResolver(UriResolver): """Defines a resolver that resolves a uri to a wrapper by using an extension wrapper. This resolver resolves a uri to a wrapper by using an extension wrapper.\ The extension wrapper is resolved using the extension wrapper uri resolver.\ The extension wrapper is then used to resolve the uri to a wrapper. - Attributes: + Args: extension_wrapper_uri (Uri): The uri of the extension wrapper. """ __slots__ = ("extension_wrapper_uri",) extension_wrapper_uri: Uri + """The uri of the extension wrapper.""" def __init__(self, extension_wrapper_uri: Uri): - """Initialize a new ExtensionWrapperUriResolver instance. - - Args: - extension_wrapper_uri (Uri): The uri of the extension wrapper. - """ + """Initialize a new ExtensionWrapperUriResolver instance.""" self.extension_wrapper_uri = extension_wrapper_uri def get_step_description(self) -> str: @@ -65,11 +63,11 @@ def get_step_description(self) -> str: """ return f"ResolverExtension ({self.extension_wrapper_uri})" - async def _try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. @@ -80,9 +78,9 @@ async def _try_resolve_uri( Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ + client (InvokerClient): The client to use for\ resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ + resolution_context (UriResolutionContext): The\ resolution context. Returns: @@ -91,103 +89,73 @@ async def _try_resolve_uri( sub_context = resolution_context.create_sub_context() try: - extension_wrapper = await self._load_resolver_extension(client, sub_context) - uri_or_manifest = await self._try_resolve_uri_with_extension( - uri, extension_wrapper, client, sub_context + uri_package_or_wrapper = self._try_resolve_uri_with_extension( + uri, client, sub_context ) - if uri_or_manifest.get("uri"): - return Uri.from_str(cast(str, uri_or_manifest["uri"])) - - if uri_or_manifest.get("manifest"): - package = WasmPackage( - UriResolverExtensionFileReader( - self.extension_wrapper_uri, uri, client - ), - uri_or_manifest["manifest"], + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, + result=uri_package_or_wrapper, + description=self.get_step_description(), + sub_history=sub_context.get_history(), ) - return UriPackage(uri, package) - - return uri + ) - except Exception as err: + return uri_package_or_wrapper + except WrapError as err: raise UriResolverExtensionError( f"Failed to resolve uri: {uri}, using extension resolver: " f"({self.extension_wrapper_uri})" ) from err - - async def _load_resolver_extension( - self, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], - ) -> Wrapper[UriPackageOrWrapper]: - """Load the URI resolver extension wrapper. - - Args: - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ - resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ - resolution context. - """ - result = await client.try_resolve_uri( - TryResolveUriOptions( - uri=self.extension_wrapper_uri, resolution_context=resolution_context - ) - ) - - extension_wrapper: Wrapper[UriPackageOrWrapper] - - if isinstance(result, UriPackage): - extension_wrapper = await cast( - UriPackage[UriPackageOrWrapper], result - ).package.create_wrapper() - elif isinstance(result, UriWrapper): - extension_wrapper = cast(UriWrapper[UriPackageOrWrapper], result).wrapper - else: - raise UriResolverExtensionNotFoundError( - self.extension_wrapper_uri, resolution_context.get_history() - ) - return extension_wrapper - - async def _try_resolve_uri_with_extension( + except InfiniteLoopError as err: + if err.uri == self.extension_wrapper_uri: + raise UriResolverExtensionNotFoundError( + self.extension_wrapper_uri, sub_context.get_history() + ) from err + raise err + + def _try_resolve_uri_with_extension( self, uri: Uri, - extension_wrapper: Wrapper[UriPackageOrWrapper], - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], - ) -> MaybeUriOrManifest: + client: InvokerClient, + resolution_context: UriResolutionContext, + ) -> UriPackageOrWrapper: """Try to resolve a URI to a uri or a manifest using the extension wrapper. Args: uri (Uri): The URI to resolve. - extension_wrapper (Wrapper[UriPackageOrWrapper]): The extension wrapper. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ - resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ - resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: MaybeUriOrManifest: The resolved URI or manifest. """ - env = ( - get_env_from_uri_history( - resolution_context.get_resolution_path(), cast(Client, client) - ) - if hasattr(client, "get_env_by_uri") - else None + uri_or_manifest: Optional[MaybeUriOrManifest] = client.invoke( + uri=self.extension_wrapper_uri, + method="tryResolveUri", + args={ + "authority": uri.authority, + "path": uri.path, + }, + encode_result=False, + resolution_context=resolution_context, ) - result = await extension_wrapper.invoke( - InvokeOptions( - uri=self.extension_wrapper_uri, - method="tryResolveUri", - args={ - "authority": uri.authority, - "path": uri.path, - }, - env=env, - ), - client, - ) + if uri_or_manifest is None: + return uri + + if result_uri := uri_or_manifest.get("uri"): + return Uri.from_str(result_uri) + + if result_manifest := uri_or_manifest.get("manifest"): + package = WasmPackage( + UriResolverExtensionFileReader(self.extension_wrapper_uri, uri, client), + result_manifest, + ) + return UriPackage(uri=uri, package=package) + + return uri + - return msgpack_decode(result) if isinstance(result, bytes) else result +__all__ = ["ExtensionWrapperUriResolver", "MaybeUriOrManifest"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/uri_resolver_extension_file_reader.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/uri_resolver_extension_file_reader.py index 7bacf0eb..b045248e 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/uri_resolver_extension_file_reader.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/extensions/uri_resolver_extension_file_reader.py @@ -1,7 +1,7 @@ """This module contains the UriResolverExtensionFileReader class.""" from pathlib import Path -from polywrap_core import FileReader, Invoker, InvokerOptions, Uri, UriPackageOrWrapper +from polywrap_core import FileReader, Invoker, Uri class UriResolverExtensionFileReader(FileReader): @@ -11,34 +11,33 @@ class UriResolverExtensionFileReader(FileReader): The extension wrapper is used to read files by invoking the getFile method.\ The getFile method is invoked with the path of the file to read. - Attributes: + Args: extension_uri (Uri): The uri of the extension wrapper. wrapper_uri (Uri): The uri of the wrapper that uses the extension wrapper. - invoker (Invoker[UriPackageOrWrapper]): The invoker used to invoke the getFile method. + invoker (Invoker): The invoker used to invoke the getFile method. """ extension_uri: Uri + """The uri of the extension wrapper.""" + wrapper_uri: Uri - invoker: Invoker[UriPackageOrWrapper] + """The uri of the wrapper that uses the extension wrapper.""" + + invoker: Invoker + """The invoker used to invoke the getFile method.""" def __init__( self, extension_uri: Uri, wrapper_uri: Uri, - invoker: Invoker[UriPackageOrWrapper], + invoker: Invoker, ): - """Initialize a new UriResolverExtensionFileReader instance. - - Args: - extension_uri (Uri): The uri of the extension wrapper. - wrapper_uri (Uri): The uri of the wrapper that uses the extension wrapper. - invoker (Invoker[UriPackageOrWrapper]): The invoker used to invoke the getFile method. - """ + """Initialize a new UriResolverExtensionFileReader instance.""" self.extension_uri = extension_uri self.wrapper_uri = wrapper_uri self.invoker = invoker - async def read_file(self, file_path: str) -> bytes: + def read_file(self, file_path: str) -> bytes: """Read a file using the extension wrapper. Args: @@ -48,10 +47,8 @@ async def read_file(self, file_path: str) -> bytes: bytes: The contents of the file. """ path = str(Path(self.wrapper_uri.path).joinpath(file_path)) - result = await self.invoker.invoke( - InvokerOptions( - uri=self.extension_uri, method="getFile", args={"path": path} - ) + result = self.invoker.invoke( + uri=self.extension_uri, method="getFile", args={"path": path} ) if not isinstance(result, bytes): @@ -59,3 +56,6 @@ async def read_file(self, file_path: str) -> bytes: f"File not found at path: {path}, using resolver: {self.extension_uri}" ) return result + + +__all__ = ["UriResolverExtensionFileReader"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/base_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/base_resolver.py index 6fd1bcc4..ec372fac 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/base_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/base_resolver.py @@ -4,9 +4,9 @@ from polywrap_core import ( FileReader, InvokerClient, - IUriResolutionContext, Uri, UriPackageOrWrapper, + UriResolutionContext, UriResolver, ) @@ -15,41 +15,44 @@ class BaseUriResolver(UriResolver): - """Defines the base URI resolver.""" + """Defines the base URI resolver. + + Args: + file_reader (FileReader): The file reader to use. + redirects (Dict[Uri, Uri]): The redirects to use. + """ _fs_resolver: FsUriResolver _redirect_resolver: RedirectUriResolver def __init__(self, file_reader: FileReader, redirects: Dict[Uri, Uri]): - """Initialize a new BaseUriResolver instance. - - Args: - file_reader (FileReader): The file reader to use. - redirects (Dict[Uri, Uri]): The redirects to use. - """ + """Initialize a new BaseUriResolver instance.""" self._fs_resolver = FsUriResolver(file_reader) self._redirect_resolver = RedirectUriResolver(redirects) - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI. """ - redirected_uri = await self._redirect_resolver.try_resolve_uri( + redirected_uri = self._redirect_resolver.try_resolve_uri( uri, client, resolution_context ) - return await self._fs_resolver.try_resolve_uri( + return self._fs_resolver.try_resolve_uri( redirected_uri, client, resolution_context ) + + +__all__ = ["BaseUriResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/fs_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/fs_resolver.py index b793702f..87c738bb 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/fs_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/fs_resolver.py @@ -4,19 +4,20 @@ from polywrap_core import ( FileReader, InvokerClient, - IUriResolutionContext, Uri, UriPackage, UriPackageOrWrapper, + UriResolutionContext, UriResolver, ) -from polywrap_wasm import WRAP_MANIFEST_PATH, WRAP_MODULE_PATH, WasmPackage +from polywrap_wasm import WasmPackage +from polywrap_wasm.constants import WRAP_MANIFEST_PATH, WRAP_MODULE_PATH class SimpleFileReader(FileReader): """Defines a simple file reader.""" - async def read_file(self, file_path: str) -> bytes: + def read_file(self, file_path: str) -> bytes: """Read a file. Args: @@ -30,30 +31,30 @@ async def read_file(self, file_path: str) -> bytes: class FsUriResolver(UriResolver): - """Defines a URI resolver that resolves file system URIs.""" + """Defines a URI resolver that resolves file system URIs. + + Args: + file_reader (FileReader): The file reader used to read files. + """ file_reader: FileReader def __init__(self, file_reader: FileReader): - """Initialize a new FsUriResolver instance. - - Args: - file_reader (FileReader): The file reader used to read files. - """ + """Initialize a new FsUriResolver instance.""" self.file_reader = file_reader - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI. @@ -63,13 +64,9 @@ async def try_resolve_uri( wrapper_path = Path(uri.path) - wasm_module = await self.file_reader.read_file( - str(wrapper_path / WRAP_MODULE_PATH) - ) + wasm_module = self.file_reader.read_file(str(wrapper_path / WRAP_MODULE_PATH)) - manifest = await self.file_reader.read_file( - str(wrapper_path / WRAP_MANIFEST_PATH) - ) + manifest = self.file_reader.read_file(str(wrapper_path / WRAP_MANIFEST_PATH)) return UriPackage( uri=uri, @@ -79,3 +76,6 @@ async def try_resolve_uri( file_reader=self.file_reader, ), ) + + +__all__ = ["FsUriResolver", "SimpleFileReader"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_to_wrapper_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/package_to_wrapper_resolver.py similarity index 72% rename from packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_to_wrapper_resolver.py rename to packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/package_to_wrapper_resolver.py index 3dd2a472..23c96768 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_to_wrapper_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/package_to_wrapper_resolver.py @@ -1,19 +1,19 @@ """This module contains the PackageToWrapperResolver class.""" from dataclasses import dataclass -from typing import Optional, cast +from typing import Optional from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackage, UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, UriResolver, UriWrapper, ) from polywrap_manifest import DeserializeManifestOptions -from ...types import UriResolutionStep from ..abc import ResolverWithHistory @@ -21,7 +21,7 @@ class PackageToWrapperResolverOptions: """Defines the options for the PackageToWrapperResolver. - Attributes: + Args: deserialize_manifest_options (DeserializeManifestOptions): The options\ to use when deserializing the manifest. """ @@ -37,7 +37,7 @@ class PackageToWrapperResolver(ResolverWithHistory): If result is a wrapper, it returns it back.\ In case of a package, it creates a wrapper and returns it back. - Attributes: + Args: resolver (UriResolver): The URI resolver to cache. options (PackageToWrapperResolverOptions): The options to use. """ @@ -50,39 +50,33 @@ def __init__( resolver: UriResolver, options: Optional[PackageToWrapperResolverOptions] = None, ) -> None: - """Initialize a new PackageToWrapperResolver instance. - - Args: - resolver (UriResolver): The URI resolver to cache. - options (PackageToWrapperResolverOptions): The options to use. - """ + """Initialize a new PackageToWrapperResolver instance.""" self.resolver = resolver self.options = options + super().__init__() - async def _try_resolve_uri( + def _try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve the given URI to a wrapper or a redirected URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]):\ + client (InvokerClient): The client to use. + resolution_context (IUriResolutionContext):\ The resolution context to use. Returns: UriPackageOrWrapper: The resolved URI or wrapper. """ sub_context = resolution_context.create_sub_context() - result = await self.resolver.try_resolve_uri(uri, client, sub_context) + result = self.resolver.try_resolve_uri(uri, client, sub_context) if isinstance(result, UriPackage): - wrapper = await cast( - UriPackage[UriPackageOrWrapper], result - ).package.create_wrapper() - result = UriWrapper(uri, wrapper) + wrapper = result.package.create_wrapper() + result = UriWrapper(uri=uri, wrapper=wrapper) resolution_context.track_step( UriResolutionStep( @@ -101,3 +95,6 @@ def get_step_description(self) -> str: str: The description of the resolution step. """ return self.__class__.__name__ + + +__all__ = ["PackageToWrapperResolver", "PackageToWrapperResolverOptions"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/redirect_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/redirect_resolver.py index cdb9b652..5b46d97c 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/redirect_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/redirect_resolver.py @@ -1,42 +1,39 @@ """This module contains the RedirectUriResolver class.""" from typing import Dict -from polywrap_core import ( - InvokerClient, - IUriResolutionContext, - Uri, - UriPackageOrWrapper, - UriResolver, -) +from polywrap_core import InvokerClient, Uri, UriResolutionContext, UriResolver class RedirectUriResolver(UriResolver): - """Defines the redirect URI resolver.""" + """Defines the redirect URI resolver. + + Args: + redirects (Dict[Uri, Uri]): The redirects to use. + """ _redirects: Dict[Uri, Uri] def __init__(self, redirects: Dict[Uri, Uri]): - """Initialize a new RedirectUriResolver instance. - - Args: - redirects (Dict[Uri, Uri]): The redirects to use. - """ + """Initialize a new RedirectUriResolver instance.""" self._redirects = redirects - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> Uri: """Try to resolve a URI to redirected URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: Uri: The resolved URI. """ return self._redirects[uri] if uri in self._redirects else uri + + +__all__ = ["RedirectUriResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/__init__.py new file mode 100644 index 00000000..30b09078 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/__init__.py @@ -0,0 +1,3 @@ +"""This package contains interface and implementations for wrapper cache.""" +from .in_memory_wrapper_cache import * +from .wrapper_cache import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/in_memory_wrapper_cache.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/in_memory_wrapper_cache.py similarity index 51% rename from packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/in_memory_wrapper_cache.py rename to packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/in_memory_wrapper_cache.py index aca47d11..cd61684a 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/in_memory_wrapper_cache.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/in_memory_wrapper_cache.py @@ -1,28 +1,29 @@ """This module contains the in-memory wrapper cache.""" from typing import Dict, Union -from polywrap_core import Uri, UriPackageOrWrapper, Wrapper +from polywrap_core import Uri, UriWrapper from .wrapper_cache import WrapperCache class InMemoryWrapperCache(WrapperCache): - """InMemoryWrapperCache is an in-memory implementation of the wrapper cache interface. + """InMemoryWrapperCache is an in-memory implementation\ + of the wrapper cache interface.""" - Attributes: - map (Dict[Uri, Wrapper]): The map of uris to wrappers. - """ - - map: Dict[Uri, Wrapper[UriPackageOrWrapper]] + map: Dict[Uri, UriWrapper] + """The map of uris to wrappers.""" def __init__(self): """Initialize a new InMemoryWrapperCache instance.""" self.map = {} - def get(self, uri: Uri) -> Union[Wrapper[UriPackageOrWrapper], None]: + def get(self, uri: Uri) -> Union[UriWrapper, None]: """Get a wrapper from the cache by its uri.""" return self.map.get(uri) - def set(self, uri: Uri, wrapper: Wrapper[UriPackageOrWrapper]) -> None: + def set(self, uri: Uri, wrapper: UriWrapper) -> None: """Set a wrapper in the cache by its uri.""" self.map[uri] = wrapper + + +__all__ = ["InMemoryWrapperCache"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/wrapper_cache.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/wrapper_cache.py similarity index 54% rename from packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/wrapper_cache.py rename to packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/wrapper_cache.py index 505eb6be..89ab55cf 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/wrapper_cache.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache/wrapper_cache.py @@ -1,20 +1,23 @@ """This module contains the wrapper cache interface.""" -from abc import ABC, abstractmethod -from typing import Union +from abc import abstractmethod +from typing import Protocol, Union -from polywrap_core import Uri, UriPackageOrWrapper, Wrapper +from polywrap_core import Uri, UriWrapper -class WrapperCache(ABC): +class WrapperCache(Protocol): """Defines a cache interface for caching wrappers by uri. This is used by the wrapper resolver to cache wrappers for a given uri. """ @abstractmethod - def get(self, uri: Uri) -> Union[Wrapper[UriPackageOrWrapper], None]: + def get(self, uri: Uri) -> Union[UriWrapper, None]: """Get a wrapper from the cache by its uri.""" @abstractmethod - def set(self, uri: Uri, wrapper: Wrapper[UriPackageOrWrapper]) -> None: + def set(self, uri: Uri, wrapper: UriWrapper) -> None: """Set a wrapper in the cache by its uri.""" + + +__all__ = ["WrapperCache"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/cache_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache_resolver.py similarity index 75% rename from packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/cache_resolver.py rename to packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache_resolver.py index 94e076ab..e6498274 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/cache/cache_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/legacy/wrapper_cache_resolver.py @@ -1,26 +1,26 @@ """This module contains the WrapperCacheResolver.""" from dataclasses import dataclass -from typing import List, Optional, Union, cast +from typing import List, Optional, Union from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, UriResolver, UriWrapper, - Wrapper, ) from polywrap_manifest import DeserializeManifestOptions -from ...types import UriResolutionStep, WrapperCache +from .wrapper_cache import WrapperCache @dataclass(kw_only=True, slots=True) class WrapperCacheResolverOptions: """Defines the options for the WrapperCacheResolver. - Attributes: + Args: deserialize_manifest_options (DeserializeManifestOptions): The options\ to use when deserializing the manifest. end_on_redirect (Optional[bool]): Whether to end the resolution\ @@ -38,10 +38,10 @@ class WrapperCacheResolver(UriResolver): If result is an uri or package, it returns it back without caching.\ If result is a wrapper, it caches the wrapper and returns it back. - Attributes: + Args: resolver_to_cache (UriResolver): The URI resolver to cache. cache (WrapperCache): The cache to use. - options (CacheResolverOptions): The options to use. + options (Optional[WrapperCacheResolverOptions]): The options to use. """ __slots__ = ("resolver_to_cache", "cache", "options") @@ -56,13 +56,7 @@ def __init__( cache: WrapperCache, options: Optional[WrapperCacheResolverOptions] = None, ): - """Initialize a new PackageToWrapperCacheResolver instance. - - Args: - resolver_to_cache (UriResolver): The URI resolver to cache. - cache (WrapperCache): The cache to use. - options (CacheResolverOptions): The options to use. - """ + """Initialize a new PackageToWrapperCacheResolver instance.""" self.resolver_to_cache = resolver_to_cache self.cache = cache self.options = options @@ -75,11 +69,11 @@ def get_options(self) -> Union[WrapperCacheResolverOptions, None]: """ return self.options - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrapper, or a URI. @@ -90,37 +84,35 @@ async def try_resolve_uri( Args: uri (Uri): The URI to resolve. client (InvokerClient): The client to use. - resolution_context (IUriResolutionContext): The resolution\ + resolution_context (UriResolutionContext): The resolution\ context to use. Returns: UriPackageOrWrapper: The result of the resolution. """ - if wrapper := self.cache.get(uri): - result = UriWrapper(uri, wrapper) + if uri_wrapper := self.cache.get(uri): resolution_context.track_step( UriResolutionStep( source_uri=uri, - result=result, + result=uri_wrapper, description="WrapperCacheResolver (Cache Hit)", ) ) - return result + return uri_wrapper sub_context = resolution_context.create_sub_history_context() - result = await self.resolver_to_cache.try_resolve_uri( + result = self.resolver_to_cache.try_resolve_uri( uri, client, sub_context, ) - if isinstance(result, Wrapper): - uri_wrapper = cast(UriWrapper[UriPackageOrWrapper], result) + if isinstance(result, UriWrapper): resolution_path: List[Uri] = sub_context.get_resolution_path() for cache_uri in resolution_path: - self.cache.set(cache_uri, uri_wrapper.wrapper) + self.cache.set(cache_uri, result) resolution_context.track_step( UriResolutionStep( @@ -131,3 +123,6 @@ async def try_resolve_uri( ) ) return result + + +__all__ = ["WrapperCacheResolver", "WrapperCacheResolverOptions"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/__init__.py index d7c941e1..9538aca7 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/__init__.py @@ -1,3 +1,2 @@ """This package contains the resolvers for packages.""" from .package_resolver import * -from .package_to_wrapper_resolver import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_resolver.py index 2af39593..abb82b4f 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/package/package_resolver.py @@ -1,10 +1,10 @@ """This module contains the PackageResolver class.""" from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackage, UriPackageOrWrapper, + UriResolutionContext, WrapPackage, ) @@ -12,22 +12,23 @@ class PackageResolver(ResolverWithHistory): - """Defines a resolver that resolves a uri to a package.""" + """Defines a resolver that resolves a uri to a package. - __slots__ = ("uri", "wrap_package") + Args: + uri (Uri): The uri to resolve. + package (WrapPackage): The wrap package to return. + """ - uri: Uri - wrap_package: WrapPackage[UriPackageOrWrapper] + __slots__ = ("uri", "package") - def __init__(self, uri: Uri, wrap_package: WrapPackage[UriPackageOrWrapper]): - """Initialize a new PackageResolver instance. + uri: Uri + package: WrapPackage - Args: - uri (Uri): The uri to resolve. - wrap_package (WrapPackage[UriPackageOrWrapper]): The wrap package to return. - """ + def __init__(self, uri: Uri, package: WrapPackage): + """Initialize a new PackageResolver instance.""" self.uri = uri - self.wrap_package = wrap_package + self.package = package + super().__init__() def get_step_description(self) -> str: """Get the description of the resolver step. @@ -37,11 +38,11 @@ def get_step_description(self) -> str: """ return f"Package ({self.uri.uri})" - async def _try_resolve_uri( + def _try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. @@ -51,12 +52,15 @@ async def _try_resolve_uri( Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ + client (InvokerClient): The client to use for\ resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ + resolution_context (UriResolutionContext): The\ resolution context. Returns: UriPackageOrWrapper: The resolved URI package, wrapper, or URI. """ - return uri if uri != self.uri else UriPackage(uri, self.wrap_package) + return uri if uri != self.uri else UriPackage(uri=uri, package=self.package) + + +__all__ = ["PackageResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/recursive/recursive_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/recursive/recursive_resolver.py index e00fe37d..6b4f05bb 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/recursive/recursive_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/recursive/recursive_resolver.py @@ -1,9 +1,9 @@ """This module contains the recursive resolver.""" from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackageOrWrapper, + UriResolutionContext, UriResolver, ) @@ -25,25 +25,21 @@ class RecursiveResolver(UriResolver): resolver: UriResolver def __init__(self, resolver: UriResolver): - """Initialize a new RecursiveResolver instance. - - Args: - resolver (UriResolver): The resolver to use. - """ + """Initialize a new RecursiveResolver instance.""" self.resolver = resolver - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI. @@ -53,15 +49,20 @@ async def try_resolve_uri( resolution_context.start_resolving(uri) - uri_package_or_wrapper = await self.resolver.try_resolve_uri( + uri_package_or_wrapper = self.resolver.try_resolve_uri( uri, client, resolution_context ) - if uri_package_or_wrapper != uri: - uri_package_or_wrapper = await self.try_resolve_uri( - uri_package_or_wrapper, client, resolution_context + if isinstance(uri_package_or_wrapper, Uri) and uri_package_or_wrapper != uri: + uri_package_or_wrapper = self.try_resolve_uri( + uri_package_or_wrapper, + client, + resolution_context, ) resolution_context.stop_resolving(uri) return uri_package_or_wrapper + + +__all__ = ["RecursiveResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/redirect/redirect_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/redirect/redirect_resolver.py index 34f3b05b..5bf2ae7d 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/redirect/redirect_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/redirect/redirect_resolver.py @@ -1,5 +1,5 @@ """This module contains the RedirectResolver class.""" -from polywrap_core import InvokerClient, IUriResolutionContext, Uri, UriPackageOrWrapper +from polywrap_core import InvokerClient, Uri, UriPackageOrWrapper, UriResolutionContext from ..abc import ResolverWithHistory @@ -11,7 +11,7 @@ class RedirectResolver(ResolverWithHistory): uri to redirect from, the uri to redirect to is returned. Otherwise, the uri to resolve\ is returned. - Attributes: + Args: from_uri (Uri): The uri to redirect from. to_uri (Uri): The uri to redirect to. """ @@ -22,14 +22,10 @@ class RedirectResolver(ResolverWithHistory): to_uri: Uri def __init__(self, from_uri: Uri, to_uri: Uri) -> None: - """Initialize a new RedirectResolver instance. - - Args: - from_uri (Uri): The uri to redirect from. - to_uri (Uri): The uri to redirect to. - """ + """Initialize a new RedirectResolver instance.""" self.from_uri = from_uri self.to_uri = to_uri + super().__init__() def get_step_description(self) -> str: """Get the description of the resolver step. @@ -39,11 +35,11 @@ def get_step_description(self) -> str: """ return f"Redirect ({self.from_uri} - {self.to_uri})" - async def _try_resolve_uri( + def _try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. @@ -53,12 +49,13 @@ async def _try_resolve_uri( Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for\ - resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The\ - resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI package, wrapper, or URI. """ return uri if uri != self.from_uri else self.to_uri + + +__all__ = ["RedirectResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/static/static_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/static/static_resolver.py index 5a5757d4..4a2e9e09 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/static/static_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/static/static_resolver.py @@ -1,15 +1,13 @@ """This module contains the StaticResolver class.""" from polywrap_core import ( InvokerClient, - IUriResolutionContext, - IUriResolutionStep, Uri, UriPackage, UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, UriResolver, UriWrapper, - WrapPackage, - Wrapper, ) from ...types import StaticResolverLike @@ -18,7 +16,7 @@ class StaticResolver(UriResolver): """Defines the static URI resolver. - Attributes: + Args: uri_map (StaticResolverLike): The URI map to use. """ @@ -27,46 +25,46 @@ class StaticResolver(UriResolver): uri_map: StaticResolverLike def __init__(self, uri_map: StaticResolverLike): - """Initialize a new StaticResolver instance. - - Args: - uri_map (StaticResolverLike): The URI map to use. - """ + """Initialize a new StaticResolver instance.""" self.uri_map = uri_map - async def try_resolve_uri( + def try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI. """ result = self.uri_map.get(uri) - uri_package_or_wrapper: UriPackageOrWrapper = uri - description: str = "StaticResolver - Miss" - if result: - if isinstance(result, WrapPackage): - description = f"Static - Package ({uri})" - uri_package_or_wrapper = UriPackage(uri, result) - elif isinstance(result, Wrapper): - description = f"Static - Wrapper ({uri})" - uri_package_or_wrapper = UriWrapper(uri, result) - else: - description = f"Static - Redirect ({uri}, {result})" + match result: + case None: + description: str = "Static - Miss" + uri_package_or_wrapper: UriPackageOrWrapper = uri + case UriPackage(): + description = "Static - Package" + uri_package_or_wrapper = result + case UriWrapper(): + description = "Static - Wrapper" + uri_package_or_wrapper = result + case _: + description = f"Static - Redirect ({uri} - {result})" uri_package_or_wrapper = result - step = IUriResolutionStep( + step = UriResolutionStep( source_uri=uri, result=uri_package_or_wrapper, description=description ) resolution_context.track_step(step) return uri_package_or_wrapper + + +__all__ = ["StaticResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/wrapper/wrapper_resolver.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/wrapper/wrapper_resolver.py index c549d076..fdd97983 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/wrapper/wrapper_resolver.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/resolvers/wrapper/wrapper_resolver.py @@ -1,9 +1,9 @@ """This module contains the resolver for wrappers.""" from polywrap_core import ( InvokerClient, - IUriResolutionContext, Uri, UriPackageOrWrapper, + UriResolutionContext, UriWrapper, Wrapper, ) @@ -14,25 +14,21 @@ class WrapperResolver(ResolverWithHistory): """Defines the wrapper resolver. - Attributes: + Args: uri (Uri): The uri to resolve. - wrapper (Wrapper[UriPackageOrWrapper]): The wrapper to use. + wrapper (Wrapper): The wrapper to use. """ __slots__ = ("uri", "wrapper") uri: Uri - wrapper: Wrapper[UriPackageOrWrapper] + wrapper: Wrapper - def __init__(self, uri: Uri, wrapper: Wrapper[UriPackageOrWrapper]): - """Initialize a new WrapperResolver instance. - - Args: - uri (Uri): The uri to resolve. - wrapper (Wrapper[UriPackageOrWrapper]): The wrapper to use. - """ + def __init__(self, uri: Uri, wrapper: Wrapper): + """Initialize a new WrapperResolver instance.""" self.uri = uri self.wrapper = wrapper + super().__init__() def get_step_description(self) -> str: """Get the description of the resolver step. @@ -42,20 +38,23 @@ def get_step_description(self) -> str: """ return f"Wrapper ({self.uri})" - async def _try_resolve_uri( + def _try_resolve_uri( self, uri: Uri, - client: InvokerClient[UriPackageOrWrapper], - resolution_context: IUriResolutionContext[UriPackageOrWrapper], + client: InvokerClient, + resolution_context: UriResolutionContext, ) -> UriPackageOrWrapper: """Try to resolve a URI to a wrap package, a wrapper, or a URI. Args: uri (Uri): The URI to resolve. - client (InvokerClient[UriPackageOrWrapper]): The client to use for resolving the URI. - resolution_context (IUriResolutionContext[UriPackageOrWrapper]): The resolution context. + client (InvokerClient): The client to use for resolving the URI. + resolution_context (UriResolutionContext): The resolution context. Returns: UriPackageOrWrapper: The resolved URI, wrap package, or wrapper. """ - return uri if uri != self.uri else UriWrapper(uri, self.wrapper) + return uri if uri != self.uri else UriWrapper(uri=uri, wrapper=self.wrapper) + + +__all__ = ["WrapperResolver"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/__init__.py index abfded87..eab11c6a 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/__init__.py @@ -1,6 +1,3 @@ """This package contains the types used by the polywrap-uri-resolvers package.""" from .cache import * from .static_resolver_like import * -from .uri_redirect import * -from .uri_resolution_context import * -from .uri_resolver_like import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/__init__.py index 30b09078..3824e09e 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/__init__.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/__init__.py @@ -1,3 +1,2 @@ -"""This package contains interface and implementations for wrapper cache.""" -from .in_memory_wrapper_cache import * -from .wrapper_cache import * +"""This package contains implementations for the cache.""" +from .resolution_result_cache import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/__init__.py new file mode 100644 index 00000000..58b79226 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/__init__.py @@ -0,0 +1,3 @@ +"""This package contains interface and implementations for wrapper cache.""" +from .in_memory_resolution_result_cache import * +from .resolution_result_cache import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/in_memory_resolution_result_cache.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/in_memory_resolution_result_cache.py new file mode 100644 index 00000000..780b15f8 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/in_memory_resolution_result_cache.py @@ -0,0 +1,36 @@ +"""This module contains the in-memory wrapper cache.""" +from typing import Dict, Union + +from polywrap_core import Uri, UriPackageOrWrapper + +from ....errors import UriResolutionError +from .resolution_result_cache import ResolutionResultCache + + +class InMemoryResolutionResultCache(ResolutionResultCache): + """InMemoryResolutionResultCache is an in-memory implementation \ + of the resolution result cache protocol.""" + + map: Dict[Uri, Union[UriPackageOrWrapper, UriResolutionError]] + """The map of uris to resolution result.""" + + def __init__(self): + """Initialize a new InMemoryResolutionResultCache instance.""" + self.map = {} + + def get(self, uri: Uri) -> Union[UriPackageOrWrapper, UriResolutionError, None]: + """Get the resolution result from the cache by its uri.""" + return self.map.get(uri) + + def set( + self, uri: Uri, result: Union[UriPackageOrWrapper, UriResolutionError] + ) -> None: + """Set the resolution result in the cache by its uri.""" + self.map[uri] = result + + def __str__(self) -> str: + """Display cache as a string.""" + return f"{self.map}" + + +__all__ = ["InMemoryResolutionResultCache"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/resolution_result_cache.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/resolution_result_cache.py new file mode 100644 index 00000000..15534198 --- /dev/null +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/cache/resolution_result_cache/resolution_result_cache.py @@ -0,0 +1,32 @@ +"""This module contains the wrapper cache interface.""" +# pylint: disable=unnecessary-ellipsis +from typing import Protocol, Union + +from polywrap_core import Uri, UriPackageOrWrapper + +from ....errors import UriResolutionError + + +class ResolutionResultCache(Protocol): + """Defines a cache protocol for caching resolution results by uri. + + This is used by the resolution result resolver to cache resolution results\ + for a given uri. + """ + + def get(self, uri: Uri) -> Union[UriPackageOrWrapper, UriResolutionError, None]: + """Get the resolution result from the cache by its uri.""" + ... + + def set( + self, uri: Uri, result: Union[UriPackageOrWrapper, UriResolutionError] + ) -> None: + """Set the resolution result in the cache by its uri.""" + ... + + def __str__(self) -> str: + """Display cache as a string.""" + ... + + +__all__ = ["ResolutionResultCache"] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/static_resolver_like.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/static_resolver_like.py index 0bad456f..933b62ec 100644 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/static_resolver_like.py +++ b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/static_resolver_like.py @@ -2,19 +2,9 @@ StaticResolverLike is a type that represents a union of types\ that can be used as a StaticResolver. - ->>> StaticResolverLike = Union[ -... Dict[Uri, Uri], -... Dict[Uri, WrapPackage], -... Dict[Uri, Wrapper], -... ] """ -from typing import Dict, Union +from typing import Dict -from polywrap_core import Uri, UriPackageOrWrapper, WrapPackage, Wrapper +from polywrap_core import Uri, UriPackageOrWrapper -StaticResolverLike = Union[ - Dict[Uri, Uri], - Dict[Uri, WrapPackage[UriPackageOrWrapper]], - Dict[Uri, Wrapper[UriPackageOrWrapper]], -] +StaticResolverLike = Dict[Uri, UriPackageOrWrapper] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_redirect.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_redirect.py deleted file mode 100644 index 27268492..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_redirect.py +++ /dev/null @@ -1,17 +0,0 @@ -"""This module contains the UriRedirect type.""" -from dataclasses import dataclass - -from polywrap_core import Uri - - -@dataclass(slots=True, kw_only=True) -class UriRedirect: - """UriRedirect is a type that represents a redirect from one uri to another. - - Attributes: - from_uri (Uri): The uri to redirect from. - to_uri (Uri): The uri to redirect to. - """ - - from_uri: Uri - to_uri: Uri diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/__init__.py deleted file mode 100644 index 5923e009..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -"""This module contains the utility classes and functions for URI Resolution.""" -from .uri_resolution_context import * -from .uri_resolution_step import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_context.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_context.py deleted file mode 100644 index 700a9c1a..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_context.py +++ /dev/null @@ -1,121 +0,0 @@ -"""This module contains implementation of IUriResolutionContext interface.""" -from typing import List, Optional, Set - -from polywrap_core import ( - IUriResolutionContext, - IUriResolutionStep, - Uri, - UriPackageOrWrapper, -) - - -class UriResolutionContext(IUriResolutionContext[UriPackageOrWrapper]): - """Represents the context of a uri resolution. - - Attributes: - resolving_uri_set: A set of uris that are currently being resolved. - resolution_path: A list of uris in the order that they are being resolved. - history: A list of steps that have been taken to resolve the uri. - """ - - resolving_uri_set: Set[Uri] - resolution_path: List[Uri] - history: List[IUriResolutionStep[UriPackageOrWrapper]] - - __slots__ = ("resolving_uri_map", "resolution_path", "history") - - def __init__( - self, - resolving_uri_set: Optional[Set[Uri]] = None, - resolution_path: Optional[List[Uri]] = None, - history: Optional[List[IUriResolutionStep[UriPackageOrWrapper]]] = None, - ): - """Initialize a new instance of UriResolutionContext. - - Args: - resolving_uri_set: A set of uris that are currently being resolved. - resolution_path: A list of uris in the order that they are being resolved. - history: A list of steps that have been taken to resolve the uri. - """ - self.resolving_uri_set = resolving_uri_set or set() - self.resolution_path = resolution_path or [] - self.history = history or [] - - def is_resolving(self, uri: Uri) -> bool: - """Check if the given uri is currently being resolved. - - Args: - uri: The uri to check. - - Returns: - bool: True if the uri is currently being resolved, otherwise False. - """ - return uri in self.resolving_uri_set - - def start_resolving(self, uri: Uri) -> None: - """Start resolving the given uri. - - Args: - uri: The uri to start resolving. - - Returns: None - """ - self.resolving_uri_set.add(uri) - self.resolution_path.append(uri) - - def stop_resolving(self, uri: Uri) -> None: - """Stop resolving the given uri. - - Args: - uri: The uri to stop resolving. - - Returns: None - """ - self.resolving_uri_set.remove(uri) - - def track_step(self, step: IUriResolutionStep[UriPackageOrWrapper]) -> None: - """Track the given step in the resolution history. - - Args: - step: The step to track. - - Returns: None - """ - self.history.append(step) - - def get_history(self) -> List[IUriResolutionStep[UriPackageOrWrapper]]: - """Get the resolution history. - - Returns: - List[IUriResolutionStep]: The resolution history. - """ - return self.history - - def get_resolution_path(self) -> List[Uri]: - """Get the resolution path. - - Returns: - List[Uri]: The ordered list of URI resolution path. - """ - return self.resolution_path - - def create_sub_history_context(self) -> IUriResolutionContext[UriPackageOrWrapper]: - """Create a new sub context that shares the same resolution path. - - Returns: - IUriResolutionContext: The new context. - """ - return UriResolutionContext( - resolving_uri_set=self.resolving_uri_set, - resolution_path=self.resolution_path, - ) - - def create_sub_context(self) -> IUriResolutionContext[UriPackageOrWrapper]: - """Create a new sub context that shares the same resolution history. - - Returns: - IUriResolutionContext: The new context. - """ - return UriResolutionContext( - resolving_uri_set=self.resolving_uri_set, history=self.history - ) diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_step.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_step.py deleted file mode 100644 index effeec4a..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolution_context/uri_resolution_step.py +++ /dev/null @@ -1,18 +0,0 @@ -"""This module contains implementation of IUriResolutionStep interface.""" -from __future__ import annotations - -from dataclasses import dataclass - -from polywrap_core import IUriResolutionStep, UriPackageOrWrapper - - -@dataclass(slots=True, kw_only=True) -class UriResolutionStep(IUriResolutionStep[UriPackageOrWrapper]): - """Represents a single step in the resolution of a uri. - - Attributes: - source_uri: The uri that was resolved. - result: The result of the resolution. - description: A description of the resolution step. - sub_history: A list of sub steps that were taken to resolve the uri. - """ diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolver_like.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolver_like.py deleted file mode 100644 index 2a64d1ba..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/types/uri_resolver_like.py +++ /dev/null @@ -1,29 +0,0 @@ -"""This module contains the type definition for UriResolverLike. - -UriResolverLike is a type that represents a union of types\ - that can be used as a UriResolver. - ->>> UriResolverLike = Union[ -... StaticResolverLike, -... UriPackageOrWrapper, -... UriRedirect, -... UriResolver, -... List[UriResolverLike], -... ] -""" -from __future__ import annotations - -from typing import List, Union - -from polywrap_core import UriPackageOrWrapper, UriResolver - -from .static_resolver_like import StaticResolverLike -from .uri_redirect import UriRedirect - -UriResolverLike = Union[ - StaticResolverLike, - UriPackageOrWrapper, - UriRedirect, - UriResolver, - List["UriResolverLike"], -] diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/__init__.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/__init__.py deleted file mode 100644 index 6f71584a..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -"""This package contains the utilities used by the polywrap-uri-resolvers package.""" -from .build_clean_uri_history import * -from .get_env_from_uri_history import * -from .get_uri_resolution_path import * diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/build_clean_uri_history.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/build_clean_uri_history.py deleted file mode 100644 index 9eddd139..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/build_clean_uri_history.py +++ /dev/null @@ -1,73 +0,0 @@ -"""This module contains an utility function for building a clean history of URI resolution steps.""" -from typing import List, Optional, TypeVar, Union - -from polywrap_core import IUriResolutionStep, Uri, UriLike, UriPackage - -CleanResolutionStep = List[Union[str, "CleanResolutionStep"]] - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -def build_clean_uri_history( - history: List[IUriResolutionStep[TUriLike]], depth: Optional[int] = None -) -> CleanResolutionStep: - """Build a clean history of the URI resolution steps. - - Args: - history: A list of URI resolution steps. - depth: The depth of the history to build. - - Returns: - CleanResolutionStep: A clean history of the URI resolution steps. - """ - clean_history: CleanResolutionStep = [] - - if depth is not None: - depth -= 1 - - if not history: - return clean_history - - for step in history: - clean_history.append(_build_clean_history_step(step)) - - if ( - not step.sub_history - or len(step.sub_history) == 0 - or (depth is not None and depth < 0) - ): - continue - - sub_history = build_clean_uri_history(step.sub_history, depth) - if len(sub_history) > 0: - clean_history.append(sub_history) - - return clean_history - - -def _build_clean_history_step(step: IUriResolutionStep[TUriLike]) -> str: - uri_package_or_wrapper = step.result - - if isinstance(uri_package_or_wrapper, Uri): - if step.source_uri == uri_package_or_wrapper: - return ( - f"{step.source_uri} => {step.description}" - if step.description - else f"{step.source_uri}" - ) - return ( - f"{step.source_uri} => {step.description} => uri ({uri_package_or_wrapper.uri})" - if step.description - else f"{step.source_uri} => uri ({uri_package_or_wrapper})" - ) - if isinstance(uri_package_or_wrapper, UriPackage): - return ( - f"{step.source_uri} => {step.description} => package ({uri_package_or_wrapper})" - if step.description - else f"{step.source_uri} => package ({uri_package_or_wrapper})" - ) - return ( - f"{step.source_uri} => {step.description} => wrapper ({uri_package_or_wrapper})" - if step.description - else f"{step.source_uri} => wrapper ({uri_package_or_wrapper})" - ) diff --git a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_uri_resolution_path.py b/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_uri_resolution_path.py deleted file mode 100644 index 6e650e6a..00000000 --- a/packages/polywrap-uri-resolvers/polywrap_uri_resolvers/utils/get_uri_resolution_path.py +++ /dev/null @@ -1,35 +0,0 @@ -"""This module contains the get_uri_resolution_path function.""" -from typing import List, TypeVar - -from polywrap_core import IUriResolutionStep, UriLike - -TUriLike = TypeVar("TUriLike", bound=UriLike) - - -def get_uri_resolution_path( - history: List[IUriResolutionStep[TUriLike]], -) -> List[IUriResolutionStep[TUriLike]]: - """Get the URI resolution path from the URI resolution history. - - Args: - history (List[IUriResolutionStep[TUriLike]]): URI resolution history - - Returns: - List[IUriResolutionStep[TUriLike]]: URI resolution path - """ - # Get all non-empty items from the resolution history - - def add_uri_resolution_path_for_sub_history( - step: IUriResolutionStep[TUriLike], - ) -> IUriResolutionStep[TUriLike]: - if step.sub_history and len(step.sub_history): - step.sub_history = get_uri_resolution_path(step.sub_history) - return step - - return [ - add_uri_resolution_path_for_sub_history(step) - for step in filter( - lambda step: step.source_uri != step.result, - history, - ) - ] diff --git a/packages/polywrap-uri-resolvers/pyproject.toml b/packages/polywrap-uri-resolvers/pyproject.toml index d382fce0..152a9232 100644 --- a/packages/polywrap-uri-resolvers/pyproject.toml +++ b/packages/polywrap-uri-resolvers/pyproject.toml @@ -11,9 +11,14 @@ readme = "README.md" [tool.poetry.dependencies] python = "^3.10" -polywrap-wasm = "^0.1.0a29" -polywrap-core = "^0.1.0a29" -[tool.poetry.dev-dependencies] +polywrap-wasm = {path = "../polywrap-wasm", develop = true} +polywrap-core = {path = "../polywrap-core", develop = true} + +[tool.poetry.group.dev.dependencies] +pycln = "^2.1.3" +polywrap-client = {path = "../polywrap-client", develop = true} +polywrap-plugin = {path = "../polywrap-plugin", develop = true} +polywrap-test-cases = {path = "../polywrap-test-cases", develop = true} pytest = "^7.1.2" pytest-asyncio = "^0.19.0" pylint = "^2.15.4" @@ -24,9 +29,7 @@ tox-poetry = "^0.4.1" isort = "^5.10.1" pyright = "^1.1.275" pydocstyle = "^6.1.1" - -[tool.poetry.group.dev.dependencies] -pycln = "^2.1.3" +pytest-html = "^3.2.0" [tool.bandit] exclude_dirs = ["tests"] diff --git a/packages/polywrap-uri-resolvers/tests/__init__.py b/packages/polywrap-uri-resolvers/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.info b/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.info deleted file mode 100644 index e0ca0d11..00000000 --- a/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.info +++ /dev/null @@ -1 +0,0 @@ -��version�0.1�name�Simple�type�wasm�abi��version�0.1�moduleType��type�Module�kind̀�methods���name�simpleMethod�return��type�String�name�simpleMethod�requiredäkind"�scalar��name�simpleMethod�type�String�requiredäkind�type�Method�kind@�requiredéarguments���type�String�name�arg�requiredäkind"�scalar��name�arg�type�String�requiredäkind \ No newline at end of file diff --git a/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.wasm b/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.wasm deleted file mode 100644 index fa6ac41c..00000000 Binary files a/packages/polywrap-uri-resolvers/tests/cases/simple/wrap.wasm and /dev/null differ diff --git a/packages/polywrap-uri-resolvers/tests/integration/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/conftest.py new file mode 100644 index 00000000..37f75ff8 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/conftest.py @@ -0,0 +1,18 @@ +import pytest +from polywrap_core import Uri, UriResolutionContext, ClientConfig +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import UriResolverAggregator, RedirectResolver + +@pytest.fixture +def client() -> PolywrapClient: + resolver = UriResolverAggregator([ + RedirectResolver(Uri.from_str("test/1"), Uri.from_str("test/2")), + RedirectResolver(Uri.from_str("test/2"), Uri.from_str("test/3")), + RedirectResolver(Uri.from_str("test/3"), Uri.from_str("test/4")), + ], "TestAggregator") + return PolywrapClient(ClientConfig(resolver=resolver)) + +@pytest.fixture +def resolution_context() -> UriResolutionContext: + return UriResolutionContext() + diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_first.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_first.py new file mode 100644 index 00000000..71edc200 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_first.py @@ -0,0 +1,6 @@ +EXPECTED = [ + "wrap://test/1 => TestAggregator => uri (wrap://test/2)", + [ + "wrap://test/1 => Redirect (wrap://test/1 - wrap://test/2) => uri (wrap://test/2)", + ] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_last.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_last.py new file mode 100644 index 00000000..0ecc3af6 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/can_resolve_last.py @@ -0,0 +1,8 @@ +EXPECTED = [ + "wrap://test/3 => TestAggregator => uri (wrap://test/4)", + [ + "wrap://test/3 => Redirect (wrap://test/1 - wrap://test/2)", + "wrap://test/3 => Redirect (wrap://test/2 - wrap://test/3)", + "wrap://test/3 => Redirect (wrap://test/3 - wrap://test/4) => uri (wrap://test/4)", + ] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/not_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/not_resolve.py new file mode 100644 index 00000000..aa408c4e --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/histories/not_resolve.py @@ -0,0 +1,8 @@ +EXPECTED = [ + "wrap://test/no-match => TestAggregator", + [ + "wrap://test/no-match => Redirect (wrap://test/1 - wrap://test/2)", + "wrap://test/no-match => Redirect (wrap://test/2 - wrap://test/3)", + "wrap://test/no-match => Redirect (wrap://test/3 - wrap://test/4)", + ] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_can_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_can_resolve.py new file mode 100644 index 00000000..9cfd6ee3 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_can_resolve.py @@ -0,0 +1,28 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_can_resolve_first(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/1") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.can_resolve_first import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/2" + + +def test_can_resolve_last(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/3") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + print(build_clean_uri_history(resolution_context.get_history())) + + from .histories.can_resolve_last import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/4" diff --git a/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_not_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_not_resolve.py new file mode 100644 index 00000000..4e9ff210 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/aggregator_resolver/test_not_resolve.py @@ -0,0 +1,15 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_no_match(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/no-match") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.not_resolve import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/no-match" + diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package.py new file mode 100644 index 00000000..51b2d6bf --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package.py @@ -0,0 +1,20 @@ +EXPECTED = [ + "wrap://test/package => UriResolverAggregator => package (wrap://test/package)", + [ + "wrap://test/package => Static - Miss", + "wrap://test/package => ExtendableUriResolver => package (wrap://test/package)", + [ + "wrap://test/package => ResolverExtension (wrap://package/test-resolver) => package (wrap://test/package)", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Static - Package => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package_with_subinvoke.py new file mode 100644 index 00000000..0ff4c663 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_package_with_subinvoke.py @@ -0,0 +1,30 @@ +EXPECTED = [ + "wrap://test/package => UriResolverAggregator => package (wrap://test/package)", + [ + "wrap://test/package => Static - Miss", + "wrap://test/package => ExtendableUriResolver => package (wrap://test/package)", + [ + "wrap://test/package => ResolverExtension (wrap://package/test-subinvoke-resolver) => package (wrap://test/package)", + [ + "wrap://package/test-subinvoke-resolver => Client.load_wrapper => wrapper (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => UriResolverAggregator => package (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Static - Package => package (wrap://package/test-subinvoke-resolver)" + ], + ], + "wrap://package/test-subinvoke-resolver => Wrapper.invoke", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Static - Package => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri.py new file mode 100644 index 00000000..ab794c14 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri.py @@ -0,0 +1,38 @@ +EXPECTED = [ + "wrap://test/from => UriResolverAggregator => uri (wrap://test/to)", + [ + "wrap://test/from => Package (wrap://package/test-resolver)", + "wrap://test/from => ExtendableUriResolver => uri (wrap://test/to)", + [ + "wrap://test/from => ResolverExtension (wrap://package/test-resolver) => uri (wrap://test/to)", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], + "wrap://test/to => UriResolverAggregator", + [ + "wrap://test/to => Package (wrap://package/test-resolver)", + "wrap://test/to => ExtendableUriResolver", + [ + "wrap://test/to => ResolverExtension (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri_with_subinvoke.py new file mode 100644 index 00000000..20900ae1 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_resolve_uri_with_subinvoke.py @@ -0,0 +1,62 @@ +EXPECTED = [ + "wrap://test/from => UriResolverAggregator => uri (wrap://test/to)", + [ + "wrap://test/from => Package (wrap://package/test-subinvoke-resolver)", + "wrap://test/from => Package (wrap://package/test-resolver)", + "wrap://test/from => ExtendableUriResolver => uri (wrap://test/to)", + [ + "wrap://test/from => ResolverExtension (wrap://package/test-subinvoke-resolver) => uri (wrap://test/to)", + [ + "wrap://package/test-subinvoke-resolver => Client.load_wrapper => wrapper (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => UriResolverAggregator => package (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Package (wrap://package/test-subinvoke-resolver) => package (wrap://package/test-subinvoke-resolver)" + ], + ], + "wrap://package/test-subinvoke-resolver => Wrapper.invoke", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Package (wrap://package/test-subinvoke-resolver)", + "wrap://package/test-resolver => Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)", + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], + ], + "wrap://test/to => UriResolverAggregator", + [ + "wrap://test/to => Package (wrap://package/test-subinvoke-resolver)", + "wrap://test/to => Package (wrap://package/test-resolver)", + "wrap://test/to => ExtendableUriResolver", + [ + "wrap://test/to => ResolverExtension (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Client.load_wrapper => wrapper (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => UriResolverAggregator => package (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Package (wrap://package/test-subinvoke-resolver) => package (wrap://package/test-subinvoke-resolver)" + ], + ], + "wrap://package/test-subinvoke-resolver => Wrapper.invoke", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Package (wrap://package/test-subinvoke-resolver)", + "wrap://package/test-resolver => Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)", + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_use_wasm_fs_resolver.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_use_wasm_fs_resolver.py new file mode 100644 index 00000000..4cadedbf --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/can_use_wasm_fs_resolver.py @@ -0,0 +1,30 @@ +import os +from polywrap_core import Uri +from polywrap_test_cases import get_path_to_test_wrappers + + +source_uri = Uri( + "fs", + os.path.join(get_path_to_test_wrappers(), "asyncify", "implementations", "as"), +) + +EXPECTED = [ + f"{source_uri} => UriResolverAggregator", + [ + f"{source_uri} => Package (wrap://package/test-fs-resolver)", + f"{source_uri} => ExtendableUriResolver", + [ + f"{source_uri} => ResolverExtension (wrap://package/test-fs-resolver)", + [ + "wrap://package/test-fs-resolver => Client.load_wrapper => wrapper (wrap://package/test-fs-resolver)", + [ + "wrap://package/test-fs-resolver => UriResolverAggregator => package (wrap://package/test-fs-resolver)", + [ + "wrap://package/test-fs-resolver => Package (wrap://package/test-fs-resolver) => package (wrap://package/test-fs-resolver)" + ], + ], + "wrap://package/test-fs-resolver => Wrapper.invoke", + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match.py new file mode 100644 index 00000000..57e6465c --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match.py @@ -0,0 +1,20 @@ +EXPECTED = [ + "wrap://test/not-a-match => UriResolverAggregator", + [ + "wrap://test/not-a-match => Static - Miss", + "wrap://test/not-a-match => ExtendableUriResolver", + [ + "wrap://test/not-a-match => ResolverExtension (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Static - Package => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match_with_subinvoke.py new file mode 100644 index 00000000..81d2bd56 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_a_match_with_subinvoke.py @@ -0,0 +1,30 @@ +EXPECTED = [ + "wrap://test/not-a-match => UriResolverAggregator", + [ + "wrap://test/not-a-match => Static - Miss", + "wrap://test/not-a-match => ExtendableUriResolver", + [ + "wrap://test/not-a-match => ResolverExtension (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Client.load_wrapper => wrapper (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => UriResolverAggregator => package (wrap://package/test-subinvoke-resolver)", + [ + "wrap://package/test-subinvoke-resolver => Static - Package => package (wrap://package/test-subinvoke-resolver)" + ], + ], + "wrap://package/test-subinvoke-resolver => Wrapper.invoke", + [ + "wrap://package/test-resolver => Client.load_wrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => Static - Package => package (wrap://package/test-resolver)" + ], + ], + "wrap://package/test-resolver => Wrapper.invoke", + ], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_found_extension.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_found_extension.py new file mode 100644 index 00000000..22dcd12b --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/not_found_extension.py @@ -0,0 +1,13 @@ +EXPECTED = [ + 'wrap://test/not-a-match => UriResolverAggregator => error (Unable to find URI wrap://test/undefined-resolver.\ncode: 28 URI NOT FOUND\nuri: wrap://test/undefined-resolver\nuriResolutionStack: [\n "wrap://test/undefined-resolver => UriResolverAggregator"\n])', + [ + 'wrap://test/not-a-match => ExtendableUriResolver => error (Unable to find URI wrap://test/undefined-resolver.\ncode: 28 URI NOT FOUND\nuri: wrap://test/undefined-resolver\nuriResolutionStack: [\n "wrap://test/undefined-resolver => UriResolverAggregator"\n])', + [ + 'wrap://test/not-a-match => ResolverExtension (wrap://test/undefined-resolver) => error (Unable to find URI wrap://test/undefined-resolver.\ncode: 28 URI NOT FOUND\nuri: wrap://test/undefined-resolver\nuriResolutionStack: [\n "wrap://test/undefined-resolver => UriResolverAggregator"\n])', + [ + 'wrap://test/undefined-resolver => Client.loadWrapper => error (Unable to find URI wrap://test/undefined-resolver.\ncode: 28 URI NOT FOUND\nuri: wrap://test/undefined-resolver\nuriResolutionStack: [\n "wrap://test/undefined-resolver => UriResolverAggregator"\n])', + ["wrap://test/undefined-resolver => UriResolverAggregator"], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error.py new file mode 100644 index 00000000..6dd11d75 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error.py @@ -0,0 +1,20 @@ +EXPECTED = [ + 'wrap://test/error => UriResolverAggregator => error (Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} )', + [ + "wrap://test/error => StaticResolver - Miss", + 'wrap://test/error => ExtendableUriResolver => error (Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} )', + [ + 'wrap://test/error => ResolverExtension (wrap://package/test-resolver) => error (Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} )', + [ + "wrap://package/test-resolver => Client.loadWrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => StaticResolver - Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + 'wrap://package/test-resolver => Client.invokeWrapper => error (Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} )', + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error_with_subinvoke.py new file mode 100644 index 00000000..f6451065 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_plugin_extension_error_with_subinvoke.py @@ -0,0 +1,30 @@ +EXPECTED = [ + 'wrap://test/error => UriResolverAggregator => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 35, col: 21 }\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 177, col: 15 })', + [ + "wrap://test/error => StaticResolver - Miss", + 'wrap://test/error => ExtendableUriResolver => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 35, col: 21 }\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 177, col: 15 })', + [ + 'wrap://test/error => ResolverExtension (wrap://package/subinvoke-resolver) => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 35, col: 21 }\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 177, col: 15 })', + [ + "wrap://package/subinvoke-resolver => Client.loadWrapper => wrapper (wrap://package/subinvoke-resolver)", + [ + "wrap://package/subinvoke-resolver => UriResolverAggregator => package (wrap://package/subinvoke-resolver)", + [ + "wrap://package/subinvoke-resolver => StaticResolver - Package (wrap://package/subinvoke-resolver) => package (wrap://package/subinvoke-resolver)" + ], + ], + 'wrap://package/subinvoke-resolver => Client.invokeWrapper => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 35, col: 21 }\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 177, col: 15 })', + [ + "wrap://package/test-resolver => Client.loadWrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => StaticResolver - Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + 'wrap://package/test-resolver => Client.invokeWrapper => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { , row: 35, col: 21 })', + ], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error.py new file mode 100644 index 00000000..e2eb9107 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error.py @@ -0,0 +1,20 @@ +EXPECTED = [ + 'wrap://test/error => UriResolverAggregator => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + "wrap://test/error => StaticResolver - Miss", + 'wrap://test/error => ExtendableUriResolver => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + 'wrap://test/error => ResolverExtension (wrap://package/test-resolver) => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + "wrap://package/test-resolver => Client.loadWrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => StaticResolver - Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + 'wrap://package/test-resolver => Client.invokeWrapper => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error_with_subinvoke.py new file mode 100644 index 00000000..cdd2b285 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/histories/shows_wasm_extension_error_with_subinvoke.py @@ -0,0 +1,30 @@ +EXPECTED = [ + 'wrap://test/error => UriResolverAggregator => error (SubInvocation exception encountered\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 }\n\nAnother exception was encountered during execution:\nWrapError: __wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + "wrap://test/error => StaticResolver - Miss", + 'wrap://test/error => ExtendableUriResolver => error (SubInvocation exception encountered\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 }\n\nAnother exception was encountered during execution:\nWrapError: __wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + 'wrap://test/error => ResolverExtension (wrap://package/subinvoke-resolver) => error (SubInvocation exception encountered\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 }\n\nAnother exception was encountered during execution:\nWrapError: __wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + "wrap://package/subinvoke-resolver => Client.loadWrapper => wrapper (wrap://package/subinvoke-resolver)", + [ + "wrap://package/subinvoke-resolver => UriResolverAggregator => package (wrap://package/subinvoke-resolver)", + [ + "wrap://package/subinvoke-resolver => StaticResolver - Package (wrap://package/subinvoke-resolver) => package (wrap://package/subinvoke-resolver)" + ], + ], + 'wrap://package/subinvoke-resolver => Client.invokeWrapper => error (SubInvocation exception encountered\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/subinvoke-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 }\n\nAnother exception was encountered during execution:\nWrapError: __wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + [ + "wrap://package/test-resolver => Client.loadWrapper => wrapper (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => UriResolverAggregator => package (wrap://package/test-resolver)", + [ + "wrap://package/test-resolver => StaticResolver - Package (wrap://package/test-resolver) => package (wrap://package/test-resolver)" + ], + ], + 'wrap://package/test-resolver => Client.invokeWrapper => error (__wrap_abort: Test error\ncode: 51 WRAPPER INVOKE ABORTED\nuri: wrap://package/test-resolver\nmethod: tryResolveUri\nargs: {\n "authority": "test",\n "path": "error"\n} \nsource: { file: "src/wrap/module/wrapped.rs", row: 35, col: 21 })', + ], + ], + ], + ], +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/mocker.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/mocker.py new file mode 100644 index 00000000..62b39297 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/mocker.py @@ -0,0 +1,70 @@ +import os +from typing import Any, Dict, Optional +from polywrap_core import InvokerClient, Uri, UriPackage +from polywrap_plugin import PluginModule, PluginPackage +from polywrap_test_cases import get_path_to_test_wrappers + +from polywrap_uri_resolvers import MaybeUriOrManifest +from polywrap_wasm import WasmPackage + + +class MockPluginExtensionResolver(PluginModule[None]): + URI = Uri.from_str("wrap://package/test-resolver") + + def __init__(self): + super().__init__(None) + + def tryResolveUri( + self, args: Dict[str, Any], *_: Any + ) -> Optional[MaybeUriOrManifest]: + if args.get("authority") != "test": + return None + + match args.get("path"): + case "from": + return {"uri": Uri.from_str("test/to").uri} + case "package": + return {"manifest": b"test"} + case "error": + raise ValueError("test error") + case _: + return None + + +def mock_plugin_extension_resolver(): + return PluginPackage(MockPluginExtensionResolver(), NotImplemented) + + +class MockSubinvokePluginResolver(PluginModule[None]): + URI = Uri.from_str("wrap://package/test-subinvoke-resolver") + + def __init__(self): + super().__init__(None) + + def tryResolveUri( + self, args: Dict[str, Any], client: InvokerClient, *_: Any + ) -> Optional[MaybeUriOrManifest]: + return client.invoke( + uri=Uri.from_str("package/test-resolver"), method="tryResolveUri", args=args + ) + + +def mock_subinvoke_plugin_resolver() -> PluginPackage[None]: + return PluginPackage(MockSubinvokePluginResolver(), NotImplemented) + + +def mock_fs_wasm_package_resolver() -> UriPackage: + wrapper_module_path = os.path.join( + get_path_to_test_wrappers(), "resolver", "02-fs", "implementations", "as", "wrap.wasm" + ) + wrapper_manifest_path = os.path.join( + get_path_to_test_wrappers(), "resolver", "02-fs", "implementations", "as", "wrap.info" + ) + with open(wrapper_module_path, "rb") as f: + module = f.read() + + with open(wrapper_manifest_path, "rb") as f: + manifest = f.read() + + package = WasmPackage(NotImplemented, manifest=manifest, wasm_module=module) + return UriPackage(uri=Uri.from_str("package/test-fs-resolver"),package=package) diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package.py new file mode 100644 index 00000000..dfc439e0 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package.py @@ -0,0 +1,60 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, +) +import pytest + +from .mocker import mock_plugin_extension_resolver, MockPluginExtensionResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ) + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockPluginExtensionResolver.URI + ] + }, + ) + ) + + +def test_can_resolve_package_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/package") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.can_resolve_package import EXPECTED + + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package_with_subinvoke.py new file mode 100644 index 00000000..692c8862 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_package_with_subinvoke.py @@ -0,0 +1,64 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, +) +import pytest + +from .mocker import mock_subinvoke_plugin_resolver, mock_plugin_extension_resolver, MockPluginExtensionResolver, MockSubinvokePluginResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ), + MockSubinvokePluginResolver.URI: UriPackage( + uri=MockSubinvokePluginResolver.URI, + package=mock_subinvoke_plugin_resolver(), + ), + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockSubinvokePluginResolver.URI + ] + }, + ) + ) + + +def test_can_resolve_package_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/package") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.can_resolve_package_with_subinvoke import EXPECTED + print(build_clean_uri_history(resolution_context.get_history())) + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri.py new file mode 100644 index 00000000..18d28e72 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri.py @@ -0,0 +1,56 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + UriResolverAggregator, + PackageResolver, +) +import pytest + +from .mocker import mock_plugin_extension_resolver, MockPluginExtensionResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + PackageResolver( + MockPluginExtensionResolver.URI, + mock_plugin_extension_resolver(), + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockPluginExtensionResolver.URI + ] + }, + ) + ) + + +def test_can_resolve_uri_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/from") + redirected_uri = Uri.from_str("test/to") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.can_resolve_uri import EXPECTED + assert isinstance(result, Uri), "Expected a Uri result." + assert result == redirected_uri + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri_with_subinvoke.py new file mode 100644 index 00000000..bc57abb0 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_can_resolve_uri_with_subinvoke.py @@ -0,0 +1,60 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + UriResolverAggregator, + PackageResolver, +) +import pytest + +from .mocker import mock_subinvoke_plugin_resolver, mock_plugin_extension_resolver, MockPluginExtensionResolver, MockSubinvokePluginResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + PackageResolver( + MockSubinvokePluginResolver.URI, + mock_subinvoke_plugin_resolver(), + ), + PackageResolver( + MockPluginExtensionResolver.URI, + mock_plugin_extension_resolver(), + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockSubinvokePluginResolver.URI + ] + }, + ) + ) + + +def test_can_resolve_uri_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/from") + redirected_uri = Uri.from_str("test/to") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.can_resolve_uri_with_subinvoke import EXPECTED + assert isinstance(result, Uri), "Expected a Uri result." + assert result == redirected_uri + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match.py new file mode 100644 index 00000000..fd1a124f --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match.py @@ -0,0 +1,59 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, +) +import pytest + +from .mocker import mock_plugin_extension_resolver, MockPluginExtensionResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ) + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockPluginExtensionResolver.URI + ] + }, + ) + ) + + +def test_can_resolve_uri_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/not-a-match") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.not_a_match import EXPECTED + assert isinstance(result, Uri), "Expected a Uri result." + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match_with_subinvoke.py new file mode 100644 index 00000000..c05c6c5c --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_a_match_with_subinvoke.py @@ -0,0 +1,65 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, +) +import pytest + +from .mocker import MockSubinvokePluginResolver, mock_plugin_extension_resolver, MockPluginExtensionResolver, mock_subinvoke_plugin_resolver + + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ), + MockSubinvokePluginResolver.URI: UriPackage( + uri=MockSubinvokePluginResolver.URI, + package=mock_subinvoke_plugin_resolver(), + ), + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockSubinvokePluginResolver.URI + ] + }, + ) + ) + + + +def test_can_resolve_uri_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/not-a-match") + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.not_a_match_with_subinvoke import EXPECTED + assert isinstance(result, Uri), "Expected a Uri result." + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_found_extension.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_found_extension.py new file mode 100644 index 00000000..a456870d --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_not_found_extension.py @@ -0,0 +1,44 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriResolutionContext, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + UriResolverAggregator, + UriResolverExtensionNotFoundError, +) +import pytest + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + Uri.from_str("test/undefined-resolver") + ] + }, + ) + ) + + +def test_can_resolve_uri_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/not-a-match") + + with pytest.raises(UriResolverExtensionNotFoundError): + client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error.py new file mode 100644 index 00000000..7dcd60bf --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error.py @@ -0,0 +1,59 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, + UriResolverExtensionError, +) +import pytest + +from .mocker import mock_plugin_extension_resolver, MockPluginExtensionResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ) + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockPluginExtensionResolver.URI + ] + }, + ) + ) + + +def test_shows_error_with_plugin_extension(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/error") + + with pytest.raises(UriResolverExtensionError) as excinfo: + client.try_resolve_uri(uri=source_uri, resolution_context=resolution_context) + + assert ( + excinfo.value.args[0] + == f"Failed to resolve uri: {source_uri}, using extension resolver: ({MockPluginExtensionResolver.URI})" + ) diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error_with_subinvoke.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error_with_subinvoke.py new file mode 100644 index 00000000..c11c6dc6 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_shows_plugin_extension_error_with_subinvoke.py @@ -0,0 +1,64 @@ +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriPackage, + UriResolutionContext, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + StaticResolver, + UriResolverAggregator, + UriResolverExtensionError, +) +import pytest + +from .mocker import mock_subinvoke_plugin_resolver, mock_plugin_extension_resolver, MockPluginExtensionResolver, MockSubinvokePluginResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RecursiveResolver( + UriResolverAggregator( + [ + StaticResolver( + { + MockSubinvokePluginResolver.URI: UriPackage( + uri=MockSubinvokePluginResolver.URI, + package=mock_subinvoke_plugin_resolver(), + ), + MockPluginExtensionResolver.URI: UriPackage( + uri=MockPluginExtensionResolver.URI, + package=mock_plugin_extension_resolver(), + ), + } + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [ + MockSubinvokePluginResolver.URI + ] + }, + ) + ) + + + +def test_shows_error_with_plugin_extension_subinvoke(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri.from_str("test/error") + + with pytest.raises(UriResolverExtensionError) as excinfo: + client.try_resolve_uri(uri=source_uri, resolution_context=resolution_context) + + assert ( + excinfo.value.args[0] + == f"Failed to resolve uri: {source_uri}, using extension resolver: ({MockSubinvokePluginResolver.URI})" + ) diff --git a/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_use_wasm_fs_resolver.py b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_use_wasm_fs_resolver.py new file mode 100644 index 00000000..923b7e1d --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/extension_resolver/test_use_wasm_fs_resolver.py @@ -0,0 +1,60 @@ +import os +from polywrap_client import PolywrapClient +from polywrap_core import ( + ClientConfig, + Uri, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_uri_resolvers import ( + ExtendableUriResolver, + RecursiveResolver, + UriResolverAggregator, + PackageResolver, +) +from polywrap_test_cases import get_path_to_test_wrappers +import pytest + +from .mocker import mock_fs_wasm_package_resolver + + +@pytest.fixture +def client() -> PolywrapClient: + uri_package = mock_fs_wasm_package_resolver() + resolver = RecursiveResolver( + UriResolverAggregator( + [ + PackageResolver( + uri_package.uri, + uri_package.package, + ), + ExtendableUriResolver(), + ] + ) + ) + return PolywrapClient( + ClientConfig( + resolver=resolver, + interfaces={ + ExtendableUriResolver.DEFAULT_EXT_INTERFACE_URIS[0]: [uri_package.uri] + }, + ) + ) + + +def test_can_use_wasm_fs_resolver(client: PolywrapClient) -> None: + resolution_context = UriResolutionContext() + source_uri = Uri( + "fs", + os.path.join(get_path_to_test_wrappers(), "asyncify", "implementations", "as"), + ) + + result = client.try_resolve_uri( + uri=source_uri, resolution_context=resolution_context + ) + + from .histories.can_use_wasm_fs_resolver import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + # Note: real wasm fs resolver should returns a UriPackage, not a Uri. + assert isinstance(result, Uri), "Expected a Uri result." \ No newline at end of file diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/conftest.py new file mode 100644 index 00000000..2c7c4342 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/conftest.py @@ -0,0 +1,14 @@ +import pytest +from polywrap_core import Uri, UriResolutionContext, ClientConfig +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import PackageResolver + +@pytest.fixture +def client() -> PolywrapClient: + resolver = PackageResolver(Uri.from_str("test/package"), NotImplemented) + return PolywrapClient(ClientConfig(resolver=resolver)) + +@pytest.fixture +def resolution_context() -> UriResolutionContext: + return UriResolutionContext() + diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/not_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/not_resolve_package.py new file mode 100644 index 00000000..b68a6d8d --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/not_resolve_package.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/not-a-match => Package (wrap://test/package)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/resolve_package.py new file mode 100644 index 00000000..dea27dbe --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/histories/resolve_package.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/package => Package (wrap://test/package) => package (wrap://test/package)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_not_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_not_resolve_package.py new file mode 100644 index 00000000..e3e66a52 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_not_resolve_package.py @@ -0,0 +1,14 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_not_resolve_package(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/not-a-match") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.not_resolve_package import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/not-a-match" diff --git a/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_resolve_package.py new file mode 100644 index 00000000..7f3d7830 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/package_resolver/test_resolve_package.py @@ -0,0 +1,15 @@ +from polywrap_core import Uri, UriResolutionContext, UriPackage, build_clean_uri_history +from polywrap_client import PolywrapClient + + + +def test_resolve_package(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/package") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.resolve_package import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert result.uri.uri == "wrap://test/package" diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/conftest.py new file mode 100644 index 00000000..a120a5c1 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/conftest.py @@ -0,0 +1,46 @@ +import pytest +from polywrap_core import ( + ClientConfig, + InvokerClient, + Uri, + UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import RecursiveResolver + + +class SimpleRedirectResolver: + def try_resolve_uri( + self, uri: Uri, client: InvokerClient, resolution_context: UriResolutionContext + ) -> UriPackageOrWrapper: + result: UriPackageOrWrapper + + if uri.uri == "wrap://test/1": + result = Uri.from_str("test/2") + elif uri.uri == "wrap://test/2": + result = Uri.from_str("test/3") + elif uri.uri == "wrap://test/3": + result = Uri.from_str("test/4") + else: + result = uri + + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, result=result, description="SimpleRedirectResolver" + ) + ) + + return result + + +@pytest.fixture +def simple_redirect_resolver() -> SimpleRedirectResolver: + return SimpleRedirectResolver() + + +@pytest.fixture +def client(simple_redirect_resolver: SimpleRedirectResolver) -> PolywrapClient: + resolver = RecursiveResolver(simple_redirect_resolver) + return PolywrapClient(ClientConfig(resolver=resolver)) diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/infinite_loop.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/infinite_loop.py new file mode 100644 index 00000000..20e7be22 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/infinite_loop.py @@ -0,0 +1,5 @@ +EXPECTED = [ + "wrap://test/1 => InfiniteRedirectResolver => uri (wrap://test/2)", + "wrap://test/2 => InfiniteRedirectResolver => uri (wrap://test/3)", + "wrap://test/3 => InfiniteRedirectResolver => uri (wrap://test/1)", +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/no_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/no_resolve.py new file mode 100644 index 00000000..98e9f8e0 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/no_resolve.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/not-a-match => SimpleRedirectResolver" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/recursive_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/recursive_resolve.py new file mode 100644 index 00000000..508d0957 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/histories/recursive_resolve.py @@ -0,0 +1,6 @@ +EXPECTED = [ + "wrap://test/1 => SimpleRedirectResolver => uri (wrap://test/2)", + "wrap://test/2 => SimpleRedirectResolver => uri (wrap://test/3)", + "wrap://test/3 => SimpleRedirectResolver => uri (wrap://test/4)", + "wrap://test/4 => SimpleRedirectResolver" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_infinite_loop.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_infinite_loop.py new file mode 100644 index 00000000..51041075 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_infinite_loop.py @@ -0,0 +1,58 @@ +import pytest +from polywrap_core import ( + ClientConfig, + InvokerClient, + Uri, + UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, + build_clean_uri_history, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import RecursiveResolver, InfiniteLoopError + + +class InfiniteRedirectResolver: + def try_resolve_uri( + self, uri: Uri, client: InvokerClient, resolution_context: UriResolutionContext + ) -> UriPackageOrWrapper: + result: UriPackageOrWrapper + + if uri.uri == "wrap://test/1": + result = Uri.from_str("test/2") + elif uri.uri == "wrap://test/2": + result = Uri.from_str("test/3") + elif uri.uri == "wrap://test/3": + result = Uri.from_str("test/1") + else: + result = uri + + resolution_context.track_step( + UriResolutionStep( + source_uri=uri, result=result, description="InfiniteRedirectResolver" + ) + ) + + return result + + +@pytest.fixture +def infinite_redirect_resolver() -> InfiniteRedirectResolver: + return InfiniteRedirectResolver() + + +@pytest.fixture +def client(infinite_redirect_resolver: InfiniteRedirectResolver) -> PolywrapClient: + resolver = RecursiveResolver(infinite_redirect_resolver) + return PolywrapClient(ClientConfig(resolver=resolver)) + + +def test_infinite_loop(client: PolywrapClient): + uri = Uri.from_str("test/1") + resolution_context = UriResolutionContext() + + with pytest.raises(InfiniteLoopError) as excinfo: + client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + from .histories.infinite_loop import EXPECTED + assert excinfo.value.uri == uri + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_not_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_not_resolve.py new file mode 100644 index 00000000..ab503464 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_not_resolve.py @@ -0,0 +1,20 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, + build_clean_uri_history +) +from polywrap_client import PolywrapClient + + +def test_not_resolve_uri(client: PolywrapClient) -> None: + uri = Uri.from_str("test/not-a-match") + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + + from .histories.no_resolve import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/not-a-match" diff --git a/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_recursive_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_recursive_resolve.py new file mode 100644 index 00000000..cf2fe82a --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/recursive_resolver/test_recursive_resolve.py @@ -0,0 +1,19 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, + build_clean_uri_history +) +from polywrap_client import PolywrapClient + + +def test_recursive_resolve_uri(client: PolywrapClient) -> None: + uri = Uri.from_str("test/1") + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.recursive_resolve import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/4" diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/conftest.py new file mode 100644 index 00000000..12650fad --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/conftest.py @@ -0,0 +1,14 @@ +import pytest +from polywrap_core import Uri, UriResolutionContext, ClientConfig +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import RedirectResolver + +@pytest.fixture +def client() -> PolywrapClient: + resolver = RedirectResolver(Uri.from_str("test/from"), Uri.from_str("test/to")) + return PolywrapClient(ClientConfig(resolver=resolver)) + +@pytest.fixture +def resolution_context() -> UriResolutionContext: + return UriResolutionContext() + diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/can_redirect.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/can_redirect.py new file mode 100644 index 00000000..1628caf8 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/can_redirect.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/from => Redirect (wrap://test/from - wrap://test/to) => uri (wrap://test/to)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/not_redirect.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/not_redirect.py new file mode 100644 index 00000000..583ef804 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/histories/not_redirect.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/not-a-match => Redirect (wrap://test/from - wrap://test/to)" +] \ No newline at end of file diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_can_redirect_uri.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_can_redirect_uri.py new file mode 100644 index 00000000..c8af0058 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_can_redirect_uri.py @@ -0,0 +1,17 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_can_redirect_uri( + client: PolywrapClient, resolution_context: UriResolutionContext +) -> None: + uri = Uri.from_str("test/from") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.can_redirect import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/to" diff --git a/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_not_redirect_uri.py b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_not_redirect_uri.py new file mode 100644 index 00000000..7a6fe0f9 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/redirect_resolver/test_not_redirect_uri.py @@ -0,0 +1,17 @@ +from polywrap_core import Uri, UriResolutionContext, UriPackage, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_not_redirect_uri( + client: PolywrapClient, resolution_context: UriResolutionContext +) -> None: + uri = Uri.from_str("test/not-a-match") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.not_redirect import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/not-a-match" diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/conftest.py new file mode 100644 index 00000000..cb436ee7 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/conftest.py @@ -0,0 +1,65 @@ +import pytest +from polywrap_core import ( + ClientConfig, + InvokerClient, + Uri, + UriPackageOrWrapper, + UriResolutionContext, + UriResolutionStep, + UriWrapper, + UriPackage, + UriResolver, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import ( + RecursiveResolver, + ResolutionResultCacheResolver, + UriResolutionError, + InMemoryResolutionResultCache, +) + + +class TestResolver(UriResolver): + def try_resolve_uri( + self, uri: Uri, client: InvokerClient, resolution_context: UriResolutionContext + ) -> UriPackageOrWrapper: + result: UriPackageOrWrapper + + if uri.uri == "wrap://test/package": + result = UriPackage(uri=uri, package=NotImplemented) + elif uri.uri == "wrap://test/wrapper": + result = UriWrapper(uri=uri, wrapper=NotImplemented) + elif uri.uri == "wrap://test/from": + result = Uri.from_str("test/to") + elif uri.uri == "wrap://test/A": + result = Uri.from_str("test/B") + elif uri.uri == "wrap://test/B": + result = Uri.from_str("test/wrapper") + elif uri.uri == "wrap://test/error": + raise UriResolutionError("A test error") + else: + raise UriResolutionError(f"Unexpected URI: {uri.uri}") + + resolution_context.track_step( + UriResolutionStep(source_uri=uri, result=result, description="TestResolver") + ) + + return result + + +@pytest.fixture +def client(): + resolver = ResolutionResultCacheResolver( + TestResolver(), cache=InMemoryResolutionResultCache() + ) + return PolywrapClient(ClientConfig(resolver=resolver)) + + +@pytest.fixture +def recursive_client(): + resolver = RecursiveResolver( + ResolutionResultCacheResolver( + TestResolver(), cache=InMemoryResolutionResultCache() + ) + ) + return PolywrapClient(ClientConfig(resolver=resolver)) diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_with_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_with_cache.py new file mode 100644 index 00000000..c9bcf5a3 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_with_cache.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/error => ResolutionResultCacheResolver (Cache) => error (A test error)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_without_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_without_cache.py new file mode 100644 index 00000000..e0fbe0f3 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/error_without_cache.py @@ -0,0 +1,4 @@ +EXPECTED = [ + "wrap://test/error => ResolutionResultCacheResolver => error (A test error)", + ["wrap://test/error => TestResolver => error (A test error)"] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_with_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_with_cache.py new file mode 100644 index 00000000..a44f4484 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_with_cache.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/package => ResolutionResultCacheResolver (Cache) => package (wrap://test/package)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_without_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_without_cache.py new file mode 100644 index 00000000..be244bd6 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/package_without_cache.py @@ -0,0 +1,6 @@ +EXPECTED = [ + "wrap://test/package => ResolutionResultCacheResolver => package (wrap://test/package)", + [ + "wrap://test/package => TestResolver => package (wrap://test/package)" + ] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_with_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_with_cache.py new file mode 100644 index 00000000..b0d4f0f4 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_with_cache.py @@ -0,0 +1 @@ +EXPECTED = ["wrap://test/from => ResolutionResultCacheResolver (Cache) => uri (wrap://test/to)"] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_without_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_without_cache.py new file mode 100644 index 00000000..a7c38388 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/uri_without_cache.py @@ -0,0 +1,6 @@ +EXPECTED = [ + "wrap://test/from => ResolutionResultCacheResolver => uri (wrap://test/to)", + [ + "wrap://test/from => TestResolver => uri (wrap://test/to)" + ] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_with_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_with_cache.py new file mode 100644 index 00000000..39792f38 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_with_cache.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/wrapper => ResolutionResultCacheResolver (Cache) => wrapper (wrap://test/wrapper)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_without_cache.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_without_cache.py new file mode 100644 index 00000000..700f278c --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/histories/wrapper_without_cache.py @@ -0,0 +1,4 @@ +EXPECTED = [ + "wrap://test/wrapper => ResolutionResultCacheResolver => wrapper (wrap://test/wrapper)", + ["wrap://test/wrapper => TestResolver => wrapper (wrap://test/wrapper)"] +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_error.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_error.py new file mode 100644 index 00000000..a6ab5a9d --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_error.py @@ -0,0 +1,31 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import UriResolutionError +import pytest + + +def test_cached_error(client: PolywrapClient): + client._config.resolver.cache_errors = True # type: ignore + + resolution_context = UriResolutionContext() + with pytest.raises(UriResolutionError) as exc_info_1: + client.try_resolve_uri( + uri=Uri.from_str("test/error"), resolution_context=resolution_context + ) + + assert exc_info_1.value.__class__.__name__ == "UriResolutionError" + assert exc_info_1.value.args[0] == "A test error" + + resolution_context = UriResolutionContext() + with pytest.raises(UriResolutionError) as exc_info_2: + client.try_resolve_uri( + uri=Uri.from_str("test/error"), resolution_context=resolution_context + ) + + assert exc_info_2.value.__class__.__name__ == "UriResolutionError" + assert exc_info_2.value.args[0] == "A test error" + + assert exc_info_1.value is exc_info_2.value diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_package.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_package.py new file mode 100644 index 00000000..92189d84 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_package.py @@ -0,0 +1,29 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, + UriPackage, + build_clean_uri_history, +) +from polywrap_client import PolywrapClient + + +def test_cached_package(client: PolywrapClient): + uri = Uri.from_str("test/package") + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.package_without_cache import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert result.uri.uri == "wrap://test/package" + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.package_with_cache import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert result.uri.uri == "wrap://test/package" diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_uri.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_uri.py new file mode 100644 index 00000000..7bc9fddb --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_uri.py @@ -0,0 +1,30 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, + build_clean_uri_history, +) +from polywrap_client import PolywrapClient + + +def test_cached_uri(client: PolywrapClient): + uri = Uri.from_str("test/from") + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.uri_without_cache import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/to" + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.uri_with_cache import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/to" diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_wrapper.py new file mode 100644 index 00000000..150e8d5c --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_cached_wrapper.py @@ -0,0 +1,29 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, + UriWrapper, + build_clean_uri_history, +) +from polywrap_client import PolywrapClient + + +def test_cached_wrapper(client: PolywrapClient): + uri = Uri.from_str("test/wrapper") + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.wrapper_without_cache import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriWrapper), "Expected a UriWrapper result." + assert result.uri.uri == "wrap://test/wrapper" + + resolution_context = UriResolutionContext() + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.wrapper_with_cache import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriWrapper), "Expected a UriWrapper result." + assert result.uri.uri == "wrap://test/wrapper" diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_not_cached_error.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_not_cached_error.py new file mode 100644 index 00000000..93b8341b --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_not_cached_error.py @@ -0,0 +1,29 @@ +from polywrap_core import ( + Uri, + UriResolutionContext, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import UriResolutionError +import pytest + + +def test_not_cached_error(client: PolywrapClient): + resolution_context = UriResolutionContext() + with pytest.raises(UriResolutionError) as exc_info_1: + client.try_resolve_uri( + uri=Uri.from_str("test/error"), resolution_context=resolution_context + ) + + assert exc_info_1.value.__class__.__name__ == "UriResolutionError" + assert exc_info_1.value.args[0] == "A test error" + + resolution_context = UriResolutionContext() + with pytest.raises(UriResolutionError) as exc_info_2: + client.try_resolve_uri( + uri=Uri.from_str("test/error"), resolution_context=resolution_context + ) + + assert exc_info_2.value.__class__.__name__ == "UriResolutionError" + assert exc_info_2.value.args[0] == "A test error" + + assert exc_info_1.value is not exc_info_2.value diff --git a/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_resolution_path.py b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_resolution_path.py new file mode 100644 index 00000000..a90bbcf5 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/resolution_result_cache_resolver/test_resolution_path.py @@ -0,0 +1,23 @@ +from polywrap_client import PolywrapClient +from polywrap_core import Uri, UriResolutionContext + + +def test_same_resolution_path_after_caching(recursive_client: PolywrapClient): + uri = Uri.from_str("test/A") + expected_path = [ + Uri.from_str("wrap://test/A"), + Uri.from_str("wrap://test/B"), + Uri.from_str("wrap://test/wrapper"), + ] + + resolution_context = UriResolutionContext() + recursive_client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + resolution_path = resolution_context.get_resolution_path() + assert resolution_path == expected_path + + resolution_context = UriResolutionContext() + recursive_client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + resolution_path = resolution_context.get_resolution_path() + assert resolution_path == expected_path diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/conftest.py new file mode 100644 index 00000000..23559a3d --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/conftest.py @@ -0,0 +1,31 @@ +import pytest +from polywrap_core import ( + Uri, + UriPackage, + UriResolutionContext, + ClientConfig, + UriWrapper, +) +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import StaticResolver + + +@pytest.fixture +def client() -> PolywrapClient: + resolver = StaticResolver( + { + Uri.from_str("test/from"): Uri.from_str("test/to"), + Uri.from_str("test/package"): UriPackage( + uri=Uri.from_str("test/package"), package=NotImplemented + ), + Uri.from_str("test/wrapper"): UriWrapper( + uri=Uri.from_str("test/wrapper"), wrapper=NotImplemented + ), + } + ) + return PolywrapClient(ClientConfig(resolver=resolver)) + + +@pytest.fixture +def resolution_context() -> UriResolutionContext: + return UriResolutionContext() diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_redirect.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_redirect.py new file mode 100644 index 00000000..2b61d564 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_redirect.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/from => Static - Redirect (wrap://test/from - wrap://test/to) => uri (wrap://test/to)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_package.py new file mode 100644 index 00000000..5502638a --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_package.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/package => Static - Package => package (wrap://test/package)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_wrapper.py new file mode 100644 index 00000000..29e09e5e --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/can_resolve_wrapper.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/wrapper => Static - Wrapper => wrapper (wrap://test/wrapper)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/not_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/not_resolve.py new file mode 100644 index 00000000..17635786 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/histories/not_resolve.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/no-match => Static - Miss" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_redirect.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_redirect.py new file mode 100644 index 00000000..c8af0058 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_redirect.py @@ -0,0 +1,17 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_can_redirect_uri( + client: PolywrapClient, resolution_context: UriResolutionContext +) -> None: + uri = Uri.from_str("test/from") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.can_redirect import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/to" diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_package.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_package.py new file mode 100644 index 00000000..e7b885bb --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_package.py @@ -0,0 +1,15 @@ +from polywrap_core import Uri, UriResolutionContext, UriPackage, build_clean_uri_history +from polywrap_client import PolywrapClient + + + +def test_resolve_package(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/package") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.can_resolve_package import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriPackage), "Expected a UriPackage result." + assert result.uri.uri == "wrap://test/package" diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_wrapper.py new file mode 100644 index 00000000..803cfd5a --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_can_resolve_wrapper.py @@ -0,0 +1,14 @@ +from polywrap_core import Uri, UriResolutionContext, UriWrapper, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_resolve_wrapper(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/wrapper") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.can_resolve_wrapper import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriWrapper), "Expected a UriWrapper result." + assert result.uri.uri == "wrap://test/wrapper" diff --git a/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_not_resolve.py b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_not_resolve.py new file mode 100644 index 00000000..4e9ff210 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/static_resolver/test_not_resolve.py @@ -0,0 +1,15 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_no_match(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/no-match") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.not_resolve import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/no-match" + diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/conftest.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/conftest.py new file mode 100644 index 00000000..2e17944f --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/conftest.py @@ -0,0 +1,14 @@ +import pytest +from polywrap_core import Uri, UriResolutionContext, ClientConfig +from polywrap_client import PolywrapClient +from polywrap_uri_resolvers import WrapperResolver + +@pytest.fixture +def client() -> PolywrapClient: + resolver = WrapperResolver(Uri.from_str("test/wrapper"), NotImplemented) + return PolywrapClient(ClientConfig(resolver=resolver)) + +@pytest.fixture +def resolution_context() -> UriResolutionContext: + return UriResolutionContext() + diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/__init__.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/not_resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/not_resolve_wrapper.py new file mode 100644 index 00000000..2c53be78 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/not_resolve_wrapper.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/not-a-match => Wrapper (wrap://test/wrapper)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/resolve_wrapper.py new file mode 100644 index 00000000..a46b9cda --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/histories/resolve_wrapper.py @@ -0,0 +1,3 @@ +EXPECTED = [ + "wrap://test/wrapper => Wrapper (wrap://test/wrapper) => wrapper (wrap://test/wrapper)" +] diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_not_resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_not_resolve_wrapper.py new file mode 100644 index 00000000..fcebe6af --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_not_resolve_wrapper.py @@ -0,0 +1,17 @@ +from polywrap_core import Uri, UriResolutionContext, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_not_resolve_wrapper( + client: PolywrapClient, resolution_context: UriResolutionContext +) -> None: + uri = Uri.from_str("test/not-a-match") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.not_resolve_wrapper import EXPECTED + + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, Uri), "Expected a Uri result." + assert result.uri == "wrap://test/not-a-match" diff --git a/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_resolve_wrapper.py b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_resolve_wrapper.py new file mode 100644 index 00000000..fbdb4a48 --- /dev/null +++ b/packages/polywrap-uri-resolvers/tests/integration/wrapper_resolver/test_resolve_wrapper.py @@ -0,0 +1,14 @@ +from polywrap_core import Uri, UriResolutionContext, UriWrapper, build_clean_uri_history +from polywrap_client import PolywrapClient + + +def test_resolve_wrapper(client: PolywrapClient, resolution_context: UriResolutionContext) -> None: + uri = Uri.from_str("test/wrapper") + + result = client.try_resolve_uri(uri=uri, resolution_context=resolution_context) + + from .histories.resolve_wrapper import EXPECTED + assert build_clean_uri_history(resolution_context.get_history()) == EXPECTED + + assert isinstance(result, UriWrapper), "Expected a UriWrapper result." + assert result.uri.uri == "wrap://test/wrapper" diff --git a/packages/polywrap-uri-resolvers/tests/test_static_resolver.py b/packages/polywrap-uri-resolvers/tests/test_static_resolver.py deleted file mode 100644 index 2ddeae58..00000000 --- a/packages/polywrap-uri-resolvers/tests/test_static_resolver.py +++ /dev/null @@ -1,70 +0,0 @@ -# import pytest -# from pathlib import Path - -# from polywrap_result import Ok, Err, Result -# from polywrap_wasm import WRAP_MANIFEST_PATH, WRAP_MODULE_PATH, IFileReader, WasmPackage, WasmWrapper -# from polywrap_core import UriPackage, Uri, UriResolutionContext, UriWrapper, IWrapPackage -# from polywrap_client import PolywrapClient -# from polywrap_uri_resolvers import StaticResolver -# from polywrap_manifest import deserialize_wrap_manifest - - -# @pytest.fixture -# def simple_wrap_module(): -# wrap_path = Path(__file__).parent / "cases" / "simple" / "wrap.wasm" -# with open(wrap_path, "rb") as f: -# yield f.read() - - -# @pytest.fixture -# def simple_wrap_manifest(): -# wrap_path = Path(__file__).parent / "cases" / "simple" / "wrap.info" -# with open(wrap_path, "rb") as f: -# yield f.read() - -# @pytest.fixture -# def simple_file_reader(simple_wrap_module: bytes, simple_wrap_manifest: bytes): -# class FileReader(IFileReader): -# async def read_file(self, file_path: str) -> Result[bytes]: -# if file_path == WRAP_MODULE_PATH: -# return Ok(simple_wrap_module) -# if file_path == WRAP_MANIFEST_PATH: -# return Ok(simple_wrap_manifest) -# return Err.from_str(f"FileNotFound: {file_path}") - -# yield FileReader() - -# @pytest.mark.asyncio -# async def test_static_resolver( -# simple_file_reader: IFileReader, -# simple_wrap_module: bytes, -# simple_wrap_manifest: bytes -# ): -# package = WasmPackage(simple_file_reader) - -# manifest = deserialize_wrap_manifest(simple_wrap_manifest).unwrap() -# wrapper = WasmWrapper(simple_file_reader, simple_wrap_module, manifest) - -# uri_wrapper = UriWrapper(uri=Uri("ens/wrapper.eth"), wrapper=wrapper) -# uri_package = UriPackage(uri=Uri("ens/package.eth"), package=package) - -# resolver = StaticResolver.from_list([ uri_package, uri_wrapper, [ -# UriPackage(uri=Uri("ens/nested-package.eth"), package=package) -# ]]).unwrap() - -# resolution_context = UriResolutionContext() -# result = await resolver.try_resolve_uri(Uri("ens/package.eth"), PolywrapClient(), resolution_context) - -# assert result.is_ok -# assert isinstance((result.unwrap()).package, IWrapPackage) - -# result = await resolver.try_resolve_uri(Uri("ens/wrapper.eth"), PolywrapClient(), resolution_context) - -# assert result.is_ok -# assert isinstance((result.unwrap()).wrapper, WasmWrapper) - -# result = await resolver.try_resolve_uri(Uri("ens/nested-package.eth"), PolywrapClient(), resolution_context) - -# assert result.is_ok -# assert isinstance((result.unwrap()).package, IWrapPackage) - diff --git a/packages/polywrap-uri-resolvers/tests/unit/__init__.py b/packages/polywrap-uri-resolvers/tests/unit/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/packages/polywrap-client/tests/cases/simple-invoke/wrap.info b/packages/polywrap-uri-resolvers/tests/unit/cases/simple/wrap.info similarity index 100% rename from packages/polywrap-client/tests/cases/simple-invoke/wrap.info rename to packages/polywrap-uri-resolvers/tests/unit/cases/simple/wrap.info diff --git a/packages/polywrap-client/tests/cases/simple-invoke/wrap.wasm b/packages/polywrap-uri-resolvers/tests/unit/cases/simple/wrap.wasm similarity index 100% rename from packages/polywrap-client/tests/cases/simple-invoke/wrap.wasm rename to packages/polywrap-uri-resolvers/tests/unit/cases/simple/wrap.wasm diff --git a/packages/polywrap-uri-resolvers/tests/test_file_resolver.py b/packages/polywrap-uri-resolvers/tests/unit/test_file_resolver.py similarity index 76% rename from packages/polywrap-uri-resolvers/tests/test_file_resolver.py rename to packages/polywrap-uri-resolvers/tests/unit/test_file_resolver.py index 9444620e..c7b28aa9 100644 --- a/packages/polywrap-uri-resolvers/tests/test_file_resolver.py +++ b/packages/polywrap-uri-resolvers/tests/unit/test_file_resolver.py @@ -14,12 +14,11 @@ def fs_resolver(file_reader: FileReader): return FsUriResolver(file_reader=file_reader) -@pytest.mark.asyncio -async def test_file_resolver(fs_resolver: UriResolver): +def test_file_resolver(fs_resolver: UriResolver): path = Path(__file__).parent / "cases" / "simple" uri = Uri.from_str(f"wrap://fs/{path}") - result = await fs_resolver.try_resolve_uri(uri, None, None) # type: ignore + result = fs_resolver.try_resolve_uri(uri, None, None) # type: ignore assert result assert isinstance(result, UriPackage) diff --git a/packages/polywrap-uri-resolvers/tox.ini b/packages/polywrap-uri-resolvers/tox.ini index 2aa32861..3ba7cd01 100644 --- a/packages/polywrap-uri-resolvers/tox.ini +++ b/packages/polywrap-uri-resolvers/tox.ini @@ -4,6 +4,7 @@ envlist = py310 [testenv] commands = + python -m polywrap_test_cases pytest tests/ [testenv:lint] diff --git a/packages/polywrap-wasm/README.md b/packages/polywrap-wasm/README.md index 8c3dba73..0cc69865 100644 --- a/packages/polywrap-wasm/README.md +++ b/packages/polywrap-wasm/README.md @@ -9,21 +9,23 @@ Python implementation of the Wasm wrapper runtime. ```python from typing import cast from polywrap_manifest import AnyWrapManifest -from polywrap_core import FileReader, Invoker +from polywrap_core import FileReader, InvokerClient from polywrap_wasm import WasmWrapper file_reader: FileReader = ... # any valid file_reader, pass NotImplemented for mocking wasm_module: bytes = bytes("") wrap_manifest: AnyWrapManifest = ... wrapper = WasmWrapper(file_reader, wasm_module, wrap_manifest) -invoker: Invoker = ... # any valid invoker, mostly PolywrapClient +client: InvokerClient = ... # any valid invoker client, mostly PolywrapClient message = "hey" args = {"arg": message} -options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions( - uri=Uri.from_str("fs/./build"), method="simpleMethod", args=args +result = wrapper.invoke( + uri=Uri.from_str("fs/./build"), + method="simpleMethod", + args=args, + client=client ) -result = await wrapper.invoke(options, invoker) assert result.encoded is True assert msgpack_decode(cast(bytes, result.result)) == message ``` diff --git a/packages/polywrap-wasm/poetry.lock b/packages/polywrap-wasm/poetry.lock index aad37eb3..14bf1311 100644 --- a/packages/polywrap-wasm/poetry.lock +++ b/packages/polywrap-wasm/poetry.lock @@ -2,14 +2,14 @@ [[package]] name = "astroid" -version = "2.15.3" +version = "2.15.4" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "astroid-2.15.3-py3-none-any.whl", hash = "sha256:f11e74658da0f2a14a8d19776a8647900870a63de71db83713a8e77a6af52662"}, - {file = "astroid-2.15.3.tar.gz", hash = "sha256:44224ad27c54d770233751315fa7f74c46fa3ee0fab7beef1065f99f09897efe"}, + {file = "astroid-2.15.4-py3-none-any.whl", hash = "sha256:a1b8543ef9d36ea777194bc9b17f5f8678d2c56ee6a45b2c2f17eec96f242347"}, + {file = "astroid-2.15.4.tar.gz", hash = "sha256:c81e1c7fbac615037744d067a9bb5f9aeb655edf59b63ee8b59585475d6f80d8"}, ] [package.dependencies] @@ -151,19 +151,19 @@ test = ["pytest (>=6)"] [[package]] name = "filelock" -version = "3.11.0" +version = "3.12.0" description = "A platform independent file lock." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "filelock-3.11.0-py3-none-any.whl", hash = "sha256:f08a52314748335c6460fc8fe40cd5638b85001225db78c2aa01c8c0db83b318"}, - {file = "filelock-3.11.0.tar.gz", hash = "sha256:3618c0da67adcc0506b015fd11ef7faf1b493f0b40d87728e19986b536890c37"}, + {file = "filelock-3.12.0-py3-none-any.whl", hash = "sha256:ad98852315c2ab702aeb628412cbf7e95b7ce8c3bf9565670b4eaecf1db370a9"}, + {file = "filelock-3.12.0.tar.gz", hash = "sha256:fc03ae43288c013d2ea83c8597001b1129db351aad9c57fe2409327916b8e718"}, ] [package.extras] -docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.2.2)", "diff-cover (>=7.5)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] [[package]] name = "gitdb" @@ -506,19 +506,19 @@ files = [ [[package]] name = "platformdirs" -version = "3.2.0" +version = "3.5.0" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "platformdirs-3.2.0-py3-none-any.whl", hash = "sha256:ebe11c0d7a805086e99506aa331612429a72ca7cd52a1f0d277dc4adc20cb10e"}, - {file = "platformdirs-3.2.0.tar.gz", hash = "sha256:d5b638ca397f25f979350ff789db335903d7ea010ab28903f57b27e1b16c2b08"}, + {file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"}, + {file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"}, ] [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.22,!=1.23.4)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.2.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] [[package]] name = "pluggy" @@ -542,15 +542,17 @@ version = "0.1.0a29" description = "" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_core-0.1.0a29-py3-none-any.whl", hash = "sha256:ea3111a0a2a4287c0f7a180fd7bb024530e720cd5ec97767b52502679d42a097"}, - {file = "polywrap_core-0.1.0a29.tar.gz", hash = "sha256:b879c8b621eaa4ae5ad1cc48a6b304596fe9586163395782584207886e793eba"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-manifest = ">=0.1.0a29,<0.2.0" -polywrap-msgpack = ">=0.1.0a29,<0.2.0" +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} + +[package.source] +type = "directory" +url = "../polywrap-core" [[package]] name = "polywrap-manifest" @@ -558,15 +560,17 @@ version = "0.1.0a29" description = "WRAP manifest" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_manifest-0.1.0a29-py3-none-any.whl", hash = "sha256:1d13b2075aca5a65c86b9d0ec9c35f564eab4c9cc8caa77674ed720193dcd60b"}, - {file = "polywrap_manifest-0.1.0a29.tar.gz", hash = "sha256:9f2bcf10b7ffd73a750e712bee8a24f5d6e0cd59a3d131a7d32b37b2366075c2"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -polywrap-msgpack = ">=0.1.0a29,<0.2.0" -pydantic = ">=1.10.2,<2.0.0" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +pydantic = "^1.10.2" + +[package.source] +type = "directory" +url = "../polywrap-manifest" [[package]] name = "polywrap-msgpack" @@ -574,14 +578,16 @@ version = "0.1.0a29" description = "WRAP msgpack encoding" category = "main" optional = false -python-versions = ">=3.10,<4.0" -files = [ - {file = "polywrap_msgpack-0.1.0a29-py3-none-any.whl", hash = "sha256:898af76cb278630c0e826ffd1052d9cc1fa832082046ebf8d96f9eddacba7ba1"}, - {file = "polywrap_msgpack-0.1.0a29.tar.gz", hash = "sha256:286c93c3bdc97c18c5afcd8be93b286012ffb937d75f15336f6293b632070c89"}, -] +python-versions = "^3.10" +files = [] +develop = true [package.dependencies] -msgpack = ">=1.0.4,<2.0.0" +msgpack = "^1.0.4" + +[package.source] +type = "directory" +url = "../polywrap-msgpack" [[package]] name = "py" @@ -687,14 +693,14 @@ toml = ["tomli (>=1.2.3)"] [[package]] name = "pygments" -version = "2.15.0" +version = "2.15.1" description = "Pygments is a syntax highlighting package written in Python." category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "Pygments-2.15.0-py3-none-any.whl", hash = "sha256:77a3299119af881904cd5ecd1ac6a66214b6e9bed1f2db16993b54adede64094"}, - {file = "Pygments-2.15.0.tar.gz", hash = "sha256:f7e36cffc4c517fbc252861b9a6e4644ca0e5abadf9a113c72d1358ad09b9500"}, + {file = "Pygments-2.15.1-py3-none-any.whl", hash = "sha256:db2db3deb4b4179f399a09054b023b6a586b76499d36965813c71aa8ed7b5fd1"}, + {file = "Pygments-2.15.1.tar.gz", hash = "sha256:8ace4d3c1dd481894b2005f560ead0f9f19ee64fe983366be1a21e171d12775c"}, ] [package.extras] @@ -702,18 +708,18 @@ plugins = ["importlib-metadata"] [[package]] name = "pylint" -version = "2.17.2" +version = "2.17.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" files = [ - {file = "pylint-2.17.2-py3-none-any.whl", hash = "sha256:001cc91366a7df2970941d7e6bbefcbf98694e00102c1f121c531a814ddc2ea8"}, - {file = "pylint-2.17.2.tar.gz", hash = "sha256:1b647da5249e7c279118f657ca28b6aaebb299f86bf92affc632acf199f7adbb"}, + {file = "pylint-2.17.4-py3-none-any.whl", hash = "sha256:7a1145fb08c251bdb5cca11739722ce64a63db479283d10ce718b2460e54123c"}, + {file = "pylint-2.17.4.tar.gz", hash = "sha256:5dcf1d9e19f41f38e4e85d10f511e5b9c35e1aa74251bf95cdd8cb23584e2db1"}, ] [package.dependencies] -astroid = ">=2.15.2,<=2.17.0-dev0" +astroid = ">=2.15.4,<=2.17.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ {version = ">=0.2", markers = "python_version < \"3.11\""}, @@ -731,14 +737,14 @@ testutils = ["gitpython (>3)"] [[package]] name = "pyright" -version = "1.1.303" +version = "1.1.306" description = "Command line wrapper for pyright" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.303-py3-none-any.whl", hash = "sha256:8fe3d122d7e965e2df2cef64e1ceb98cff8200f458e7892d92a4c21ee85689c7"}, - {file = "pyright-1.1.303.tar.gz", hash = "sha256:7daa516424555681e8974b21a95c108c5def791bf5381522b1410026d4da62c1"}, + {file = "pyright-1.1.306-py3-none-any.whl", hash = "sha256:008eb2a29584ae274a154d749cf81476a3073fb562a462eac8d43a753378b9db"}, + {file = "pyright-1.1.306.tar.gz", hash = "sha256:16d5d198be64de497d5f9002000a271176c381e21b977ca5566cf779b643c9ed"}, ] [package.dependencies] @@ -841,14 +847,14 @@ files = [ [[package]] name = "rich" -version = "13.3.4" +version = "13.3.5" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" category = "dev" optional = false python-versions = ">=3.7.0" files = [ - {file = "rich-13.3.4-py3-none-any.whl", hash = "sha256:22b74cae0278fd5086ff44144d3813be1cedc9115bdfabbfefd86400cb88b20a"}, - {file = "rich-13.3.4.tar.gz", hash = "sha256:b5d573e13605423ec80bdd0cd5f8541f7844a0e71a13f74cf454ccb2f490708b"}, + {file = "rich-13.3.5-py3-none-any.whl", hash = "sha256:69cdf53799e63f38b95b9bf9c875f8c90e78dd62b2f00c13a911c7a3b9fa4704"}, + {file = "rich-13.3.5.tar.gz", hash = "sha256:2d11b9b8dd03868f09b4fffadc84a6a8cda574e40dc90821bd845720ebb8e89c"}, ] [package.dependencies] @@ -860,14 +866,14 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "setuptools" -version = "67.6.1" +version = "67.7.2" description = "Easily download, build, install, upgrade, and uninstall Python packages" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "setuptools-67.6.1-py3-none-any.whl", hash = "sha256:e728ca814a823bf7bf60162daf9db95b93d532948c4c0bea762ce62f60189078"}, - {file = "setuptools-67.6.1.tar.gz", hash = "sha256:257de92a9d50a60b8e22abfcbb771571fde0dbf3ec234463212027a4eeecbe9a"}, + {file = "setuptools-67.7.2-py3-none-any.whl", hash = "sha256:23aaf86b85ca52ceb801d32703f12d77517b2556af839621c641fca11287952b"}, + {file = "setuptools-67.7.2.tar.gz", hash = "sha256:f104fa03692a2602fa0fec6c6a9e63b6c8a968de13e17c026957dd1f53d80990"}, ] [package.extras] @@ -952,14 +958,14 @@ files = [ [[package]] name = "tomlkit" -version = "0.11.7" +version = "0.11.8" description = "Style preserving TOML library" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "tomlkit-0.11.7-py3-none-any.whl", hash = "sha256:5325463a7da2ef0c6bbfefb62a3dc883aebe679984709aee32a317907d0a8d3c"}, - {file = "tomlkit-0.11.7.tar.gz", hash = "sha256:f392ef70ad87a672f02519f99967d28a4d3047133e2d1df936511465fbb3791d"}, + {file = "tomlkit-0.11.8-py3-none-any.whl", hash = "sha256:8c726c4c202bdb148667835f68d68780b9a003a9ec34167b6c673b38eff2a171"}, + {file = "tomlkit-0.11.8.tar.gz", hash = "sha256:9330fc7faa1db67b541b28e62018c17d20be733177d290a13b24c62d1614e0c3"}, ] [[package]] @@ -1082,24 +1088,24 @@ files = [ [[package]] name = "virtualenv" -version = "20.21.0" +version = "20.23.0" description = "Virtual Python Environment builder" category = "dev" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.21.0-py3-none-any.whl", hash = "sha256:31712f8f2a17bd06234fa97fdf19609e789dd4e3e4bf108c3da71d710651adbc"}, - {file = "virtualenv-20.21.0.tar.gz", hash = "sha256:f50e3e60f990a0757c9b68333c9fdaa72d7188caa417f96af9e52407831a3b68"}, + {file = "virtualenv-20.23.0-py3-none-any.whl", hash = "sha256:6abec7670e5802a528357fdc75b26b9f57d5d92f29c5462ba0fbe45feacc685e"}, + {file = "virtualenv-20.23.0.tar.gz", hash = "sha256:a85caa554ced0c0afbd0d638e7e2d7b5f92d23478d05d17a76daeac8f279f924"}, ] [package.dependencies] distlib = ">=0.3.6,<1" -filelock = ">=3.4.1,<4" -platformdirs = ">=2.4,<4" +filelock = ">=3.11,<4" +platformdirs = ">=3.2,<4" [package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] -test = ["covdefaults (>=2.2.2)", "coverage (>=7.1)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23)", "pytest (>=7.2.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)"] +docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=22.12)"] +test = ["covdefaults (>=2.3)", "coverage (>=7.2.3)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.3.1)", "pytest-env (>=0.8.1)", "pytest-freezegun (>=0.4.2)", "pytest-mock (>=3.10)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=67.7.1)", "time-machine (>=2.9)"] [[package]] name = "wasmtime" @@ -1208,4 +1214,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "507ae75f08a899cb65f1f36cd87f61a89e272c4ab12bfacd426543cfbca73721" +content-hash = "f27e3708b88017566e97301cc6920071b13eef5851963631b4e981d8dec94f7a" diff --git a/packages/polywrap-wasm/polywrap_wasm/__init__.py b/packages/polywrap-wasm/polywrap_wasm/__init__.py index efc5276d..978aa2e1 100644 --- a/packages/polywrap-wasm/polywrap_wasm/__init__.py +++ b/packages/polywrap-wasm/polywrap_wasm/__init__.py @@ -1,8 +1,5 @@ """This module contains the runtime for executing Wasm wrappers.""" -from .buffer import * from .errors import * -from .exports import * -from .imports import * from .inmemory_file_reader import * from .wasm_package import * from .wasm_wrapper import * diff --git a/packages/polywrap-wasm/polywrap_wasm/buffer.py b/packages/polywrap-wasm/polywrap_wasm/buffer.py index d61f8f65..0593403f 100644 --- a/packages/polywrap-wasm/polywrap_wasm/buffer.py +++ b/packages/polywrap-wasm/polywrap_wasm/buffer.py @@ -20,10 +20,10 @@ def read_bytes( """Read bytes from a memory buffer. Args: - memory_pointer: The pointer to the memory buffer. - memory_length: The length of the memory buffer. - offset: The offset to start reading from. - length: The number of bytes to read. + memory_pointer (BufferPointer): The pointer to the memory buffer. + memory_length (int): The length of the memory buffer. + offset (Optional[int]): The offset to start reading from. + length (Optional[int]): The number of bytes to read. """ result = bytearray(memory_length) buffer = (ctypes.c_ubyte * memory_length).from_buffer(result) @@ -38,10 +38,10 @@ def read_string( """Read a UTF-8 encoded string from a memory buffer. Args: - memory_pointer: The pointer to the memory buffer. - memory_length: The length of the memory buffer. - offset: The offset to start reading from. - length: The number of bytes to read. + memory_pointer (BufferPointer): The pointer to the memory buffer. + memory_length (int): The length of the memory buffer. + offset (int): The offset to start reading from. + length (int): The number of bytes to read. """ value = read_bytes(memory_pointer, memory_length, offset, length) return value.decode("utf-8") @@ -56,10 +56,10 @@ def write_bytes( """Write bytes to a memory buffer. Args: - memory_pointer: The pointer to the memory buffer. - memory_length: The length of the memory buffer. - value: The bytes to write. - value_offset: The offset to start writing to. + memory_pointer (BufferPointer): The pointer to the memory buffer. + memory_length (int): The length of the memory buffer. + value (bytes): The bytes to write. + value_offset (int): The offset to start writing to. """ mem_cpy(memory_pointer, memory_length, bytearray(value), len(value), value_offset) @@ -73,10 +73,10 @@ def write_string( """Write a UTF-8 encoded string to a memory buffer. Args: - memory_pointer: The pointer to the memory buffer. - memory_length: The length of the memory buffer. - value: The string to write. - value_offset: The offset to start writing to. + memory_pointer (BufferPointer): The pointer to the memory buffer. + memory_length (int): The length of the memory buffer. + value (str): The string to write. + value_offset (int): The offset to start writing to. """ value_buffer = value.encode("utf-8") write_bytes( @@ -97,11 +97,11 @@ def mem_cpy( """Copy bytearray from the given value to a memory buffer. Args: - memory_pointer: The pointer to the memory buffer. - memory_length: The length of the memory buffer. - value: The bytearray to copy. - value_length: The length of the bytearray to copy. - value_offset: The offset to start copying from. + memory_pointer (BufferPointer): The pointer to the memory buffer. + memory_length (int): The length of the memory buffer. + value (bytearray): The bytearray to copy. + value_length (int): The length of the bytearray to copy. + value_offset (int): The offset to start copying from. """ current_value = bytearray( read_bytes( diff --git a/packages/polywrap-wasm/polywrap_wasm/constants.py b/packages/polywrap-wasm/polywrap_wasm/constants.py index 7645df03..67ccd309 100644 --- a/packages/polywrap-wasm/polywrap_wasm/constants.py +++ b/packages/polywrap-wasm/polywrap_wasm/constants.py @@ -1,3 +1,9 @@ """This module contains the constants used by polywrap-wasm package.""" + WRAP_MANIFEST_PATH = "wrap.info" +"""Default path to the wrap manifest file.""" + WRAP_MODULE_PATH = "wrap.wasm" +"""Default path to the wrap module file.""" + +__all__ = ["WRAP_MANIFEST_PATH", "WRAP_MODULE_PATH"] diff --git a/packages/polywrap-wasm/polywrap_wasm/errors.py b/packages/polywrap-wasm/polywrap_wasm/errors.py index 31b9bae9..07a6b58f 100644 --- a/packages/polywrap-wasm/polywrap_wasm/errors.py +++ b/packages/polywrap-wasm/polywrap_wasm/errors.py @@ -12,3 +12,10 @@ class WasmExportNotFoundError(WasmError): class WasmMemoryError(WasmError): """Raises when the Wasm memory is not found.""" + + +__all__ = [ + "WasmError", + "WasmExportNotFoundError", + "WasmMemoryError", +] diff --git a/packages/polywrap-wasm/polywrap_wasm/exports.py b/packages/polywrap-wasm/polywrap_wasm/exports.py index 12f13e6d..0e5d0516 100644 --- a/packages/polywrap-wasm/polywrap_wasm/exports.py +++ b/packages/polywrap-wasm/polywrap_wasm/exports.py @@ -7,10 +7,14 @@ class WrapExports: """WrapExports is a class that contains the exports of the Wasm wrapper module. - Attributes: - _instance: The Wasm instance. - _store: The Wasm store. - _wrap_invoke: exported _wrap_invoke Wasm function. + Args: + instance (Instance): The Wasm instance. + store (Store): The Wasm store. + _wrap_invoke (Func): The exported _wrap_invoke Wasm function. + + Raises: + WasmExportNotFoundError: If the _wrap_invoke function is not exported\ + from the Wasm module. """ _instance: Instance @@ -18,15 +22,7 @@ class WrapExports: _wrap_invoke: Func def __init__(self, instance: Instance, store: Store): - """Initialize the WrapExports class. - - Args: - instance: The Wasm instance. - store: The Wasm store. - - Raises: - ExportNotFoundError: if the _wrap_invoke export is not found in the Wasm module. - """ + """Initialize the WrapExports class.""" self._instance = instance self._store = store exports = instance.exports(store) @@ -43,9 +39,9 @@ def __wrap_invoke__( """Call the exported _wrap_invoke Wasm function. Args: - method_length: The length of the method. - args_length: The length of the args. - env_length: The length of the env. + method_length (int): The length of the method. + args_length (int): The length of the args. + env_length (int): The length of the env. Returns: True if the invoke call was successful, False otherwise. diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/abort.py b/packages/polywrap-wasm/polywrap_wasm/imports/abort.py index 0d0d5df0..1b92325a 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/abort.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/abort.py @@ -19,12 +19,12 @@ def wrap_abort( """Abort the Wasm module and raise an exception. Args: - msg_ptr: The pointer to the message string in memory. - msg_len: The length of the message string in memory. - file_ptr: The pointer to the filename string in memory. - file_len: The length of the filename string in memory. - line: The line of the file at where the abort occured. - column: The column of the file at where the abort occured. + msg_ptr (int): The pointer to the message string in memory. + msg_len (int): The length of the message string in memory. + file_ptr (int): The pointer to the filename string in memory. + file_len (int): The length of the filename string in memory. + line (int): The line of the file at where the abort occured. + column (int): The column of the file at where the abort occured. Raises: WasmAbortError: since the Wasm module aborted during invocation. diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/debug.py b/packages/polywrap-wasm/polywrap_wasm/imports/debug.py index 36755e32..1a75b1ea 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/debug.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/debug.py @@ -9,8 +9,8 @@ def wrap_debug_log(self, msg_ptr: int, msg_len: int) -> None: """Print the transmitted message from the Wasm module to host stdout. Args: - ptr: The pointer to the message string in memory. - len: The length of the message string in memory. + msg_ptr (int): The pointer to the message string in memory. + msg_len (int): The length of the message string in memory. """ msg = self.read_string(msg_ptr, msg_len) print(msg) diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/env.py b/packages/polywrap-wasm/polywrap_wasm/imports/env.py index df7d78b7..bf40ea91 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/env.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/env.py @@ -12,7 +12,7 @@ def wrap_load_env(self, ptr: int) -> None: """Write the env in the shared memory at Wasm allocated empty env slot. Args: - ptr: The pointer to the empty env slot in memory. + ptr (int): The pointer to the empty env slot in memory. Raises: WasmAbortError: if the env is not set from the host. diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/get_implementations.py b/packages/polywrap-wasm/polywrap_wasm/imports/get_implementations.py index 3ecd35f6..c8b95c31 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/get_implementations.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/get_implementations.py @@ -15,8 +15,8 @@ def wrap_get_implementations(self, uri_ptr: int, uri_len: int) -> bool: from the invoker and store it in the state. Args: - uri_ptr: The pointer to the interface URI bytes in memory. - uri_len: The length of the interface URI bytes in memory. + uri_ptr (int): The pointer to the interface URI bytes in memory. + uri_len (int): The length of the interface URI bytes in memory. """ uri = Uri.from_str( self.read_string( @@ -24,6 +24,11 @@ def wrap_get_implementations(self, uri_ptr: int, uri_len: int) -> bool: uri_len, ) ) + if not self.invoker: + raise WrapAbortError( + invoke_options=self.state.invoke_options, + message="Expected invoker to be defined got None", + ) try: maybe_implementations = self.invoker.get_implementations(uri=uri) implementations: List[str] = ( @@ -35,8 +40,8 @@ def wrap_get_implementations(self, uri_ptr: int, uri_len: int) -> bool: return len(implementations) > 0 except Exception as err: raise WrapAbortError( - self.state.invoke_options, - f"failed calling invoker.get_implementations({repr(uri)})", + invoke_options=self.state.invoke_options, + message=f"failed calling invoker.get_implementations({repr(uri)})", ) from err def wrap_get_implementations_result_len(self) -> int: @@ -59,6 +64,12 @@ def wrap_get_implementations_result(self, ptr: int) -> None: self.write_bytes(ptr, result) def _get_get_implementations_result(self, export_name: str): + if not self.invoker: + raise WrapAbortError( + invoke_options=self.state.invoke_options, + message="Expected invoker to be defined got None", + ) + if not self.state.get_implementations_result: raise WrapAbortError( self.state.invoke_options, diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/invoke.py b/packages/polywrap-wasm/polywrap_wasm/imports/invoke.py index 045cdf01..1e3f49d3 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/invoke.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/invoke.py @@ -14,8 +14,8 @@ def wrap_invoke_args(self, method_ptr: int, args_ptr: int) -> None: at Wasm allocated empty method and args slots. Args: - method_ptr: The pointer to the empty method name string slot in memory. - args_ptr: The pointer to the empty method args bytes slot in memory. + method_ptr (int): The pointer to the empty method name string slot in memory. + args_ptr (int): The pointer to the empty method args bytes slot in memory. Raises: WasmAbortError: if the method or args are not set from the host. @@ -41,8 +41,8 @@ def wrap_invoke_result(self, ptr: int, length: int) -> None: in the shared memory by the Wasm module in the state. Args: - ptr: The pointer to the result bytes in memory. - length: The length of the result bytes in memory. + ptr (int): The pointer to the result bytes in memory. + length (int): The length of the result bytes in memory. """ result = self.read_bytes( ptr, @@ -55,8 +55,8 @@ def wrap_invoke_error(self, ptr: int, length: int): in the shared memory by the Wasm module in the state. Args: - ptr: The pointer to the error string in memory. - length: The length of the error string in memory. + ptr (int): The pointer to the error string in memory. + length (int): The length of the error string in memory. """ error = self.read_string( ptr, diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/subinvoke.py b/packages/polywrap-wasm/polywrap_wasm/imports/subinvoke.py index 78ecd91f..126c1f85 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/subinvoke.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/subinvoke.py @@ -1,15 +1,10 @@ """This module contains the subinvoke imports for the Wasm module.""" -import asyncio -from concurrent.futures import ThreadPoolExecutor - -from polywrap_core import InvokerOptions, Uri, WrapAbortError +from polywrap_core import Uri, WrapAbortError from polywrap_msgpack import msgpack_encode from ..types import InvokeResult from .types import BaseWrapImports -pool = ThreadPoolExecutor() - class WrapSubinvokeImports(BaseWrapImports): """Defines the subinvoke family of imports for the Wasm module.""" @@ -26,12 +21,12 @@ def wrap_subinvoke( """Subinvoke a function of any wrapper from the Wasm module. Args: - uri_ptr: The pointer to the uri string in memory. - uri_len: The length of the uri string in memory. - method_ptr: The pointer to the method string in memory. - method_len: The length of the method string in memory. - args_ptr: The pointer to the args bytes in memory. - args_len: The length of the args bytes in memory. + uri_ptr (int): The pointer to the uri string in memory. + uri_len (int): The length of the uri string in memory. + method_ptr (int): The pointer to the method string in memory. + method_len (int): The length of the method string in memory. + args_ptr (int): The pointer to the args bytes in memory. + args_len (int): The length of the args bytes in memory. Returns: True if the subinvocation was successful, False otherwise. @@ -42,18 +37,19 @@ def wrap_subinvoke( method = self._get_subinvoke_method(method_ptr, method_len) args = self._get_subinvoke_args(args_ptr, args_len) + if not self.invoker: + raise WrapAbortError( + invoke_options=self.state.invoke_options, + message="Expected invoker to be defined got None", + ) + try: - result = pool.submit( - asyncio.run, - self.invoker.invoke( - InvokerOptions( - uri=uri, - method=method, - args=args, - encode_result=True, - ) - ), - ).result() + result = self.invoker.invoke( + uri=uri, + method=method, + args=args, + encode_result=True, + ) if isinstance(result, bytes): self.state.subinvoke_result = InvokeResult(result=result) return True @@ -72,7 +68,7 @@ def wrap_subinvoke_result(self, ptr: int) -> None: """Write the result of the subinvocation to shared memory. Args: - ptr: The pointer to the empty result bytes slot in memory. + ptr (int): The pointer to the empty result bytes slot in memory. """ result = self._get_subinvoke_result("__wrap_subinvoke_result") self.write_bytes(ptr, result) @@ -88,7 +84,7 @@ def wrap_subinvoke_error(self, ptr: int) -> None: at pointer to the Wasm allocated empty error message slot. Args: - ptr: The pointer to the empty error message slot in memory. + ptr (int): The pointer to the empty error message slot in memory. """ error = self._get_subinvoke_error("__wrap_subinvoke_error") error_message = repr(error) diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/types/base_wrap_imports.py b/packages/polywrap-wasm/polywrap_wasm/imports/types/base_wrap_imports.py index 58d4192e..46e7d9fc 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/types/base_wrap_imports.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/types/base_wrap_imports.py @@ -2,8 +2,9 @@ from __future__ import annotations from abc import ABC +from typing import Optional -from polywrap_core import Invoker, UriPackageOrWrapper +from polywrap_core import Invoker from wasmtime import Memory, Store from ...buffer import read_bytes, read_string, write_bytes, write_string @@ -16,7 +17,7 @@ class BaseWrapImports(ABC): memory: Memory store: Store state: State - invoker: Invoker[UriPackageOrWrapper] + invoker: Optional[Invoker] def read_string(self, ptr: int, length: int) -> str: """Read a UTF-8 encoded string from the memory buffer.""" diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/utils/__init__.py b/packages/polywrap-wasm/polywrap_wasm/imports/utils/__init__.py deleted file mode 100644 index bcc32367..00000000 --- a/packages/polywrap-wasm/polywrap_wasm/imports/utils/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -"""This module contains utility functions for the Wasm imports.""" -from .unsync_invoke import * diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/utils/unsync_invoke.py b/packages/polywrap-wasm/polywrap_wasm/imports/utils/unsync_invoke.py deleted file mode 100644 index 600a5c59..00000000 --- a/packages/polywrap-wasm/polywrap_wasm/imports/utils/unsync_invoke.py +++ /dev/null @@ -1,13 +0,0 @@ -"""This module contains the unsync_invoke function.""" -from typing import Any - -from polywrap_core import Invoker, InvokerOptions, UriPackageOrWrapper -from unsync import Unfuture, unsync - - -@unsync -async def unsync_invoke( - invoker: Invoker[UriPackageOrWrapper], options: InvokerOptions[UriPackageOrWrapper] -) -> Unfuture[Any]: - """Perform an unsync invoke call.""" - return await invoker.invoke(options) diff --git a/packages/polywrap-wasm/polywrap_wasm/imports/wrap_imports.py b/packages/polywrap-wasm/polywrap_wasm/imports/wrap_imports.py index afefacfa..33e9485f 100644 --- a/packages/polywrap-wasm/polywrap_wasm/imports/wrap_imports.py +++ b/packages/polywrap-wasm/polywrap_wasm/imports/wrap_imports.py @@ -3,7 +3,9 @@ # pylint: disable=too-many-ancestors from __future__ import annotations -from polywrap_core import Invoker, UriPackageOrWrapper +from typing import Optional + +from polywrap_core import Invoker from wasmtime import Memory, Store from ..types.state import State @@ -27,11 +29,17 @@ class WrapImports( This class is responsible for providing all the Wasm imports to the Wasm module. + Args: + memory (Memory): The Wasm memory instance. + store (Store): The Wasm store instance. + state (State): The state of the Wasm module. + invoker (Invoker): The invoker instance. + Attributes: - memory: The Wasm memory instance. - store: The Wasm store instance. - state: The state of the Wasm module. - invoker: The invoker instance. + memory (Memory): The Wasm memory instance. + store (Store): The Wasm store instance. + state (State): The state of the Wasm module. + invoker (Invoker): The invoker instance. """ def __init__( @@ -39,16 +47,9 @@ def __init__( memory: Memory, store: Store, state: State, - invoker: Invoker[UriPackageOrWrapper], + invoker: Optional[Invoker], ) -> None: - """Initialize the WrapImports instance. - - Args: - memory: The Wasm memory instance. - store: The Wasm store instance. - state: The state of the Wasm module. - invoker: The invoker instance. - """ + """Initialize the WrapImports instance.""" self.memory = memory self.store = store self.state = state diff --git a/packages/polywrap-wasm/polywrap_wasm/inmemory_file_reader.py b/packages/polywrap-wasm/polywrap_wasm/inmemory_file_reader.py index ea3d466f..24e916b4 100644 --- a/packages/polywrap-wasm/polywrap_wasm/inmemory_file_reader.py +++ b/packages/polywrap-wasm/polywrap_wasm/inmemory_file_reader.py @@ -7,13 +7,14 @@ class InMemoryFileReader(FileReader): - """InMemoryFileReader is an implementation of the IFileReader interface\ + """InMemoryFileReader is an implementation of the FileReader protocol\ that reads files from memory. - Attributes: - _wasm_module: The Wasm module file of the wrapper. - _wasm_manifest: The manifest of the wrapper. - _base_file_reader: The base file reader used to read any files. + Args: + base_file_reader (FileReader): The base file reader\ + used to read any files. + wasm_module (Optional[bytes]): The Wasm module file of the wrapper. + wasm_manifest (Optional[bytes]): The manifest of the wrapper. """ _wasm_manifest: Optional[bytes] @@ -31,7 +32,7 @@ def __init__( self._wasm_manifest = wasm_manifest self._base_file_reader = base_file_reader - async def read_file(self, file_path: str) -> bytes: + def read_file(self, file_path: str) -> bytes: """Read a file from memory. Args: @@ -44,4 +45,7 @@ async def read_file(self, file_path: str) -> bytes: return self._wasm_module if file_path == WRAP_MANIFEST_PATH and self._wasm_manifest: return self._wasm_manifest - return await self._base_file_reader.read_file(file_path=file_path) + return self._base_file_reader.read_file(file_path=file_path) + + +__all__ = ["InMemoryFileReader"] diff --git a/packages/polywrap-wasm/polywrap_wasm/instance.py b/packages/polywrap-wasm/polywrap_wasm/instance.py index 0028cbb1..090113b8 100644 --- a/packages/polywrap-wasm/polywrap_wasm/instance.py +++ b/packages/polywrap-wasm/polywrap_wasm/instance.py @@ -1,5 +1,7 @@ """This module contains the imports of the Wasm wrapper module.""" -from polywrap_core import Invoker, UriPackageOrWrapper +from typing import Optional + +from polywrap_core import Invoker from wasmtime import Instance, Linker, Module, Store from .imports import WrapImports @@ -12,15 +14,15 @@ def create_instance( store: Store, module: bytes, state: State, - invoker: Invoker[UriPackageOrWrapper], + invoker: Optional[Invoker], ) -> Instance: """Create a Wasm instance for a Wasm module. Args: - store: The Wasm store. - module: The Wasm module. - state: The state of the Wasm module. - invoker: The invoker to use for subinvocations. + store (Store): The Wasm store. + module (bytes): The Wasm module. + state (State): The state of the Wasm module. + invoker (Optional[Invoker]): The invoker to use for subinvocations. Returns: Instance: The Wasm instance. diff --git a/packages/polywrap-wasm/polywrap_wasm/linker/wrap_linker.py b/packages/polywrap-wasm/polywrap_wasm/linker/wrap_linker.py index 04da52fd..0b00600f 100644 --- a/packages/polywrap-wasm/polywrap_wasm/linker/wrap_linker.py +++ b/packages/polywrap-wasm/polywrap_wasm/linker/wrap_linker.py @@ -25,18 +25,17 @@ class WrapLinker( This class is responsible for linking all the Wasm imports to the Wasm module. + Args: + linker: The Wasm linker instance. + wrap_imports: The Wasm imports instance. + Attributes: linker: The Wasm linker instance. wrap_imports: The Wasm imports instance. """ def __init__(self, linker: Linker, wrap_imports: WrapImports) -> None: - """Initialize the WrapLinker instance. - - Args: - linker: The Wasm linker instance. - wrap_imports: The Wasm imports instance. - """ + """Initialize the WrapLinker instance.""" self.linker = linker self.wrap_imports = wrap_imports diff --git a/packages/polywrap-wasm/polywrap_wasm/memory.py b/packages/polywrap-wasm/polywrap_wasm/memory.py index 3dd34404..071cc7c9 100644 --- a/packages/polywrap-wasm/polywrap_wasm/memory.py +++ b/packages/polywrap-wasm/polywrap_wasm/memory.py @@ -14,8 +14,8 @@ def create_memory( """Create a host allocated shared memory instance for a Wasm module. Args: - store: The Wasm store. - module: The Wasm module. + store (Store): The Wasm store. + module (bytes): The Wasm module. Raises: WasmMemoryError: if the memory import is not found in the Wasm module. diff --git a/packages/polywrap-wasm/polywrap_wasm/types/__init__.py b/packages/polywrap-wasm/polywrap_wasm/types/__init__.py index 80b0f679..d5fa8523 100644 --- a/packages/polywrap-wasm/polywrap_wasm/types/__init__.py +++ b/packages/polywrap-wasm/polywrap_wasm/types/__init__.py @@ -1,2 +1,4 @@ """This module contains the core types, interfaces, and utilities of polywrap-wasm package.""" +from .invoke_result import * from .state import * +from .wasm_invoke_options import * diff --git a/packages/polywrap-wasm/polywrap_wasm/types/invoke_result.py b/packages/polywrap-wasm/polywrap_wasm/types/invoke_result.py new file mode 100644 index 00000000..10403232 --- /dev/null +++ b/packages/polywrap-wasm/polywrap_wasm/types/invoke_result.py @@ -0,0 +1,25 @@ +"""This module contains the InvokeResult type.""" +from dataclasses import dataclass +from typing import Generic, Optional, TypeVar + +E = TypeVar("E") + + +@dataclass(kw_only=True, slots=True) +class InvokeResult(Generic[E]): + """InvokeResult is a dataclass that holds the result of an invocation. + + Args: + result (Optional[bytes]): The result of an invocation. + error (Optional[E]): The error of an invocation. + """ + + result: Optional[bytes] = None + error: Optional[E] = None + + def __post_init__(self): + """Validate that either result or error is set.""" + if self.result is None and self.error is None: + raise ValueError( + "Either result or error must be set in InvokeResult instance." + ) diff --git a/packages/polywrap-wasm/polywrap_wasm/types/state.py b/packages/polywrap-wasm/polywrap_wasm/types/state.py index d9e18e5d..f253c627 100644 --- a/packages/polywrap-wasm/polywrap_wasm/types/state.py +++ b/packages/polywrap-wasm/polywrap_wasm/types/state.py @@ -1,45 +1,27 @@ """This module contains the State type for holding the state of a Wasm wrapper.""" from dataclasses import dataclass -from typing import Generic, Optional, TypeVar +from typing import Optional -from polywrap_core import InvokeOptions, UriPackageOrWrapper - -E = TypeVar("E") - - -@dataclass(kw_only=True, slots=True) -class InvokeResult(Generic[E]): - """InvokeResult is a dataclass that holds the result of an invocation. - - Attributes: - result: The result of an invocation. - error: The error of an invocation. - """ - - result: Optional[bytes] = None - error: Optional[E] = None - - def __post_init__(self): - """Validate that either result or error is set.""" - if self.result is None and self.error is None: - raise ValueError( - "Either result or error must be set in InvokeResult instance." - ) +from .invoke_result import InvokeResult +from .wasm_invoke_options import WasmInvokeOptions @dataclass(kw_only=True, slots=True) class State: """State is a dataclass that holds the state of a Wasm wrapper. - Attributes: - invoke_options: The options used for the invocation. - invoke_result: The result of an invocation. - subinvoke_result: The result of a subinvocation. - subinvoke_implementation_result: The result of a subinvoke implementation invoke call. - get_implementations_result: The result of a get implementations call. + Args: + invoke_options (WasmInvokeOptions): \ + The options used for the invocation. + invoke_result (Optional[InvokeResult[str]]): \ + The result of an invocation. + subinvoke_result (Optional[InvokeResult[Exception]]): \ + The result of a subinvocation. + get_implementations_result (Optional[bytes]) : \ + The result of a get implementations call. """ - invoke_options: InvokeOptions[UriPackageOrWrapper] + invoke_options: WasmInvokeOptions invoke_result: Optional[InvokeResult[str]] = None subinvoke_result: Optional[InvokeResult[Exception]] = None get_implementations_result: Optional[bytes] = None diff --git a/packages/polywrap-wasm/polywrap_wasm/types/wasm_invoke_options.py b/packages/polywrap-wasm/polywrap_wasm/types/wasm_invoke_options.py new file mode 100644 index 00000000..217f806a --- /dev/null +++ b/packages/polywrap-wasm/polywrap_wasm/types/wasm_invoke_options.py @@ -0,0 +1,26 @@ +"""This module contains the InvokeOptions type for a Wasm wrapper.""" +from dataclasses import dataclass +from typing import Any, Optional + +from polywrap_core import Uri, UriResolutionContext + + +@dataclass(kw_only=True, slots=True) +class WasmInvokeOptions: + """WasmInvokeOptions is a dataclass that holds the options for an invocation. + + Args: + uri (Uri): The URI of the wrapper. + method (str): The method to invoke. + args (Optional[dict[str, Any]]): The arguments to pass to the method. + env (Optional[dict[str, Any]]): The environment variables to set\ + for the invocation. + resolution_context (Optional[UriResolutionContext]): \ + A URI resolution context. + """ + + uri: Uri + method: str + args: Optional[dict[str, Any]] = None + env: Optional[dict[str, Any]] = None + resolution_context: Optional[UriResolutionContext] = None diff --git a/packages/polywrap-wasm/polywrap_wasm/wasm_package.py b/packages/polywrap-wasm/polywrap_wasm/wasm_package.py index 55f43d62..11d7cf0d 100644 --- a/packages/polywrap-wasm/polywrap_wasm/wasm_package.py +++ b/packages/polywrap-wasm/polywrap_wasm/wasm_package.py @@ -1,27 +1,28 @@ """This module contains the WasmPackage type for loading a Wasm package.""" from typing import Optional, Union -from polywrap_core import ( - FileReader, - GetManifestOptions, - UriPackageOrWrapper, - WrapPackage, - Wrapper, +from polywrap_core import FileReader, WrapPackage, Wrapper +from polywrap_manifest import ( + AnyWrapManifest, + DeserializeManifestOptions, + deserialize_wrap_manifest, ) -from polywrap_manifest import AnyWrapManifest, deserialize_wrap_manifest from .constants import WRAP_MANIFEST_PATH, WRAP_MODULE_PATH from .inmemory_file_reader import InMemoryFileReader from .wasm_wrapper import WasmWrapper -class WasmPackage(WrapPackage[UriPackageOrWrapper]): - """WasmPackage is a type that represents a Wasm WRAP package. +class WasmPackage(WrapPackage): + """WasmPackage implements the WRAP package protocol for a Wasm WRAP package. - Attributes: - file_reader: The file reader used to read the package files. - manifest: The manifest of the wrapper. - wasm_module: The Wasm module file of the wrapper. + Args: + file_reader (FileReader): The file reader used to read\ + the package files. + manifest (Optional[Union[bytes, AnyWrapManifest]]): \ + The manifest of the wrapper. + wasm_module (Optional[bytes]): The Wasm module file\ + of the wrapper. """ file_reader: FileReader @@ -43,39 +44,64 @@ def __init__( else file_reader ) - async def get_manifest( - self, options: Optional[GetManifestOptions] = None + def get_manifest( + self, options: Optional[DeserializeManifestOptions] = None ) -> AnyWrapManifest: """Get the manifest of the wrapper. Args: - options: The options to use when getting the manifest. + options (Optional[DeserializeManifestOptions]): The options\ + to use when getting the manifest. + + Returns: + AnyWrapManifest: The manifest of the wrapper. + + Raises: + OSError: If the manifest file could not be read due to system errors. + MsgpackDecodeError: If the encoded manifest fails to decode. + ManifestError: If the manifest is not valid. """ if isinstance(self.manifest, AnyWrapManifest): return self.manifest - encoded_manifest = self.manifest or await self.file_reader.read_file( + encoded_manifest = self.manifest or self.file_reader.read_file( WRAP_MANIFEST_PATH ) manifest = deserialize_wrap_manifest(encoded_manifest, options) return manifest - async def get_wasm_module(self) -> bytes: + def get_wasm_module(self) -> bytes: """Get the Wasm module of the wrapper if it exists or return an error. + Raises: + OSError: If the wasm module file could not be read due to system errors. + Returns: The Wasm module of the wrapper or an error. """ if isinstance(self.wasm_module, bytes): return self.wasm_module - wasm_module = await self.file_reader.read_file(WRAP_MODULE_PATH) + wasm_module = self.file_reader.read_file(WRAP_MODULE_PATH) self.wasm_module = wasm_module return self.wasm_module - async def create_wrapper(self) -> Wrapper[UriPackageOrWrapper]: - """Create a new WasmWrapper instance.""" - wasm_module = await self.get_wasm_module() - wasm_manifest = await self.get_manifest() + def create_wrapper(self) -> Wrapper: + """Create a new WasmWrapper instance. + + Returns: + WasmWrapper: The Wasm wrapper instance. + + Raises: + OSError: If the wasm module or manifest could not be read\ + due to system errors. + MsgpackDecodeError: If the encoded manifest fails to decode. + ManifestError: If the manifest is not valid. + """ + wasm_module = self.get_wasm_module() + wasm_manifest = self.get_manifest() return WasmWrapper(self.file_reader, wasm_module, wasm_manifest) + + +__all__ = ["WasmPackage"] diff --git a/packages/polywrap-wasm/polywrap_wasm/wasm_wrapper.py b/packages/polywrap-wasm/polywrap_wasm/wasm_wrapper.py index 00ad2a12..a886673d 100644 --- a/packages/polywrap-wasm/polywrap_wasm/wasm_wrapper.py +++ b/packages/polywrap-wasm/polywrap_wasm/wasm_wrapper.py @@ -1,14 +1,14 @@ """This module contains the WasmWrapper class for invoking Wasm wrappers.""" +# pylint: disable=too-many-locals from textwrap import dedent -from typing import Union +from typing import Any, Dict, Optional, Union from polywrap_core import ( FileReader, - GetFileOptions, InvocableResult, - InvokeOptions, Invoker, - UriPackageOrWrapper, + Uri, + UriResolutionContext, WrapAbortError, WrapError, Wrapper, @@ -19,16 +19,16 @@ from .exports import WrapExports from .instance import create_instance -from .types.state import State +from .types.state import State, WasmInvokeOptions -class WasmWrapper(Wrapper[UriPackageOrWrapper]): - """WasmWrapper implements the Wrapper interface for Wasm wrappers. +class WasmWrapper(Wrapper): + """WasmWrapper implements the Wrapper protocol for Wasm wrappers. - Attributes: - file_reader: The file reader used to read the wrapper files. - wasm_module: The Wasm module file of the wrapper. - manifest: The manifest of the wrapper. + Args: + file_reader (FileReader): The file reader used to read the wrapper files. + wasm_module (bytes): The Wasm module file of the wrapper. + manifest (AnyWrapManifest): The manifest of the wrapper. """ file_reader: FileReader @@ -51,68 +51,88 @@ def get_wasm_module(self) -> bytes: """Get the Wasm module of the wrapper.""" return self.wasm_module - async def get_file(self, options: GetFileOptions) -> Union[str, bytes]: + def get_file( + self, path: str, encoding: Optional[str] = "utf-8" + ) -> Union[str, bytes]: """Get a file from the wrapper. Args: - options: The options to use when getting the file. + path (str): The path of the file to get. + encoding (Optional[str]): The encoding to use when reading the file. Returns: The file contents as string or bytes according to encoding or an error. """ - data = await self.file_reader.read_file(options.path) - return data.decode(encoding=options.encoding) if options.encoding else data + data = self.file_reader.read_file(path) + return data.decode(encoding=encoding) if encoding else data def create_wasm_instance( - self, - store: Store, - state: State, - invoker: Invoker[UriPackageOrWrapper], - options: InvokeOptions[UriPackageOrWrapper], + self, store: Store, state: State, client: Optional[Invoker] ) -> Instance: """Create a new Wasm instance for the wrapper. Args: - store: The Wasm store to use when creating the instance. - state: The Wasm wrapper state to use when creating the instance. - invoker: The invoker to use when creating the instance. + store (Store): The Wasm store to use when creating the instance. + state (State): The Wasm wrapper state to use when creating the instance. + client (Optional[Invoker]): The client to use when creating the instance. Returns: The Wasm instance of the wrapper Wasm module. """ try: - return create_instance(store, self.wasm_module, state, invoker) + return create_instance(store, self.wasm_module, state, client) except Exception as err: raise WrapAbortError( - options, "Unable to instantiate the wasm module" + state.invoke_options, "Unable to instantiate the wasm module" ) from err - async def invoke( + def invoke( self, - options: InvokeOptions[UriPackageOrWrapper], - invoker: Invoker[UriPackageOrWrapper], + uri: Uri, + method: str, + args: Optional[Dict[str, Any]] = None, + env: Optional[Dict[str, Any]] = None, + resolution_context: Optional[UriResolutionContext] = None, + client: Optional[Invoker] = None, ) -> InvocableResult: """Invoke the wrapper. Args: - options: The options to use when invoking the wrapper. - invoker: The invoker to use when invoking the wrapper. + uri (Uri): The Wasm wrapper uri. + method (str): The method to invoke. + args (Optional[Dict[str, Any]]): The args to invoke with. + env (Optional[Dict[str, Any]]): The env to use when invoking. + resolution_context (Optional[UriResolutionContext]): \ + The URI resolution context to use during invocation. + client (Optional[Invoker]): The invoker to use during invocation. + + Raises: + WrapError: If the invocation uri or method are not defined. + MsgpackError: If failed to encode/decode data to/from msgpack. Returns: The result of the invocation or an error. """ - if not (options.uri and options.method): + if not (uri and method): raise WrapError( dedent( f""" Expected invocation uri and method to be defiened got: - uri: {options.uri} - method: {options.method} + uri: {uri} + method: {method} """ ) ) - state = State(invoke_options=options) + state = State( + invoke_options=WasmInvokeOptions( + uri=uri, + method=method, + args=args, + env=env, + resolution_context=resolution_context, + ) + ) encoded_args = ( state.invoke_options.args @@ -126,7 +146,7 @@ async def invoke( env_length = len(encoded_env) store = Store() - instance = self.create_wasm_instance(store, state, invoker, options) + instance = self.create_wasm_instance(store, state, client) exports = WrapExports(instance, store) result = exports.__wrap_invoke__(method_length, args_length, env_length) @@ -135,6 +155,9 @@ async def invoke( # Note: currently we only return not None result from Wasm module return InvocableResult(result=state.invoke_result.result, encoded=True) raise WrapAbortError( - options, + state.invoke_options, "Expected a result from the Wasm module", ) + + +__all__ = ["WasmWrapper"] diff --git a/packages/polywrap-wasm/pyproject.toml b/packages/polywrap-wasm/pyproject.toml index 92b4d197..9b34e359 100644 --- a/packages/polywrap-wasm/pyproject.toml +++ b/packages/polywrap-wasm/pyproject.toml @@ -14,9 +14,9 @@ python = "^3.10" wasmtime = "^6.0.0" unsync = "^1.4.0" unsync-stubs = "^0.1.2" -polywrap-msgpack = "^0.1.0a29" -polywrap-manifest = "^0.1.0a29" -polywrap-core = "^0.1.0a29" +polywrap-msgpack = {path = "../polywrap-msgpack", develop = true} +polywrap-manifest = {path = "../polywrap-manifest", develop = true} +polywrap-core = {path = "../polywrap-core", develop = true} [tool.poetry.dev-dependencies] pytest = "^7.1.2" pytest-asyncio = "^0.19.0" diff --git a/packages/polywrap-wasm/tests/test_wasm_wrapper.py b/packages/polywrap-wasm/tests/test_wasm_wrapper.py index fe202feb..0ec2b998 100644 --- a/packages/polywrap-wasm/tests/test_wasm_wrapper.py +++ b/packages/polywrap-wasm/tests/test_wasm_wrapper.py @@ -1,22 +1,27 @@ -from typing import Any, List, cast +from typing import Any, cast import pytest from pathlib import Path from polywrap_msgpack import msgpack_decode -from polywrap_core import Uri, InvokeOptions, Invoker, InvokerOptions, UriPackageOrWrapper -from polywrap_wasm import FileReader, WasmPackage, WasmWrapper, WRAP_MODULE_PATH +from polywrap_core import InvokerClient, Uri, Invoker, FileReader +from polywrap_wasm import WasmPackage, WasmWrapper +from polywrap_wasm.constants import WRAP_MODULE_PATH, WRAP_MANIFEST_PATH from polywrap_manifest import deserialize_wrap_manifest -from polywrap_wasm.constants import WRAP_MANIFEST_PATH + @pytest.fixture def mock_invoker(): - class MockInvoker(Invoker[UriPackageOrWrapper]): - async def invoke(self, options: InvokerOptions[UriPackageOrWrapper]) -> Any: + class MockInvoker(InvokerClient): + + def try_resolve_uri(self, *args: Any, **kwargs: Any) -> Any: raise NotImplementedError() - - def get_implementations(self, uri: Uri) -> List[Uri]: + + def invoke(self, *args: Any, **kwargs: Any) -> Any: + raise NotImplementedError() + + def get_implementations(self, *args: Any, **kwargs: Any) -> Any: raise NotImplementedError() return MockInvoker() @@ -39,7 +44,7 @@ def simple_wrap_manifest(): @pytest.fixture def dummy_file_reader(): class DummyFileReader(FileReader): - async def read_file(self, file_path: str) -> bytes: + def read_file(self, *args: Any, **kwargs: Any) -> bytes: raise NotImplementedError() yield DummyFileReader() @@ -48,7 +53,7 @@ async def read_file(self, file_path: str) -> bytes: @pytest.fixture def simple_file_reader(simple_wrap_module: bytes, simple_wrap_manifest: bytes): class DummyFileReader(FileReader): - async def read_file(self, file_path: str) -> bytes: + def read_file(self, file_path: str) -> bytes: if file_path == WRAP_MODULE_PATH: return simple_wrap_module if file_path == WRAP_MANIFEST_PATH: @@ -58,28 +63,41 @@ async def read_file(self, file_path: str) -> bytes: yield DummyFileReader() -@pytest.mark.asyncio -async def test_invoke_with_wrapper( - dummy_file_reader: FileReader, simple_wrap_module: bytes, simple_wrap_manifest: bytes, mock_invoker: Invoker[UriPackageOrWrapper] +def test_invoke_with_wrapper( + dummy_file_reader: FileReader, + simple_wrap_module: bytes, + simple_wrap_manifest: bytes, + mock_invoker: Invoker, ): - wrapper = WasmWrapper(dummy_file_reader, simple_wrap_module, deserialize_wrap_manifest(simple_wrap_manifest)) + wrapper = WasmWrapper( + dummy_file_reader, + simple_wrap_module, + deserialize_wrap_manifest(simple_wrap_manifest), + ) message = "hey" args = {"arg": message} - options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions(uri=Uri.from_str("fs/./build"), method="simpleMethod", args=args) - result = await wrapper.invoke(options, mock_invoker) + result = wrapper.invoke( + uri=Uri.from_str("fs/./build"), + method="simpleMethod", + args=args, + client=mock_invoker, + ) assert result.encoded is True assert msgpack_decode(cast(bytes, result.result)) == message -@pytest.mark.asyncio -async def test_invoke_with_package(simple_file_reader: FileReader, mock_invoker: Invoker[UriPackageOrWrapper]): +def test_invoke_with_package(simple_file_reader: FileReader, mock_invoker: InvokerClient): package = WasmPackage(simple_file_reader) - wrapper = await package.create_wrapper() + wrapper = package.create_wrapper() message = "hey" args = {"arg": message} - options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions(uri=Uri.from_str("fs/./build"), method="simpleMethod", args=args) - result = await wrapper.invoke(options, mock_invoker) + result = wrapper.invoke( + uri=Uri.from_str("fs/./build"), + method="simpleMethod", + args=args, + client=mock_invoker, + ) assert result.encoded is True assert msgpack_decode(cast(bytes, result.result)) == message diff --git a/python-monorepo.code-workspace b/python-monorepo.code-workspace index d6fea917..7c532afe 100644 --- a/python-monorepo.code-workspace +++ b/python-monorepo.code-workspace @@ -39,6 +39,10 @@ { "name": "polywrap-plugin", "path": "packages/polywrap-plugin" + }, + { + "name": "polywrap-test-cases", + "path": "packages/polywrap-test-cases" } ], "settings": {