diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b47733a9..c5d3db65 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ $ pip install -r requirements-dev.lock ## Modifying/Adding code Most of the SDK is generated code, and any modified code will be overridden on the next generation. The -`src/openlayer/lib/` and `examples/` directories are exceptions and will never be overridden. +`src/openlayer_test/lib/` and `examples/` directories are exceptions and will never be overridden. ## Adding and running examples diff --git a/README.md b/README.md index 108252df..39732e67 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Openlayer Python API library -[![PyPI version](https://img.shields.io/pypi/v/openlayer.svg)](https://pypi.org/project/openlayer/) +[![PyPI version](https://img.shields.io/pypi/v/openlayer_test.svg)](https://pypi.org/project/openlayer_test/) The Openlayer Python library provides convenient access to the Openlayer REST API from any Python 3.7+ application. The library includes type definitions for all request params and response fields, @@ -16,7 +16,7 @@ The REST API documentation can be found [on openlayer.com](https://openlayer.com ```sh # install from PyPI -pip install --pre openlayer +pip install --pre openlayer_test ``` ## Usage @@ -25,7 +25,7 @@ The full API of this library can be found in [api.md](api.md). ```python import os -from openlayer import Openlayer +from openlayer_test import Openlayer client = Openlayer( # This is the default and can be omitted @@ -66,7 +66,7 @@ Simply import `AsyncOpenlayer` instead of `Openlayer` and use `await` with each ```python import os import asyncio -from openlayer import AsyncOpenlayer +from openlayer_test import AsyncOpenlayer client = AsyncOpenlayer( # This is the default and can be omitted @@ -113,16 +113,16 @@ Typed requests and responses provide autocomplete and documentation within your ## Handling errors -When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openlayer.APIConnectionError` is raised. +When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `openlayer_test.APIConnectionError` is raised. When the API returns a non-success status code (that is, 4xx or 5xx -response), a subclass of `openlayer.APIStatusError` is raised, containing `status_code` and `response` properties. +response), a subclass of `openlayer_test.APIStatusError` is raised, containing `status_code` and `response` properties. -All errors inherit from `openlayer.APIError`. +All errors inherit from `openlayer_test.APIError`. ```python -import openlayer -from openlayer import Openlayer +import openlayer_test +from openlayer_test import Openlayer client = Openlayer() @@ -146,12 +146,12 @@ try: } ], ) -except openlayer.APIConnectionError as e: +except openlayer_test.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. -except openlayer.RateLimitError as e: +except openlayer_test.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") -except openlayer.APIStatusError as e: +except openlayer_test.APIStatusError as e: print("Another non-200-range status code was received") print(e.status_code) print(e.response) @@ -179,7 +179,7 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ You can use the `max_retries` option to configure or disable retry settings: ```python -from openlayer import Openlayer +from openlayer_test import Openlayer # Configure the default for all requests: client = Openlayer( @@ -215,7 +215,7 @@ By default requests time out after 1 minute. You can configure this with a `time which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: ```python -from openlayer import Openlayer +from openlayer_test import Openlayer # Configure the default for all requests: client = Openlayer( @@ -283,7 +283,7 @@ if response.my_field is None: The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g., ```py -from openlayer import Openlayer +from openlayer_test import Openlayer client = Openlayer() response = client.inference_pipelines.data.with_raw_response.stream( @@ -309,9 +309,9 @@ data = response.parse() # get the object that `inference_pipelines.data.stream( print(data.success) ``` -These methods return an [`APIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer/_response.py) object. +These methods return an [`APIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer_test/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. +The async client returns an [`AsyncAPIResponse`](https://github.com/openlayer-ai/openlayer-python/tree/main/src/openlayer_test/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -391,7 +391,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c - Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality ```python -from openlayer import Openlayer, DefaultHttpxClient +from openlayer_test import Openlayer, DefaultHttpxClient client = Openlayer( # Or use the `OPENLAYER_BASE_URL` env var diff --git a/api.md b/api.md index 6a11c669..7f8e63cd 100644 --- a/api.md +++ b/api.md @@ -3,36 +3,36 @@ Types: ```python -from openlayer.types import ProjectListResponse +from openlayer_test.types import ProjectListResponse ``` Methods: -- client.projects.list(\*\*params) -> ProjectListResponse +- client.projects.list(\*\*params) -> ProjectListResponse ## Commits Types: ```python -from openlayer.types.projects import CommitListResponse +from openlayer_test.types.projects import CommitListResponse ``` Methods: -- client.projects.commits.list(id, \*\*params) -> CommitListResponse +- client.projects.commits.list(id, \*\*params) -> CommitListResponse ## InferencePipelines Types: ```python -from openlayer.types.projects import InferencePipelineListResponse +from openlayer_test.types.projects import InferencePipelineListResponse ``` Methods: -- client.projects.inference_pipelines.list(id, \*\*params) -> InferencePipelineListResponse +- client.projects.inference_pipelines.list(id, \*\*params) -> InferencePipelineListResponse # Commits @@ -41,12 +41,12 @@ Methods: Types: ```python -from openlayer.types.commits import TestResultListResponse +from openlayer_test.types.commits import TestResultListResponse ``` Methods: -- client.commits.test_results.list(id, \*\*params) -> TestResultListResponse +- client.commits.test_results.list(id, \*\*params) -> TestResultListResponse # InferencePipelines @@ -55,21 +55,21 @@ Methods: Types: ```python -from openlayer.types.inference_pipelines import DataStreamResponse +from openlayer_test.types.inference_pipelines import DataStreamResponse ``` Methods: -- client.inference_pipelines.data.stream(id, \*\*params) -> DataStreamResponse +- client.inference_pipelines.data.stream(id, \*\*params) -> DataStreamResponse ## TestResults Types: ```python -from openlayer.types.inference_pipelines import TestResultListResponse +from openlayer_test.types.inference_pipelines import TestResultListResponse ``` Methods: -- client.inference_pipelines.test_results.list(id, \*\*params) -> TestResultListResponse +- client.inference_pipelines.test_results.list(id, \*\*params) -> TestResultListResponse diff --git a/pyproject.toml b/pyproject.toml index 53afd26b..0daaeeed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "openlayer" +name = "openlayer_test" version = "0.1.0-alpha.5" description = "The official Python library for the openlayer API" dynamic = ["readme"] @@ -84,7 +84,7 @@ typecheck = { chain = [ "typecheck:mypy" ]} "typecheck:pyright" = "pyright" -"typecheck:verify-types" = "pyright --verifytypes openlayer --ignoreexternal" +"typecheck:verify-types" = "pyright --verifytypes openlayer_test --ignoreexternal" "typecheck:mypy" = "mypy ." [build-system] @@ -97,7 +97,7 @@ include = [ ] [tool.hatch.build.targets.wheel] -packages = ["src/openlayer"] +packages = ["src/openlayer_test"] [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/markdown" @@ -189,7 +189,7 @@ length-sort = true length-sort-straight = true combine-as-imports = true extra-standard-library = ["typing_extensions"] -known-first-party = ["openlayer", "tests"] +known-first-party = ["openlayer_test", "tests"] [tool.ruff.per-file-ignores] "bin/**.py" = ["T201", "T203"] diff --git a/release-please-config.json b/release-please-config.json index 83a417a7..df7eb466 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -61,6 +61,6 @@ ], "release-type": "python", "extra-files": [ - "src/openlayer/_version.py" + "src/openlayer_test/_version.py" ] } \ No newline at end of file diff --git a/requirements-dev.lock b/requirements-dev.lock index 26451e23..6a8433ee 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,7 +12,7 @@ annotated-types==0.6.0 # via pydantic anyio==4.1.0 # via httpx - # via openlayer + # via openlayer-test argcomplete==3.1.2 # via nox attrs==23.1.0 @@ -26,7 +26,7 @@ dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv distro==1.8.0 - # via openlayer + # via openlayer-test exceptiongroup==1.1.3 # via anyio filelock==3.12.4 @@ -36,7 +36,7 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via openlayer + # via openlayer-test # via respx idna==3.4 # via anyio @@ -60,7 +60,7 @@ pluggy==1.3.0 py==1.11.0 # via pytest pydantic==2.7.1 - # via openlayer + # via openlayer-test pydantic-core==2.18.2 # via pydantic pyright==1.1.364 @@ -80,14 +80,14 @@ six==1.16.0 sniffio==1.3.0 # via anyio # via httpx - # via openlayer + # via openlayer-test time-machine==2.9.0 tomli==2.0.1 # via mypy # via pytest typing-extensions==4.8.0 # via mypy - # via openlayer + # via openlayer-test # via pydantic # via pydantic-core virtualenv==20.24.5 diff --git a/requirements.lock b/requirements.lock index 04f85d2e..4e5a36e4 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,12 +12,12 @@ annotated-types==0.6.0 # via pydantic anyio==4.1.0 # via httpx - # via openlayer + # via openlayer-test certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via openlayer + # via openlayer-test exceptiongroup==1.1.3 # via anyio h11==0.14.0 @@ -25,19 +25,19 @@ h11==0.14.0 httpcore==1.0.2 # via httpx httpx==0.25.2 - # via openlayer + # via openlayer-test idna==3.4 # via anyio # via httpx pydantic==2.7.1 - # via openlayer + # via openlayer-test pydantic-core==2.18.2 # via pydantic sniffio==1.3.0 # via anyio # via httpx - # via openlayer + # via openlayer-test typing-extensions==4.8.0 - # via openlayer + # via openlayer-test # via pydantic # via pydantic-core diff --git a/scripts/lint b/scripts/lint index 763eb089..a39440f9 100755 --- a/scripts/lint +++ b/scripts/lint @@ -8,5 +8,5 @@ echo "==> Running lints" rye run lint echo "==> Making sure it imports" -rye run python -c 'import openlayer' +rye run python -c 'import openlayer_test' diff --git a/src/openlayer/__init__.py b/src/openlayer_test/__init__.py similarity index 94% rename from src/openlayer/__init__.py rename to src/openlayer_test/__init__.py index e2047e6c..c170a096 100644 --- a/src/openlayer/__init__.py +++ b/src/openlayer_test/__init__.py @@ -82,12 +82,12 @@ # Update the __module__ attribute for exported symbols so that # error messages point to this module instead of the module # it was originally defined in, e.g. -# openlayer._exceptions.NotFoundError -> openlayer.NotFoundError +# openlayer_test._exceptions.NotFoundError -> openlayer_test.NotFoundError __locals = locals() for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "openlayer" + __locals[__name].__module__ = "openlayer_test" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass diff --git a/src/openlayer/_base_client.py b/src/openlayer_test/_base_client.py similarity index 99% rename from src/openlayer/_base_client.py rename to src/openlayer_test/_base_client.py index e56f38d8..9bce9395 100644 --- a/src/openlayer/_base_client.py +++ b/src/openlayer_test/_base_client.py @@ -361,7 +361,7 @@ def __init__( if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] raise TypeError( - "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `openlayer.DEFAULT_MAX_RETRIES`" + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `openlayer_test.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: diff --git a/src/openlayer/_client.py b/src/openlayer_test/_client.py similarity index 100% rename from src/openlayer/_client.py rename to src/openlayer_test/_client.py diff --git a/src/openlayer/_compat.py b/src/openlayer_test/_compat.py similarity index 100% rename from src/openlayer/_compat.py rename to src/openlayer_test/_compat.py diff --git a/src/openlayer/_constants.py b/src/openlayer_test/_constants.py similarity index 100% rename from src/openlayer/_constants.py rename to src/openlayer_test/_constants.py diff --git a/src/openlayer/_exceptions.py b/src/openlayer_test/_exceptions.py similarity index 100% rename from src/openlayer/_exceptions.py rename to src/openlayer_test/_exceptions.py diff --git a/src/openlayer/_files.py b/src/openlayer_test/_files.py similarity index 100% rename from src/openlayer/_files.py rename to src/openlayer_test/_files.py diff --git a/src/openlayer/_models.py b/src/openlayer_test/_models.py similarity index 100% rename from src/openlayer/_models.py rename to src/openlayer_test/_models.py diff --git a/src/openlayer/_qs.py b/src/openlayer_test/_qs.py similarity index 100% rename from src/openlayer/_qs.py rename to src/openlayer_test/_qs.py diff --git a/src/openlayer/_resource.py b/src/openlayer_test/_resource.py similarity index 100% rename from src/openlayer/_resource.py rename to src/openlayer_test/_resource.py diff --git a/src/openlayer/_response.py b/src/openlayer_test/_response.py similarity index 98% rename from src/openlayer/_response.py rename to src/openlayer_test/_response.py index 39a5a83e..fd126ffb 100644 --- a/src/openlayer/_response.py +++ b/src/openlayer_test/_response.py @@ -203,7 +203,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: return cast(R, response) if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): - raise TypeError("Pydantic models must subclass our base model type, e.g. `from openlayer import BaseModel`") + raise TypeError( + "Pydantic models must subclass our base model type, e.g. `from openlayer_test import BaseModel`" + ) if ( cast_to is not object @@ -271,7 +273,7 @@ def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from openlayer import BaseModel + from openlayer_test import BaseModel class MyModel(BaseModel): @@ -375,7 +377,7 @@ async def parse(self, *, to: type[_T] | None = None) -> R | _T: the `to` argument, e.g. ```py - from openlayer import BaseModel + from openlayer_test import BaseModel class MyModel(BaseModel): @@ -546,7 +548,7 @@ async def stream_to_file( class MissingStreamClassError(TypeError): def __init__(self) -> None: super().__init__( - "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `openlayer._streaming` for reference", + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `openlayer_test._streaming` for reference", ) diff --git a/src/openlayer/_streaming.py b/src/openlayer_test/_streaming.py similarity index 100% rename from src/openlayer/_streaming.py rename to src/openlayer_test/_streaming.py diff --git a/src/openlayer/_types.py b/src/openlayer_test/_types.py similarity index 99% rename from src/openlayer/_types.py rename to src/openlayer_test/_types.py index 1dee84b9..f95d47f8 100644 --- a/src/openlayer/_types.py +++ b/src/openlayer_test/_types.py @@ -81,7 +81,7 @@ # This unfortunately means that you will either have # to import this type and pass it explicitly: # -# from openlayer import NoneType +# from openlayer_test import NoneType # client.get('/foo', cast_to=NoneType) # # or build it yourself: diff --git a/src/openlayer/_utils/__init__.py b/src/openlayer_test/_utils/__init__.py similarity index 100% rename from src/openlayer/_utils/__init__.py rename to src/openlayer_test/_utils/__init__.py diff --git a/src/openlayer/_utils/_logs.py b/src/openlayer_test/_utils/_logs.py similarity index 75% rename from src/openlayer/_utils/_logs.py rename to src/openlayer_test/_utils/_logs.py index 84e87cf4..c1021524 100644 --- a/src/openlayer/_utils/_logs.py +++ b/src/openlayer_test/_utils/_logs.py @@ -1,12 +1,12 @@ import os import logging -logger: logging.Logger = logging.getLogger("openlayer") +logger: logging.Logger = logging.getLogger("openlayer_test") httpx_logger: logging.Logger = logging.getLogger("httpx") def _basic_config() -> None: - # e.g. [2023-10-05 14:12:26 - openlayer._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" + # e.g. [2023-10-05 14:12:26 - openlayer_test._base_client:818 - DEBUG] HTTP Request: POST http://127.0.0.1:4010/foo/bar "200 OK" logging.basicConfig( format="[%(asctime)s - %(name)s:%(lineno)d - %(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S", diff --git a/src/openlayer/_utils/_proxy.py b/src/openlayer_test/_utils/_proxy.py similarity index 100% rename from src/openlayer/_utils/_proxy.py rename to src/openlayer_test/_utils/_proxy.py diff --git a/src/openlayer/_utils/_streams.py b/src/openlayer_test/_utils/_streams.py similarity index 100% rename from src/openlayer/_utils/_streams.py rename to src/openlayer_test/_utils/_streams.py diff --git a/src/openlayer/_utils/_sync.py b/src/openlayer_test/_utils/_sync.py similarity index 100% rename from src/openlayer/_utils/_sync.py rename to src/openlayer_test/_utils/_sync.py diff --git a/src/openlayer/_utils/_transform.py b/src/openlayer_test/_utils/_transform.py similarity index 100% rename from src/openlayer/_utils/_transform.py rename to src/openlayer_test/_utils/_transform.py diff --git a/src/openlayer/_utils/_typing.py b/src/openlayer_test/_utils/_typing.py similarity index 100% rename from src/openlayer/_utils/_typing.py rename to src/openlayer_test/_utils/_typing.py diff --git a/src/openlayer/_utils/_utils.py b/src/openlayer_test/_utils/_utils.py similarity index 100% rename from src/openlayer/_utils/_utils.py rename to src/openlayer_test/_utils/_utils.py diff --git a/src/openlayer/_version.py b/src/openlayer_test/_version.py similarity index 83% rename from src/openlayer/_version.py rename to src/openlayer_test/_version.py index b40509ff..a2a6c9af 100644 --- a/src/openlayer/_version.py +++ b/src/openlayer_test/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -__title__ = "openlayer" +__title__ = "openlayer_test" __version__ = "0.1.0-alpha.5" # x-release-please-version diff --git a/src/openlayer_test/lib/.keep b/src/openlayer_test/lib/.keep new file mode 100644 index 00000000..5e2c99fd --- /dev/null +++ b/src/openlayer_test/lib/.keep @@ -0,0 +1,4 @@ +File generated from our OpenAPI spec by Stainless. + +This directory can be used to store custom files to expand the SDK. +It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/openlayer/py.typed b/src/openlayer_test/py.typed similarity index 100% rename from src/openlayer/py.typed rename to src/openlayer_test/py.typed diff --git a/src/openlayer/resources/__init__.py b/src/openlayer_test/resources/__init__.py similarity index 100% rename from src/openlayer/resources/__init__.py rename to src/openlayer_test/resources/__init__.py diff --git a/src/openlayer/resources/commits/__init__.py b/src/openlayer_test/resources/commits/__init__.py similarity index 100% rename from src/openlayer/resources/commits/__init__.py rename to src/openlayer_test/resources/commits/__init__.py diff --git a/src/openlayer/resources/commits/commits.py b/src/openlayer_test/resources/commits/commits.py similarity index 100% rename from src/openlayer/resources/commits/commits.py rename to src/openlayer_test/resources/commits/commits.py diff --git a/src/openlayer/resources/commits/test_results.py b/src/openlayer_test/resources/commits/test_results.py similarity index 100% rename from src/openlayer/resources/commits/test_results.py rename to src/openlayer_test/resources/commits/test_results.py diff --git a/src/openlayer/resources/inference_pipelines/__init__.py b/src/openlayer_test/resources/inference_pipelines/__init__.py similarity index 100% rename from src/openlayer/resources/inference_pipelines/__init__.py rename to src/openlayer_test/resources/inference_pipelines/__init__.py diff --git a/src/openlayer/resources/inference_pipelines/data.py b/src/openlayer_test/resources/inference_pipelines/data.py similarity index 100% rename from src/openlayer/resources/inference_pipelines/data.py rename to src/openlayer_test/resources/inference_pipelines/data.py diff --git a/src/openlayer/resources/inference_pipelines/inference_pipelines.py b/src/openlayer_test/resources/inference_pipelines/inference_pipelines.py similarity index 100% rename from src/openlayer/resources/inference_pipelines/inference_pipelines.py rename to src/openlayer_test/resources/inference_pipelines/inference_pipelines.py diff --git a/src/openlayer/resources/inference_pipelines/test_results.py b/src/openlayer_test/resources/inference_pipelines/test_results.py similarity index 100% rename from src/openlayer/resources/inference_pipelines/test_results.py rename to src/openlayer_test/resources/inference_pipelines/test_results.py diff --git a/src/openlayer/resources/projects/__init__.py b/src/openlayer_test/resources/projects/__init__.py similarity index 100% rename from src/openlayer/resources/projects/__init__.py rename to src/openlayer_test/resources/projects/__init__.py diff --git a/src/openlayer/resources/projects/commits.py b/src/openlayer_test/resources/projects/commits.py similarity index 100% rename from src/openlayer/resources/projects/commits.py rename to src/openlayer_test/resources/projects/commits.py diff --git a/src/openlayer/resources/projects/inference_pipelines.py b/src/openlayer_test/resources/projects/inference_pipelines.py similarity index 100% rename from src/openlayer/resources/projects/inference_pipelines.py rename to src/openlayer_test/resources/projects/inference_pipelines.py diff --git a/src/openlayer/resources/projects/projects.py b/src/openlayer_test/resources/projects/projects.py similarity index 100% rename from src/openlayer/resources/projects/projects.py rename to src/openlayer_test/resources/projects/projects.py diff --git a/src/openlayer/types/__init__.py b/src/openlayer_test/types/__init__.py similarity index 100% rename from src/openlayer/types/__init__.py rename to src/openlayer_test/types/__init__.py diff --git a/src/openlayer/types/commits/__init__.py b/src/openlayer_test/types/commits/__init__.py similarity index 100% rename from src/openlayer/types/commits/__init__.py rename to src/openlayer_test/types/commits/__init__.py diff --git a/src/openlayer/types/commits/test_result_list_params.py b/src/openlayer_test/types/commits/test_result_list_params.py similarity index 100% rename from src/openlayer/types/commits/test_result_list_params.py rename to src/openlayer_test/types/commits/test_result_list_params.py diff --git a/src/openlayer/types/commits/test_result_list_response.py b/src/openlayer_test/types/commits/test_result_list_response.py similarity index 100% rename from src/openlayer/types/commits/test_result_list_response.py rename to src/openlayer_test/types/commits/test_result_list_response.py diff --git a/src/openlayer/types/inference_pipelines/__init__.py b/src/openlayer_test/types/inference_pipelines/__init__.py similarity index 100% rename from src/openlayer/types/inference_pipelines/__init__.py rename to src/openlayer_test/types/inference_pipelines/__init__.py diff --git a/src/openlayer/types/inference_pipelines/data_stream_params.py b/src/openlayer_test/types/inference_pipelines/data_stream_params.py similarity index 100% rename from src/openlayer/types/inference_pipelines/data_stream_params.py rename to src/openlayer_test/types/inference_pipelines/data_stream_params.py diff --git a/src/openlayer/types/inference_pipelines/data_stream_response.py b/src/openlayer_test/types/inference_pipelines/data_stream_response.py similarity index 100% rename from src/openlayer/types/inference_pipelines/data_stream_response.py rename to src/openlayer_test/types/inference_pipelines/data_stream_response.py diff --git a/src/openlayer/types/inference_pipelines/test_result_list_params.py b/src/openlayer_test/types/inference_pipelines/test_result_list_params.py similarity index 100% rename from src/openlayer/types/inference_pipelines/test_result_list_params.py rename to src/openlayer_test/types/inference_pipelines/test_result_list_params.py diff --git a/src/openlayer/types/inference_pipelines/test_result_list_response.py b/src/openlayer_test/types/inference_pipelines/test_result_list_response.py similarity index 100% rename from src/openlayer/types/inference_pipelines/test_result_list_response.py rename to src/openlayer_test/types/inference_pipelines/test_result_list_response.py diff --git a/src/openlayer/types/project_list_params.py b/src/openlayer_test/types/project_list_params.py similarity index 100% rename from src/openlayer/types/project_list_params.py rename to src/openlayer_test/types/project_list_params.py diff --git a/src/openlayer/types/project_list_response.py b/src/openlayer_test/types/project_list_response.py similarity index 100% rename from src/openlayer/types/project_list_response.py rename to src/openlayer_test/types/project_list_response.py diff --git a/src/openlayer/types/projects/__init__.py b/src/openlayer_test/types/projects/__init__.py similarity index 100% rename from src/openlayer/types/projects/__init__.py rename to src/openlayer_test/types/projects/__init__.py diff --git a/src/openlayer/types/projects/commit_list_params.py b/src/openlayer_test/types/projects/commit_list_params.py similarity index 100% rename from src/openlayer/types/projects/commit_list_params.py rename to src/openlayer_test/types/projects/commit_list_params.py diff --git a/src/openlayer/types/projects/commit_list_response.py b/src/openlayer_test/types/projects/commit_list_response.py similarity index 100% rename from src/openlayer/types/projects/commit_list_response.py rename to src/openlayer_test/types/projects/commit_list_response.py diff --git a/src/openlayer/types/projects/inference_pipeline_list_params.py b/src/openlayer_test/types/projects/inference_pipeline_list_params.py similarity index 100% rename from src/openlayer/types/projects/inference_pipeline_list_params.py rename to src/openlayer_test/types/projects/inference_pipeline_list_params.py diff --git a/src/openlayer/types/projects/inference_pipeline_list_response.py b/src/openlayer_test/types/projects/inference_pipeline_list_response.py similarity index 100% rename from src/openlayer/types/projects/inference_pipeline_list_response.py rename to src/openlayer_test/types/projects/inference_pipeline_list_response.py diff --git a/tests/api_resources/commits/test_test_results.py b/tests/api_resources/commits/test_test_results.py index e22aff80..348f578b 100644 --- a/tests/api_resources/commits/test_test_results.py +++ b/tests/api_resources/commits/test_test_results.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.commits import TestResultListResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types.commits import TestResultListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/inference_pipelines/test_data.py b/tests/api_resources/inference_pipelines/test_data.py index 1e070c1b..79595a16 100644 --- a/tests/api_resources/inference_pipelines/test_data.py +++ b/tests/api_resources/inference_pipelines/test_data.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.inference_pipelines import DataStreamResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types.inference_pipelines import DataStreamResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/inference_pipelines/test_test_results.py b/tests/api_resources/inference_pipelines/test_test_results.py index 2098230a..c8d0bad5 100644 --- a/tests/api_resources/inference_pipelines/test_test_results.py +++ b/tests/api_resources/inference_pipelines/test_test_results.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.inference_pipelines import TestResultListResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types.inference_pipelines import TestResultListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/projects/test_commits.py b/tests/api_resources/projects/test_commits.py index ab353674..9bf71a5f 100644 --- a/tests/api_resources/projects/test_commits.py +++ b/tests/api_resources/projects/test_commits.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.projects import CommitListResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types.projects import CommitListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/projects/test_inference_pipelines.py b/tests/api_resources/projects/test_inference_pipelines.py index c676d606..c9cf3001 100644 --- a/tests/api_resources/projects/test_inference_pipelines.py +++ b/tests/api_resources/projects/test_inference_pipelines.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types.projects import InferencePipelineListResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types.projects import InferencePipelineListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_projects.py b/tests/api_resources/test_projects.py index a955b36d..e294f773 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -7,9 +7,9 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer from tests.utils import assert_matches_type -from openlayer.types import ProjectListResponse +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test.types import ProjectListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/conftest.py b/tests/conftest.py index 0857c182..0cd5e433 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,14 +7,14 @@ import pytest -from openlayer import Openlayer, AsyncOpenlayer +from openlayer_test import Openlayer, AsyncOpenlayer if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") -logging.getLogger("openlayer").setLevel(logging.DEBUG) +logging.getLogger("openlayer_test").setLevel(logging.DEBUG) @pytest.fixture(scope="session") diff --git a/tests/test_client.py b/tests/test_client.py index bc8b3c26..94aa7ca3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -16,12 +16,12 @@ from respx import MockRouter from pydantic import ValidationError -from openlayer import Openlayer, AsyncOpenlayer, APIResponseValidationError -from openlayer._types import Omit -from openlayer._models import BaseModel, FinalRequestOptions -from openlayer._constants import RAW_RESPONSE_HEADER -from openlayer._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError -from openlayer._base_client import ( +from openlayer_test import Openlayer, AsyncOpenlayer, APIResponseValidationError +from openlayer_test._types import Omit +from openlayer_test._models import BaseModel, FinalRequestOptions +from openlayer_test._constants import RAW_RESPONSE_HEADER +from openlayer_test._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError +from openlayer_test._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, @@ -225,10 +225,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "openlayer/_legacy_response.py", - "openlayer/_response.py", + "openlayer_test/_legacy_response.py", + "openlayer_test/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "openlayer/_compat.py", + "openlayer_test/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -711,7 +711,7 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("openlayer._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("openlayer_test._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/inference-pipelines/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/data-stream").mock( @@ -748,7 +748,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No assert _get_open_connections(self.client) == 0 - @mock.patch("openlayer._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("openlayer_test._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/inference-pipelines/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/data-stream").mock( @@ -961,10 +961,10 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic # to_raw_response_wrapper leaks through the @functools.wraps() decorator. # # removing the decorator fixes the leak for reasons we don't understand. - "openlayer/_legacy_response.py", - "openlayer/_response.py", + "openlayer_test/_legacy_response.py", + "openlayer_test/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "openlayer/_compat.py", + "openlayer_test/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -1461,7 +1461,7 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("openlayer._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("openlayer_test._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/inference-pipelines/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/data-stream").mock( @@ -1498,7 +1498,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) assert _get_open_connections(self.client) == 0 - @mock.patch("openlayer._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("openlayer_test._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: respx_mock.post("/inference-pipelines/182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e/data-stream").mock( diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 03af4657..87456fdf 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -1,4 +1,4 @@ -from openlayer._utils import deepcopy_minimal +from openlayer_test._utils import deepcopy_minimal def assert_different_identities(obj1: object, obj2: object) -> None: diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index 0d33d0a0..e638a7fb 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -4,8 +4,8 @@ import pytest -from openlayer._types import FileTypes -from openlayer._utils import extract_files +from openlayer_test._types import FileTypes +from openlayer_test._utils import extract_files def test_removes_files_from_input() -> None: diff --git a/tests/test_files.py b/tests/test_files.py index 8c6275bf..c7ba0ecd 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -4,7 +4,7 @@ import pytest from dirty_equals import IsDict, IsList, IsBytes, IsTuple -from openlayer._files import to_httpx_files, async_to_httpx_files +from openlayer_test._files import to_httpx_files, async_to_httpx_files readme_path = Path(__file__).parent.parent.joinpath("README.md") diff --git a/tests/test_models.py b/tests/test_models.py index 963a34ff..1fb725b5 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -7,9 +7,9 @@ import pydantic from pydantic import Field -from openlayer._utils import PropertyInfo -from openlayer._compat import PYDANTIC_V2, parse_obj, model_dump, model_json -from openlayer._models import BaseModel, construct_type +from openlayer_test._utils import PropertyInfo +from openlayer_test._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from openlayer_test._models import BaseModel, construct_type class BasicModel(BaseModel): diff --git a/tests/test_qs.py b/tests/test_qs.py index f03db996..916d768a 100644 --- a/tests/test_qs.py +++ b/tests/test_qs.py @@ -4,7 +4,7 @@ import pytest -from openlayer._qs import Querystring, stringify +from openlayer_test._qs import Querystring, stringify def test_empty() -> None: diff --git a/tests/test_required_args.py b/tests/test_required_args.py index 430a1acf..cca4b317 100644 --- a/tests/test_required_args.py +++ b/tests/test_required_args.py @@ -2,7 +2,7 @@ import pytest -from openlayer._utils import required_args +from openlayer_test._utils import required_args def test_too_many_positional_params() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 10480d31..ed811adc 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -6,8 +6,8 @@ import pytest import pydantic -from openlayer import BaseModel, Openlayer, AsyncOpenlayer -from openlayer._response import ( +from openlayer_test import BaseModel, Openlayer, AsyncOpenlayer +from openlayer_test._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, @@ -15,8 +15,8 @@ AsyncBinaryAPIResponse, extract_response_type, ) -from openlayer._streaming import Stream -from openlayer._base_client import FinalRequestOptions +from openlayer_test._streaming import Stream +from openlayer_test._base_client import FinalRequestOptions class ConcreteBaseAPIResponse(APIResponse[bytes]): @@ -40,7 +40,7 @@ def test_extract_response_type_direct_classes() -> None: def test_extract_response_type_direct_class_missing_type_arg() -> None: with pytest.raises( RuntimeError, - match="Expected type to have a type argument at index 0 but it did not", + match="Expected type to have a type argument at index 0 but it did not", ): extract_response_type(AsyncAPIResponse) @@ -72,7 +72,7 @@ def test_response_parse_mismatched_basemodel(client: Openlayer) -> None: with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from openlayer import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from openlayer_test import BaseModel`", ): response.parse(to=PydanticModel) @@ -90,7 +90,7 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncOpen with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from openlayer import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from openlayer_test import BaseModel`", ): await response.parse(to=PydanticModel) diff --git a/tests/test_streaming.py b/tests/test_streaming.py index da026347..83e90ace 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -5,8 +5,8 @@ import httpx import pytest -from openlayer import Openlayer, AsyncOpenlayer -from openlayer._streaming import Stream, AsyncStream, ServerSentEvent +from openlayer_test import Openlayer, AsyncOpenlayer +from openlayer_test._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio diff --git a/tests/test_transform.py b/tests/test_transform.py index 3f6ede8e..ee8a4b52 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,15 +8,15 @@ import pytest -from openlayer._types import Base64FileInput -from openlayer._utils import ( +from openlayer_test._types import Base64FileInput +from openlayer_test._utils import ( PropertyInfo, transform as _transform, parse_datetime, async_transform as _async_transform, ) -from openlayer._compat import PYDANTIC_V2 -from openlayer._models import BaseModel +from openlayer_test._compat import PYDANTIC_V2 +from openlayer_test._models import BaseModel _T = TypeVar("_T") diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 7f09e39e..c79d7fde 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -2,7 +2,7 @@ from typing import Any from typing_extensions import override -from openlayer._utils import LazyProxy +from openlayer_test._utils import LazyProxy class RecursiveLazyProxy(LazyProxy[Any]): diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 5a33f2d6..9de34085 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -2,7 +2,7 @@ from typing import Generic, TypeVar, cast -from openlayer._utils import extract_type_var_from_base +from openlayer_test._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") diff --git a/tests/utils.py b/tests/utils.py index 1918bd1e..bfa8986e 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -8,8 +8,8 @@ from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type -from openlayer._types import NoneType -from openlayer._utils import ( +from openlayer_test._types import NoneType +from openlayer_test._utils import ( is_dict, is_list, is_list_type, @@ -17,8 +17,8 @@ extract_type_arg, is_annotated_type, ) -from openlayer._compat import PYDANTIC_V2, field_outer_type, get_model_fields -from openlayer._models import BaseModel +from openlayer_test._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from openlayer_test._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel)