Skip to content

Commit

Permalink
chore: update SDK settings (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stainless Bot authored and stainless-bot committed Jun 10, 2024
1 parent 5c822fa commit e4afabb
Show file tree
Hide file tree
Showing 80 changed files with 124 additions and 118 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand All @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand All @@ -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`

Expand Down Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@
Types:

```python
from openlayer.types import ProjectListResponse
from openlayer_test.types import ProjectListResponse
```

Methods:

- <code title="get /projects">client.projects.<a href="./src/openlayer/resources/projects/projects.py">list</a>(\*\*<a href="src/openlayer/types/project_list_params.py">params</a>) -> <a href="./src/openlayer/types/project_list_response.py">ProjectListResponse</a></code>
- <code title="get /projects">client.projects.<a href="./src/openlayer_test/resources/projects/projects.py">list</a>(\*\*<a href="src/openlayer_test/types/project_list_params.py">params</a>) -> <a href="./src/openlayer_test/types/project_list_response.py">ProjectListResponse</a></code>

## Commits

Types:

```python
from openlayer.types.projects import CommitListResponse
from openlayer_test.types.projects import CommitListResponse
```

Methods:

- <code title="get /projects/{id}/versions">client.projects.commits.<a href="./src/openlayer/resources/projects/commits.py">list</a>(id, \*\*<a href="src/openlayer/types/projects/commit_list_params.py">params</a>) -> <a href="./src/openlayer/types/projects/commit_list_response.py">CommitListResponse</a></code>
- <code title="get /projects/{id}/versions">client.projects.commits.<a href="./src/openlayer_test/resources/projects/commits.py">list</a>(id, \*\*<a href="src/openlayer_test/types/projects/commit_list_params.py">params</a>) -> <a href="./src/openlayer_test/types/projects/commit_list_response.py">CommitListResponse</a></code>

## InferencePipelines

Types:

```python
from openlayer.types.projects import InferencePipelineListResponse
from openlayer_test.types.projects import InferencePipelineListResponse
```

Methods:

- <code title="get /projects/{id}/inference-pipelines">client.projects.inference_pipelines.<a href="./src/openlayer/resources/projects/inference_pipelines.py">list</a>(id, \*\*<a href="src/openlayer/types/projects/inference_pipeline_list_params.py">params</a>) -> <a href="./src/openlayer/types/projects/inference_pipeline_list_response.py">InferencePipelineListResponse</a></code>
- <code title="get /projects/{id}/inference-pipelines">client.projects.inference_pipelines.<a href="./src/openlayer_test/resources/projects/inference_pipelines.py">list</a>(id, \*\*<a href="src/openlayer_test/types/projects/inference_pipeline_list_params.py">params</a>) -> <a href="./src/openlayer_test/types/projects/inference_pipeline_list_response.py">InferencePipelineListResponse</a></code>

# Commits

Expand All @@ -41,12 +41,12 @@ Methods:
Types:

```python
from openlayer.types.commits import TestResultListResponse
from openlayer_test.types.commits import TestResultListResponse
```

Methods:

- <code title="get /versions/{id}/results">client.commits.test_results.<a href="./src/openlayer/resources/commits/test_results.py">list</a>(id, \*\*<a href="src/openlayer/types/commits/test_result_list_params.py">params</a>) -> <a href="./src/openlayer/types/commits/test_result_list_response.py">TestResultListResponse</a></code>
- <code title="get /versions/{id}/results">client.commits.test_results.<a href="./src/openlayer_test/resources/commits/test_results.py">list</a>(id, \*\*<a href="src/openlayer_test/types/commits/test_result_list_params.py">params</a>) -> <a href="./src/openlayer_test/types/commits/test_result_list_response.py">TestResultListResponse</a></code>

# InferencePipelines

Expand All @@ -55,21 +55,21 @@ Methods:
Types:

```python
from openlayer.types.inference_pipelines import DataStreamResponse
from openlayer_test.types.inference_pipelines import DataStreamResponse
```

Methods:

- <code title="post /inference-pipelines/{id}/data-stream">client.inference_pipelines.data.<a href="./src/openlayer/resources/inference_pipelines/data.py">stream</a>(id, \*\*<a href="src/openlayer/types/inference_pipelines/data_stream_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipelines/data_stream_response.py">DataStreamResponse</a></code>
- <code title="post /inference-pipelines/{id}/data-stream">client.inference_pipelines.data.<a href="./src/openlayer_test/resources/inference_pipelines/data.py">stream</a>(id, \*\*<a href="src/openlayer_test/types/inference_pipelines/data_stream_params.py">params</a>) -> <a href="./src/openlayer_test/types/inference_pipelines/data_stream_response.py">DataStreamResponse</a></code>

## TestResults

Types:

```python
from openlayer.types.inference_pipelines import TestResultListResponse
from openlayer_test.types.inference_pipelines import TestResultListResponse
```

Methods:

- <code title="get /inference-pipelines/{id}/results">client.inference_pipelines.test_results.<a href="./src/openlayer/resources/inference_pipelines/test_results.py">list</a>(id, \*\*<a href="src/openlayer/types/inference_pipelines/test_result_list_params.py">params</a>) -> <a href="./src/openlayer/types/inference_pipelines/test_result_list_response.py">TestResultListResponse</a></code>
- <code title="get /inference-pipelines/{id}/results">client.inference_pipelines.test_results.<a href="./src/openlayer_test/resources/inference_pipelines/test_results.py">list</a>(id, \*\*<a href="src/openlayer_test/types/inference_pipelines/test_result_list_params.py">params</a>) -> <a href="./src/openlayer_test/types/inference_pipelines/test_result_list_response.py">TestResultListResponse</a></code>
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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]
Expand All @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
],
"release-type": "python",
"extra-files": [
"src/openlayer/_version.py"
"src/openlayer_test/_version.py"
]
}
12 changes: 6 additions & 6 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@ 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
# via httpcore
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
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -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'

4 changes: 2 additions & 2 deletions src/openlayer/__init__.py → src/openlayer_test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e4afabb

Please sign in to comment.