diff --git a/poetry.lock b/poetry.lock index 616ebec..a463b82 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. [[package]] name = "alabaster" @@ -16,9 +16,10 @@ files = [ name = "anyio" version = "4.10.0" description = "High-level concurrency and networking framework on top of asyncio or Trio" -optional = false +optional = true python-versions = ">=3.9" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "anyio-4.10.0-py3-none-any.whl", hash = "sha256:60e474ac86736bbfd6f210f7a61218939c318f43f9972497381f1c5e930ed3d1"}, {file = "anyio-4.10.0.tar.gz", hash = "sha256:3f3fae35c96039744587aa5b8371e7e8e603c0702999535961dd336026973ba6"}, @@ -37,9 +38,10 @@ trio = ["trio (>=0.26.1)"] name = "asyncio" version = "4.0.0" description = "Deprecated backport of asyncio; use the stdlib package instead" -optional = false +optional = true python-versions = ">=3.4" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "asyncio-4.0.0-py3-none-any.whl", hash = "sha256:c1eddb0659231837046809e68103969b2bef8b0400d59cfa6363f6b5ed8cc88b"}, {file = "asyncio-4.0.0.tar.gz", hash = "sha256:570cd9e50db83bc1629152d4d0b7558d6451bb1bfd5dfc2e935d96fc2f40329b"}, @@ -243,11 +245,11 @@ description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" groups = ["main", "dev"] -markers = "python_version < \"3.11\"" files = [ {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] +markers = {main = "extra == \"asyncio\" and python_version < \"3.11\"", dev = "python_version < \"3.11\""} [package.dependencies] typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} @@ -259,9 +261,10 @@ test = ["pytest (>=6)"] name = "h11" version = "0.16.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" -optional = false +optional = true python-versions = ">=3.8" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, @@ -271,9 +274,10 @@ files = [ name = "httpcore" version = "1.0.9" description = "A minimal low-level HTTP client." -optional = false +optional = true python-versions = ">=3.8" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, @@ -293,9 +297,10 @@ trio = ["trio (>=0.22.0,<1.0)"] name = "httpx" version = "0.28.1" description = "The next generation HTTP client." -optional = false +optional = true python-versions = ">=3.8" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, @@ -348,7 +353,7 @@ description = "Read metadata from Python packages" optional = false python-versions = ">=3.9" groups = ["docs"] -markers = "python_version == \"3.9\"" +markers = "python_version < \"3.10\"" files = [ {file = "importlib_metadata-8.7.0-py3-none-any.whl", hash = "sha256:e5dd1551894c77868a30651cef00984d50e1002d06942a7101d34870c5f02afd"}, {file = "importlib_metadata-8.7.0.tar.gz", hash = "sha256:d13b81ad223b890aa16c5471f2ac3056cf76c5f10f82d6f9292f0b415f389000"}, @@ -950,9 +955,10 @@ type = ["importlib_metadata (>=7.0.2) ; python_version < \"3.10\"", "jaraco.deve name = "sniffio" version = "1.3.1" description = "Sniff out which async library your code is running under" -optional = false +optional = true python-versions = ">=3.7" groups = ["main"] +markers = "extra == \"asyncio\"" files = [ {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, @@ -1248,7 +1254,7 @@ files = [ {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, ] -markers = {main = "python_version < \"3.13\""} +markers = {main = "extra == \"asyncio\" and python_version < \"3.13\""} [[package]] name = "urllib3" @@ -1275,7 +1281,7 @@ description = "Backport of pathlib-compatible object wrapper for zip files" optional = false python-versions = ">=3.9" groups = ["docs"] -markers = "python_version == \"3.9\"" +markers = "python_version < \"3.10\"" files = [ {file = "zipp-3.23.0-py3-none-any.whl", hash = "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e"}, {file = "zipp-3.23.0.tar.gz", hash = "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166"}, @@ -1290,9 +1296,10 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more_it type = ["pytest-mypy"] [extras] +asyncio = ["asyncio", "httpx"] oauth = ["requests-oauthlib"] [metadata] lock-version = "2.1" python-versions = "^3.9" -content-hash = "d06a9aab15cbd7e8efd0f905bef021977399ee8b838a6bc5db8bd208f8854bb0" +content-hash = "d9632835357d5261234d18cb3d025e33fd20a65995d01114d231804dfbd79a3c" diff --git a/pyproject.toml b/pyproject.toml index 7374694..895ff06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,12 @@ requests = ">=2.32" requests-oauthlib = { version = ">=1.2.0", optional = true} certifi = "^2024.7.4" urllib3 = ">=2.5" -asyncio = "^4.0.0" -httpx = "^0.28.1" +asyncio = { version = "^4.0.0", optional = true } +httpx = { version = "^0.28.1", optional = true } [tool.poetry.extras] oauth = ["requests-oauthlib"] +asyncio = ["asyncio", "httpx"] [tool.poetry.group.dev.dependencies] requests-oauthlib = ">=1.2.0" diff --git a/pysnc/asyncio/__init__.py b/pysnc/asyncio/__init__.py index 7ef948c..a7ab30f 100644 --- a/pysnc/asyncio/__init__.py +++ b/pysnc/asyncio/__init__.py @@ -2,10 +2,14 @@ Asynchronous implementation of the pysnc package using httpx.AsyncClient. """ -from .client import AsyncTableAPI, AsyncBatchAPI, AsyncAttachmentAPI, AsyncServiceNowClient -from .record import AsyncGlideRecord -from .attachment import AsyncAttachment -from .auth import AsyncServiceNowFlow, AsyncServiceNowPasswordGrantFlow, AsyncServiceNowJWTAuth +try: + from .client import AsyncTableAPI, AsyncBatchAPI, AsyncAttachmentAPI, AsyncServiceNowClient + from .record import AsyncGlideRecord + from .attachment import AsyncAttachment + from .auth import AsyncServiceNowFlow, AsyncServiceNowPasswordGrantFlow, AsyncServiceNowJWTAuth +except ImportError: + raise ImportError("httpx is required for the asyncio module. Please install pysnc with the 'asyncio' extra.") + __all__ = [ 'AsyncServiceNowClient',