diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml new file mode 100644 index 000000000..065780d52 --- /dev/null +++ b/.github/workflows/publish-pypi.yml @@ -0,0 +1,31 @@ +# This workflow is triggered when a GitHub release is created. +# It can also be run manually to re-publish to PyPI in case it failed for some reason. +# You can run this workflow by navigating to https://www.github.com/runloopai/api-client-python/actions/workflows/publish-pypi.yml +name: Publish PyPI +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install Rye + run: | + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: 0.24.0 + RYE_INSTALL_OPTION: "--yes" + + - name: Publish to PyPI + run: | + bash ./bin/publish-pypi + env: + PYPI_TOKEN: ${{ secrets.RUNLOOP_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 000000000..58c1c1917 --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,19 @@ +name: Release Doctor +on: + pull_request: + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'runloopai/api-client-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@v4 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PYPI_TOKEN: ${{ secrets.RUNLOOP_PYPI_TOKEN || secrets.PYPI_TOKEN }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..ba6c34836 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.0-alpha.1" +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..c4dc9ec5d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +## 0.1.0-alpha.1 (2024-06-25) + +Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/runloopai/api-client-python/compare/v0.0.1-alpha.0...v0.1.0-alpha.1) + +### Features + +* **api:** OpenAPI spec update via Stainless API ([17991ec](https://github.com/runloopai/api-client-python/commit/17991ec2bd449f7ffef39a9da4b274f82c61c364)) +* **api:** OpenAPI spec update via Stainless API ([a624924](https://github.com/runloopai/api-client-python/commit/a62492427ea762b1fa8e6e438ba489ff08b798e5)) +* **api:** OpenAPI spec update via Stainless API ([#4](https://github.com/runloopai/api-client-python/issues/4)) ([134f28f](https://github.com/runloopai/api-client-python/commit/134f28ff63f25f18d3a4b7e2300b768ffa4c7590)) +* **api:** update via SDK Studio ([88939b3](https://github.com/runloopai/api-client-python/commit/88939b3e46af521bc43a7b25e66ddb5a553a2af6)) +* **api:** update via SDK Studio ([e2cca37](https://github.com/runloopai/api-client-python/commit/e2cca3796d1a2b128abb6f93b8e444f0dd4da501)) + + +### Chores + +* go live ([#2](https://github.com/runloopai/api-client-python/issues/2)) ([3ae4996](https://github.com/runloopai/api-client-python/commit/3ae4996b2474aabb19a98cf38b834ca3e91d7c2b)) +* go live ([#5](https://github.com/runloopai/api-client-python/issues/5)) ([626be20](https://github.com/runloopai/api-client-python/commit/626be201c2ed40ac34f2b5869f6c17c431ee543b)) +* update SDK settings ([ac8358a](https://github.com/runloopai/api-client-python/commit/ac8358ae8d3ac7ba5bab2082384ae5029c50fcc8)) +* update SDK settings ([#3](https://github.com/runloopai/api-client-python/issues/3)) ([ef88178](https://github.com/runloopai/api-client-python/commit/ef88178299ae3988bc3d1e813c462d609312f69a)) +* update SDK settings ([#6](https://github.com/runloopai/api-client-python/issues/6)) ([82a6f56](https://github.com/runloopai/api-client-python/commit/82a6f56061cd0ebfa88ed3ec71d044a0fb131f0a)) +* update SDK settings ([#7](https://github.com/runloopai/api-client-python/issues/7)) ([aa9d69b](https://github.com/runloopai/api-client-python/commit/aa9d69b15a011dfa8381ec08327c88e5c2a1ab8d)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 87045143c..c79e54f82 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/runloop/lib/` and `examples/` directories are exceptions and will never be overridden. +`src/runloop_minus_api_minus_client/lib/` and `examples/` directories are exceptions and will never be overridden. ## Adding and running examples @@ -59,7 +59,7 @@ If you’d like to use the repository from source, you can either install from g To install via git: ```bash -pip install git+ssh://git@github.com/stainless-sdks/runloop-python.git +pip install git+ssh://git@github.com/runloopai/api-client-python.git ``` Alternatively, you can build from source and install the wheel file: @@ -117,7 +117,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/runloop-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/runloopai/api-client-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/README.md b/README.md index 17464e442..efb92b103 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Runloop Python API library -[![PyPI version](https://img.shields.io/pypi/v/runloop.svg)](https://pypi.org/project/runloop/) +[![PyPI version](https://img.shields.io/pypi/v/runloop-api-client.svg)](https://pypi.org/project/runloop-api-client/) The Runloop Python library provides convenient access to the Runloop REST API from any Python 3.7+ application. The library includes type definitions for all request params and response fields, @@ -15,20 +15,17 @@ The REST API documentation can be found [on runloop.ai](https://runloop.ai). The ## Installation ```sh -# install from this staging repo -pip install git+ssh://git@github.com/stainless-sdks/runloop-python.git +# install from PyPI +pip install --pre runloop-api-client ``` -> [!NOTE] -> Once this package is [published to PyPI](https://app.stainlessapi.com/docs/guides/publish), this will become: `pip install --pre runloop` - ## Usage The full API of this library can be found in [api.md](api.md). ```python import os -from runloop import Runloop +from runloop_minus_api_minus_client import Runloop client = Runloop( # This is the default and can be omitted @@ -51,7 +48,7 @@ Simply import `AsyncRunloop` instead of `Runloop` and use `await` with each API ```python import os import asyncio -from runloop import AsyncRunloop +from runloop_minus_api_minus_client import AsyncRunloop client = AsyncRunloop( # This is the default and can be omitted @@ -80,27 +77,27 @@ 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 `runloop.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 `runloop_minus_api_minus_client.APIConnectionError` is raised. When the API returns a non-success status code (that is, 4xx or 5xx -response), a subclass of `runloop.APIStatusError` is raised, containing `status_code` and `response` properties. +response), a subclass of `runloop_minus_api_minus_client.APIStatusError` is raised, containing `status_code` and `response` properties. -All errors inherit from `runloop.APIError`. +All errors inherit from `runloop_minus_api_minus_client.APIError`. ```python -import runloop -from runloop import Runloop +import runloop_minus_api_minus_client +from runloop_minus_api_minus_client import Runloop client = Runloop() try: client.devboxes.create() -except runloop.APIConnectionError as e: +except runloop_minus_api_minus_client.APIConnectionError as e: print("The server could not be reached") print(e.__cause__) # an underlying Exception, likely raised within httpx. -except runloop.RateLimitError as e: +except runloop_minus_api_minus_client.RateLimitError as e: print("A 429 status code was received; we should back off a bit.") -except runloop.APIStatusError as e: +except runloop_minus_api_minus_client.APIStatusError as e: print("Another non-200-range status code was received") print(e.status_code) print(e.response) @@ -128,7 +125,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 runloop import Runloop +from runloop_minus_api_minus_client import Runloop # Configure the default for all requests: client = Runloop( @@ -146,7 +143,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 runloop import Runloop +from runloop_minus_api_minus_client import Runloop # Configure the default for all requests: client = Runloop( @@ -196,7 +193,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 runloop import Runloop +from runloop_minus_api_minus_client import Runloop client = Runloop() response = client.devboxes.with_raw_response.create() @@ -206,9 +203,9 @@ devbox = response.parse() # get the object that `devboxes.create()` would have print(devbox.id) ``` -These methods return an [`APIResponse`](https://github.com/stainless-sdks/runloop-python/tree/main/src/runloop/_response.py) object. +These methods return an [`APIResponse`](https://github.com/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) object. -The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/runloop-python/tree/main/src/runloop/_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/runloopai/api-client-python/tree/main/src/runloop_minus_api_minus_client/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -270,7 +267,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c - Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality ```python -from runloop import Runloop, DefaultHttpxClient +from runloop_minus_api_minus_client import Runloop, DefaultHttpxClient client = Runloop( # Or use the `RUNLOOP_BASE_URL` env var @@ -296,7 +293,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. -We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/runloop-python/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/runloopai/api-client-python/issues) with questions, bugs, or suggestions. ## Requirements diff --git a/api.md b/api.md index 1f2494acb..04368db98 100644 --- a/api.md +++ b/api.md @@ -1,7 +1,7 @@ # Shared Types ```python -from runloop.types import FunctionInvocationDetailView, ProjectLogsView +from runloop_minus_api_minus_client.types import FunctionInvocationDetailView, ProjectLogsView ``` # Devboxes @@ -9,83 +9,90 @@ from runloop.types import FunctionInvocationDetailView, ProjectLogsView Types: ```python -from runloop.types import DevboxExecutionDetailView, DevboxListView, DevboxView +from runloop_minus_api_minus_client.types import ( + DevboxExecutionDetailView, + DevboxListView, + DevboxView, +) ``` Methods: -- client.devboxes.create(\*\*params) -> DevboxView -- client.devboxes.retrieve(id) -> DevboxView -- client.devboxes.list(\*\*params) -> DevboxListView -- client.devboxes.execute_sync(id) -> DevboxExecutionDetailView -- client.devboxes.shutdown(id) -> DevboxView +- client.devboxes.create(\*\*params) -> DevboxView +- client.devboxes.retrieve(id) -> DevboxView +- client.devboxes.list(\*\*params) -> DevboxListView +- client.devboxes.execute_sync(id) -> DevboxExecutionDetailView +- client.devboxes.shutdown(id) -> DevboxView ## Logs Types: ```python -from runloop.types.devboxes import DevboxLogsListView +from runloop_minus_api_minus_client.types.devboxes import DevboxLogsListView ``` Methods: -- client.devboxes.logs.list(id) -> DevboxLogsListView +- client.devboxes.logs.list(id) -> DevboxLogsListView # Functions Types: ```python -from runloop.types import FunctionListView +from runloop_minus_api_minus_client.types import FunctionListView ``` Methods: -- client.functions.list() -> FunctionListView -- client.functions.invoke_async(function_name, \*, project_name, \*\*params) -> FunctionInvocationDetailView -- client.functions.invoke_sync(function_name, \*, project_name, \*\*params) -> FunctionInvocationDetailView +- client.functions.list() -> FunctionListView +- client.functions.invoke_async(function_name, \*, project_name, \*\*params) -> FunctionInvocationDetailView +- client.functions.invoke_sync(function_name, \*, project_name, \*\*params) -> FunctionInvocationDetailView ## Invocations Types: ```python -from runloop.types.functions import FunctionInvocationListView, KillOperationResponse +from runloop_minus_api_minus_client.types.functions import ( + FunctionInvocationListView, + KillOperationResponse, +) ``` Methods: -- client.functions.invocations.retrieve(invocation_id) -> FunctionInvocationDetailView -- client.functions.invocations.list() -> FunctionInvocationListView -- client.functions.invocations.kill(invocation_id) -> object +- client.functions.invocations.retrieve(invocation_id) -> FunctionInvocationDetailView +- client.functions.invocations.list() -> FunctionInvocationListView +- client.functions.invocations.kill(invocation_id) -> object ### Spans Types: ```python -from runloop.types.functions.invocations import InvocationSpanListView +from runloop_minus_api_minus_client.types.functions.invocations import InvocationSpanListView ``` Methods: -- client.functions.invocations.spans.list(invocation_id) -> InvocationSpanListView +- client.functions.invocations.spans.list(invocation_id) -> InvocationSpanListView # Projects Types: ```python -from runloop.types import ProjectListView +from runloop_minus_api_minus_client.types import ProjectListView ``` Methods: -- client.projects.list() -> ProjectListView +- client.projects.list() -> ProjectListView ## Logs Methods: -- client.projects.logs.list(id) -> ProjectLogsView +- client.projects.logs.list(id) -> ProjectLogsView diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 000000000..bbcc4181f --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +warnings=() +errors=() + +if [ -z "${PYPI_TOKEN}" ]; then + warnings+=("The RUNLOOP_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") +fi + +lenWarnings=${#warnings[@]} + +if [[ lenWarnings -gt 0 ]]; then + echo -e "Found the following warnings in the release environment:\n" + + for warning in "${warnings[@]}"; do + echo -e "- $warning\n" + done +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/mypy.ini b/mypy.ini index 1ee85e698..edf001443 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,7 +5,7 @@ show_error_codes = True # Exclude _files.py because mypy isn't smart enough to apply # the correct type narrowing and as this is an internal module # it's fine to just use Pyright. -exclude = ^(src/runloop/_files\.py|_dev/.*\.py)$ +exclude = ^(src/runloop_minus_api_minus_client/_files\.py|_dev/.*\.py)$ strict_equality = True implicit_reexport = True diff --git a/pyproject.toml b/pyproject.toml index 24a36fd0a..4a2cd0dd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] -name = "runloop" -version = "0.0.1-alpha.0" +name = "runloop-api-client" +version = "0.1.0-alpha.1" description = "The official Python library for the runloop API" dynamic = ["readme"] license = "Apache-2.0" @@ -39,8 +39,8 @@ classifiers = [ [project.urls] -Homepage = "https://github.com/stainless-sdks/runloop-python" -Repository = "https://github.com/stainless-sdks/runloop-python" +Homepage = "https://github.com/runloopai/api-client-python" +Repository = "https://github.com/runloopai/api-client-python" @@ -84,7 +84,7 @@ typecheck = { chain = [ "typecheck:mypy" ]} "typecheck:pyright" = "pyright" -"typecheck:verify-types" = "pyright --verifytypes runloop --ignoreexternal" +"typecheck:verify-types" = "pyright --verifytypes runloop_minus_api_minus_client --ignoreexternal" "typecheck:mypy" = "mypy ." [build-system] @@ -97,7 +97,7 @@ include = [ ] [tool.hatch.build.targets.wheel] -packages = ["src/runloop"] +packages = ["src/runloop_minus_api_minus_client"] [tool.hatch.metadata.hooks.fancy-pypi-readme] content-type = "text/markdown" @@ -108,7 +108,7 @@ path = "README.md" [[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] # replace relative links with absolute links pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' -replacement = '[\1](https://github.com/stainless-sdks/runloop-python/tree/main/\g<2>)' +replacement = '[\1](https://github.com/runloopai/api-client-python/tree/main/\g<2>)' [tool.black] line-length = 120 @@ -187,7 +187,7 @@ length-sort = true length-sort-straight = true combine-as-imports = true extra-standard-library = ["typing_extensions"] -known-first-party = ["runloop", "tests"] +known-first-party = ["runloop_minus_api_minus_client", "tests"] [tool.ruff.per-file-ignores] "bin/**.py" = ["T201", "T203"] diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 000000000..ab92ea3f7 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,66 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "python", + "extra-files": [ + "src/runloop_minus_api_minus_client/_version.py" + ] +} \ No newline at end of file diff --git a/requirements-dev.lock b/requirements-dev.lock index a29b399e0..0852c56d1 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 runloop + # via runloop-api-client 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 runloop + # via runloop-api-client exceptiongroup==1.1.3 # via anyio filelock==3.12.4 @@ -37,7 +37,7 @@ httpcore==1.0.2 # via httpx httpx==0.25.2 # via respx - # via runloop + # via runloop-api-client idna==3.4 # via anyio # via httpx @@ -60,7 +60,7 @@ pluggy==1.3.0 py==1.11.0 # via pytest pydantic==2.7.1 - # via runloop + # via runloop-api-client pydantic-core==2.18.2 # via pydantic pyright==1.1.364 @@ -80,7 +80,7 @@ six==1.16.0 sniffio==1.3.0 # via anyio # via httpx - # via runloop + # via runloop-api-client time-machine==2.9.0 tomli==2.0.1 # via mypy @@ -89,7 +89,7 @@ typing-extensions==4.8.0 # via mypy # via pydantic # via pydantic-core - # via runloop + # via runloop-api-client virtualenv==20.24.5 # via nox zipp==3.17.0 diff --git a/requirements.lock b/requirements.lock index d9b4c33c7..70c5bb66c 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 runloop + # via runloop-api-client certifi==2023.7.22 # via httpcore # via httpx distro==1.8.0 - # via runloop + # via runloop-api-client 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 runloop + # via runloop-api-client idna==3.4 # via anyio # via httpx pydantic==2.7.1 - # via runloop + # via runloop-api-client pydantic-core==2.18.2 # via pydantic sniffio==1.3.0 # via anyio # via httpx - # via runloop + # via runloop-api-client typing-extensions==4.8.0 # via pydantic # via pydantic-core - # via runloop + # via runloop-api-client diff --git a/scripts/lint b/scripts/lint index 18d34a469..c0e4922b5 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 runloop' +rye run python -c 'import runloop_minus_api_minus_client' diff --git a/src/runloop/_version.py b/src/runloop/_version.py deleted file mode 100644 index 5c37f7fda..000000000 --- a/src/runloop/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -__title__ = "runloop" -__version__ = "0.0.1-alpha.0" diff --git a/src/runloop/__init__.py b/src/runloop_minus_api_minus_client/__init__.py similarity index 92% rename from src/runloop/__init__.py rename to src/runloop_minus_api_minus_client/__init__.py index e41010c25..c42946eea 100644 --- a/src/runloop/__init__.py +++ b/src/runloop_minus_api_minus_client/__init__.py @@ -72,12 +72,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. -# runloop._exceptions.NotFoundError -> runloop.NotFoundError +# runloop_minus_api_minus_client._exceptions.NotFoundError -> runloop_minus_api_minus_client.NotFoundError __locals = locals() for __name in __all__: if not __name.startswith("__"): try: - __locals[__name].__module__ = "runloop" + __locals[__name].__module__ = "runloop_minus_api_minus_client" except (TypeError, AttributeError): # Some of our exported symbols are builtins which we can't set attributes for. pass diff --git a/src/runloop/_base_client.py b/src/runloop_minus_api_minus_client/_base_client.py similarity index 99% rename from src/runloop/_base_client.py rename to src/runloop_minus_api_minus_client/_base_client.py index 9e1f25f1f..7ea3ae961 100644 --- a/src/runloop/_base_client.py +++ b/src/runloop_minus_api_minus_client/_base_client.py @@ -362,7 +362,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 `runloop.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 `runloop-api-client.DEFAULT_MAX_RETRIES`" ) def _enforce_trailing_slash(self, url: URL) -> URL: diff --git a/src/runloop/_client.py b/src/runloop_minus_api_minus_client/_client.py similarity index 100% rename from src/runloop/_client.py rename to src/runloop_minus_api_minus_client/_client.py diff --git a/src/runloop/_compat.py b/src/runloop_minus_api_minus_client/_compat.py similarity index 100% rename from src/runloop/_compat.py rename to src/runloop_minus_api_minus_client/_compat.py diff --git a/src/runloop/_constants.py b/src/runloop_minus_api_minus_client/_constants.py similarity index 100% rename from src/runloop/_constants.py rename to src/runloop_minus_api_minus_client/_constants.py diff --git a/src/runloop/_exceptions.py b/src/runloop_minus_api_minus_client/_exceptions.py similarity index 100% rename from src/runloop/_exceptions.py rename to src/runloop_minus_api_minus_client/_exceptions.py diff --git a/src/runloop/_files.py b/src/runloop_minus_api_minus_client/_files.py similarity index 100% rename from src/runloop/_files.py rename to src/runloop_minus_api_minus_client/_files.py diff --git a/src/runloop/_models.py b/src/runloop_minus_api_minus_client/_models.py similarity index 100% rename from src/runloop/_models.py rename to src/runloop_minus_api_minus_client/_models.py diff --git a/src/runloop/_qs.py b/src/runloop_minus_api_minus_client/_qs.py similarity index 100% rename from src/runloop/_qs.py rename to src/runloop_minus_api_minus_client/_qs.py diff --git a/src/runloop/_resource.py b/src/runloop_minus_api_minus_client/_resource.py similarity index 100% rename from src/runloop/_resource.py rename to src/runloop_minus_api_minus_client/_resource.py diff --git a/src/runloop/_response.py b/src/runloop_minus_api_minus_client/_response.py similarity index 98% rename from src/runloop/_response.py rename to src/runloop_minus_api_minus_client/_response.py index 47695a4a6..566ba601a 100644 --- a/src/runloop/_response.py +++ b/src/runloop_minus_api_minus_client/_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 runloop import BaseModel`") + raise TypeError( + "Pydantic models must subclass our base model type, e.g. `from runloop_minus_api_minus_client 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 runloop import BaseModel + from runloop_minus_api_minus_client 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 runloop import BaseModel + from runloop_minus_api_minus_client 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 `runloop._streaming` for reference", + "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `runloop_minus_api_minus_client._streaming` for reference", ) diff --git a/src/runloop/_streaming.py b/src/runloop_minus_api_minus_client/_streaming.py similarity index 100% rename from src/runloop/_streaming.py rename to src/runloop_minus_api_minus_client/_streaming.py diff --git a/src/runloop/_types.py b/src/runloop_minus_api_minus_client/_types.py similarity index 99% rename from src/runloop/_types.py rename to src/runloop_minus_api_minus_client/_types.py index 49f9ba84d..5f55824f3 100644 --- a/src/runloop/_types.py +++ b/src/runloop_minus_api_minus_client/_types.py @@ -81,7 +81,7 @@ # This unfortunately means that you will either have # to import this type and pass it explicitly: # -# from runloop import NoneType +# from runloop_minus_api_minus_client import NoneType # client.get('/foo', cast_to=NoneType) # # or build it yourself: diff --git a/src/runloop/_utils/__init__.py b/src/runloop_minus_api_minus_client/_utils/__init__.py similarity index 100% rename from src/runloop/_utils/__init__.py rename to src/runloop_minus_api_minus_client/_utils/__init__.py diff --git a/src/runloop/_utils/_logs.py b/src/runloop_minus_api_minus_client/_utils/_logs.py similarity index 72% rename from src/runloop/_utils/_logs.py rename to src/runloop_minus_api_minus_client/_utils/_logs.py index 701fbfc6d..576c5a864 100644 --- a/src/runloop/_utils/_logs.py +++ b/src/runloop_minus_api_minus_client/_utils/_logs.py @@ -1,12 +1,12 @@ import os import logging -logger: logging.Logger = logging.getLogger("runloop") +logger: logging.Logger = logging.getLogger("runloop_minus_api_minus_client") httpx_logger: logging.Logger = logging.getLogger("httpx") def _basic_config() -> None: - # e.g. [2023-10-05 14:12:26 - runloop._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 - runloop_minus_api_minus_client._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/runloop/_utils/_proxy.py b/src/runloop_minus_api_minus_client/_utils/_proxy.py similarity index 100% rename from src/runloop/_utils/_proxy.py rename to src/runloop_minus_api_minus_client/_utils/_proxy.py diff --git a/src/runloop/_utils/_reflection.py b/src/runloop_minus_api_minus_client/_utils/_reflection.py similarity index 100% rename from src/runloop/_utils/_reflection.py rename to src/runloop_minus_api_minus_client/_utils/_reflection.py diff --git a/src/runloop/_utils/_streams.py b/src/runloop_minus_api_minus_client/_utils/_streams.py similarity index 100% rename from src/runloop/_utils/_streams.py rename to src/runloop_minus_api_minus_client/_utils/_streams.py diff --git a/src/runloop/_utils/_sync.py b/src/runloop_minus_api_minus_client/_utils/_sync.py similarity index 100% rename from src/runloop/_utils/_sync.py rename to src/runloop_minus_api_minus_client/_utils/_sync.py diff --git a/src/runloop/_utils/_transform.py b/src/runloop_minus_api_minus_client/_utils/_transform.py similarity index 100% rename from src/runloop/_utils/_transform.py rename to src/runloop_minus_api_minus_client/_utils/_transform.py diff --git a/src/runloop/_utils/_typing.py b/src/runloop_minus_api_minus_client/_utils/_typing.py similarity index 100% rename from src/runloop/_utils/_typing.py rename to src/runloop_minus_api_minus_client/_utils/_typing.py diff --git a/src/runloop/_utils/_utils.py b/src/runloop_minus_api_minus_client/_utils/_utils.py similarity index 100% rename from src/runloop/_utils/_utils.py rename to src/runloop_minus_api_minus_client/_utils/_utils.py diff --git a/src/runloop_minus_api_minus_client/_version.py b/src/runloop_minus_api_minus_client/_version.py new file mode 100644 index 000000000..52091da7e --- /dev/null +++ b/src/runloop_minus_api_minus_client/_version.py @@ -0,0 +1,4 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +__title__ = "runloop_minus_api_minus_client" +__version__ = "0.1.0-alpha.1" # x-release-please-version diff --git a/src/runloop_minus_api_minus_client/lib/.keep b/src/runloop_minus_api_minus_client/lib/.keep new file mode 100644 index 000000000..5e2c99fdb --- /dev/null +++ b/src/runloop_minus_api_minus_client/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/runloop/py.typed b/src/runloop_minus_api_minus_client/py.typed similarity index 100% rename from src/runloop/py.typed rename to src/runloop_minus_api_minus_client/py.typed diff --git a/src/runloop/resources/__init__.py b/src/runloop_minus_api_minus_client/resources/__init__.py similarity index 100% rename from src/runloop/resources/__init__.py rename to src/runloop_minus_api_minus_client/resources/__init__.py diff --git a/src/runloop/resources/devboxes/__init__.py b/src/runloop_minus_api_minus_client/resources/devboxes/__init__.py similarity index 100% rename from src/runloop/resources/devboxes/__init__.py rename to src/runloop_minus_api_minus_client/resources/devboxes/__init__.py diff --git a/src/runloop/resources/devboxes/devboxes.py b/src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py similarity index 100% rename from src/runloop/resources/devboxes/devboxes.py rename to src/runloop_minus_api_minus_client/resources/devboxes/devboxes.py diff --git a/src/runloop/resources/devboxes/logs.py b/src/runloop_minus_api_minus_client/resources/devboxes/logs.py similarity index 100% rename from src/runloop/resources/devboxes/logs.py rename to src/runloop_minus_api_minus_client/resources/devboxes/logs.py diff --git a/src/runloop/resources/functions/__init__.py b/src/runloop_minus_api_minus_client/resources/functions/__init__.py similarity index 100% rename from src/runloop/resources/functions/__init__.py rename to src/runloop_minus_api_minus_client/resources/functions/__init__.py diff --git a/src/runloop/resources/functions/functions.py b/src/runloop_minus_api_minus_client/resources/functions/functions.py similarity index 100% rename from src/runloop/resources/functions/functions.py rename to src/runloop_minus_api_minus_client/resources/functions/functions.py diff --git a/src/runloop/resources/functions/invocations/__init__.py b/src/runloop_minus_api_minus_client/resources/functions/invocations/__init__.py similarity index 100% rename from src/runloop/resources/functions/invocations/__init__.py rename to src/runloop_minus_api_minus_client/resources/functions/invocations/__init__.py diff --git a/src/runloop/resources/functions/invocations/invocations.py b/src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py similarity index 100% rename from src/runloop/resources/functions/invocations/invocations.py rename to src/runloop_minus_api_minus_client/resources/functions/invocations/invocations.py diff --git a/src/runloop/resources/functions/invocations/spans.py b/src/runloop_minus_api_minus_client/resources/functions/invocations/spans.py similarity index 100% rename from src/runloop/resources/functions/invocations/spans.py rename to src/runloop_minus_api_minus_client/resources/functions/invocations/spans.py diff --git a/src/runloop/resources/projects/__init__.py b/src/runloop_minus_api_minus_client/resources/projects/__init__.py similarity index 100% rename from src/runloop/resources/projects/__init__.py rename to src/runloop_minus_api_minus_client/resources/projects/__init__.py diff --git a/src/runloop/resources/projects/logs.py b/src/runloop_minus_api_minus_client/resources/projects/logs.py similarity index 100% rename from src/runloop/resources/projects/logs.py rename to src/runloop_minus_api_minus_client/resources/projects/logs.py diff --git a/src/runloop/resources/projects/projects.py b/src/runloop_minus_api_minus_client/resources/projects/projects.py similarity index 100% rename from src/runloop/resources/projects/projects.py rename to src/runloop_minus_api_minus_client/resources/projects/projects.py diff --git a/src/runloop/types/__init__.py b/src/runloop_minus_api_minus_client/types/__init__.py similarity index 100% rename from src/runloop/types/__init__.py rename to src/runloop_minus_api_minus_client/types/__init__.py diff --git a/src/runloop/types/devbox_create_params.py b/src/runloop_minus_api_minus_client/types/devbox_create_params.py similarity index 100% rename from src/runloop/types/devbox_create_params.py rename to src/runloop_minus_api_minus_client/types/devbox_create_params.py diff --git a/src/runloop/types/devbox_execution_detail_view.py b/src/runloop_minus_api_minus_client/types/devbox_execution_detail_view.py similarity index 100% rename from src/runloop/types/devbox_execution_detail_view.py rename to src/runloop_minus_api_minus_client/types/devbox_execution_detail_view.py diff --git a/src/runloop/types/devbox_list_params.py b/src/runloop_minus_api_minus_client/types/devbox_list_params.py similarity index 100% rename from src/runloop/types/devbox_list_params.py rename to src/runloop_minus_api_minus_client/types/devbox_list_params.py diff --git a/src/runloop/types/devbox_list_view.py b/src/runloop_minus_api_minus_client/types/devbox_list_view.py similarity index 100% rename from src/runloop/types/devbox_list_view.py rename to src/runloop_minus_api_minus_client/types/devbox_list_view.py diff --git a/src/runloop/types/devbox_view.py b/src/runloop_minus_api_minus_client/types/devbox_view.py similarity index 100% rename from src/runloop/types/devbox_view.py rename to src/runloop_minus_api_minus_client/types/devbox_view.py diff --git a/src/runloop/types/devboxes/__init__.py b/src/runloop_minus_api_minus_client/types/devboxes/__init__.py similarity index 100% rename from src/runloop/types/devboxes/__init__.py rename to src/runloop_minus_api_minus_client/types/devboxes/__init__.py diff --git a/src/runloop/types/devboxes/devbox_logs_list_view.py b/src/runloop_minus_api_minus_client/types/devboxes/devbox_logs_list_view.py similarity index 100% rename from src/runloop/types/devboxes/devbox_logs_list_view.py rename to src/runloop_minus_api_minus_client/types/devboxes/devbox_logs_list_view.py diff --git a/src/runloop/types/function_invoke_async_params.py b/src/runloop_minus_api_minus_client/types/function_invoke_async_params.py similarity index 100% rename from src/runloop/types/function_invoke_async_params.py rename to src/runloop_minus_api_minus_client/types/function_invoke_async_params.py diff --git a/src/runloop/types/function_invoke_sync_params.py b/src/runloop_minus_api_minus_client/types/function_invoke_sync_params.py similarity index 100% rename from src/runloop/types/function_invoke_sync_params.py rename to src/runloop_minus_api_minus_client/types/function_invoke_sync_params.py diff --git a/src/runloop/types/function_list_view.py b/src/runloop_minus_api_minus_client/types/function_list_view.py similarity index 100% rename from src/runloop/types/function_list_view.py rename to src/runloop_minus_api_minus_client/types/function_list_view.py diff --git a/src/runloop/types/functions/__init__.py b/src/runloop_minus_api_minus_client/types/functions/__init__.py similarity index 100% rename from src/runloop/types/functions/__init__.py rename to src/runloop_minus_api_minus_client/types/functions/__init__.py diff --git a/src/runloop/types/functions/function_invocation_list_view.py b/src/runloop_minus_api_minus_client/types/functions/function_invocation_list_view.py similarity index 100% rename from src/runloop/types/functions/function_invocation_list_view.py rename to src/runloop_minus_api_minus_client/types/functions/function_invocation_list_view.py diff --git a/src/runloop/types/functions/invocations/__init__.py b/src/runloop_minus_api_minus_client/types/functions/invocations/__init__.py similarity index 100% rename from src/runloop/types/functions/invocations/__init__.py rename to src/runloop_minus_api_minus_client/types/functions/invocations/__init__.py diff --git a/src/runloop/types/functions/invocations/invocation_span_list_view.py b/src/runloop_minus_api_minus_client/types/functions/invocations/invocation_span_list_view.py similarity index 100% rename from src/runloop/types/functions/invocations/invocation_span_list_view.py rename to src/runloop_minus_api_minus_client/types/functions/invocations/invocation_span_list_view.py diff --git a/src/runloop/types/project_list_view.py b/src/runloop_minus_api_minus_client/types/project_list_view.py similarity index 100% rename from src/runloop/types/project_list_view.py rename to src/runloop_minus_api_minus_client/types/project_list_view.py diff --git a/src/runloop/types/projects/__init__.py b/src/runloop_minus_api_minus_client/types/projects/__init__.py similarity index 100% rename from src/runloop/types/projects/__init__.py rename to src/runloop_minus_api_minus_client/types/projects/__init__.py diff --git a/src/runloop/types/shared/__init__.py b/src/runloop_minus_api_minus_client/types/shared/__init__.py similarity index 100% rename from src/runloop/types/shared/__init__.py rename to src/runloop_minus_api_minus_client/types/shared/__init__.py diff --git a/src/runloop/types/shared/function_invocation_detail_view.py b/src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py similarity index 100% rename from src/runloop/types/shared/function_invocation_detail_view.py rename to src/runloop_minus_api_minus_client/types/shared/function_invocation_detail_view.py diff --git a/src/runloop/types/shared/project_logs_view.py b/src/runloop_minus_api_minus_client/types/shared/project_logs_view.py similarity index 100% rename from src/runloop/types/shared/project_logs_view.py rename to src/runloop_minus_api_minus_client/types/shared/project_logs_view.py diff --git a/tests/api_resources/devboxes/test_logs.py b/tests/api_resources/devboxes/test_logs.py index f037e9729..c98e52023 100644 --- a/tests/api_resources/devboxes/test_logs.py +++ b/tests/api_resources/devboxes/test_logs.py @@ -7,9 +7,9 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types.devboxes import DevboxLogsListView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types.devboxes import DevboxLogsListView base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/functions/invocations/test_spans.py b/tests/api_resources/functions/invocations/test_spans.py index b59778059..a4b701322 100644 --- a/tests/api_resources/functions/invocations/test_spans.py +++ b/tests/api_resources/functions/invocations/test_spans.py @@ -7,9 +7,9 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types.functions.invocations import InvocationSpanListView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types.functions.invocations import InvocationSpanListView base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/functions/test_invocations.py b/tests/api_resources/functions/test_invocations.py index a971ff48a..c7486c45d 100644 --- a/tests/api_resources/functions/test_invocations.py +++ b/tests/api_resources/functions/test_invocations.py @@ -7,10 +7,10 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types.shared import FunctionInvocationDetailView -from runloop.types.functions import FunctionInvocationListView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types.shared import FunctionInvocationDetailView +from runloop_minus_api_minus_client.types.functions import FunctionInvocationListView base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/projects/test_logs.py b/tests/api_resources/projects/test_logs.py index c340da400..b8a51dc52 100644 --- a/tests/api_resources/projects/test_logs.py +++ b/tests/api_resources/projects/test_logs.py @@ -7,9 +7,9 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types.shared import ProjectLogsView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types.shared import ProjectLogsView base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index ae2d1f39f..0fc02ad3b 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -7,9 +7,9 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types import ( +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types import ( DevboxView, DevboxListView, DevboxExecutionDetailView, diff --git a/tests/api_resources/test_functions.py b/tests/api_resources/test_functions.py index 59e92efcd..85016f1cf 100644 --- a/tests/api_resources/test_functions.py +++ b/tests/api_resources/test_functions.py @@ -7,10 +7,12 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types import FunctionListView -from runloop.types.shared import FunctionInvocationDetailView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types import ( + FunctionListView, +) +from runloop_minus_api_minus_client.types.shared import FunctionInvocationDetailView 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 57ef912cd..1a1a05a9f 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -7,9 +7,9 @@ import pytest -from runloop import Runloop, AsyncRunloop from tests.utils import assert_matches_type -from runloop.types import ProjectListView +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client.types import ProjectListView 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 01056a2f5..8f5021cee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,14 +7,14 @@ import pytest -from runloop import Runloop, AsyncRunloop +from runloop_minus_api_minus_client import Runloop, AsyncRunloop if TYPE_CHECKING: from _pytest.fixtures import FixtureRequest pytest.register_assert_rewrite("tests.utils") -logging.getLogger("runloop").setLevel(logging.DEBUG) +logging.getLogger("runloop_minus_api_minus_client").setLevel(logging.DEBUG) @pytest.fixture(scope="session") diff --git a/tests/test_client.py b/tests/test_client.py index 1c31aaac7..a674b2623 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -16,11 +16,16 @@ from respx import MockRouter from pydantic import ValidationError -from runloop import Runloop, AsyncRunloop, APIResponseValidationError -from runloop._models import BaseModel, FinalRequestOptions -from runloop._constants import RAW_RESPONSE_HEADER -from runloop._exceptions import RunloopError, APIStatusError, APITimeoutError, APIResponseValidationError -from runloop._base_client import ( +from runloop_minus_api_minus_client import Runloop, AsyncRunloop, APIResponseValidationError +from runloop_minus_api_minus_client._models import BaseModel, FinalRequestOptions +from runloop_minus_api_minus_client._constants import RAW_RESPONSE_HEADER +from runloop_minus_api_minus_client._exceptions import ( + RunloopError, + APIStatusError, + APITimeoutError, + APIResponseValidationError, +) +from runloop_minus_api_minus_client._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, @@ -227,10 +232,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. - "runloop/_legacy_response.py", - "runloop/_response.py", + "runloop_minus_api_minus_client/_legacy_response.py", + "runloop_minus_api_minus_client/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "runloop/_compat.py", + "runloop_minus_api_minus_client/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -729,7 +734,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("runloop._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("runloop_minus_api_minus_client._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("/v1/devboxes").mock(side_effect=httpx.TimeoutException("Test timeout error")) @@ -744,7 +749,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No assert _get_open_connections(self.client) == 0 - @mock.patch("runloop._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("runloop_minus_api_minus_client._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("/v1/devboxes").mock(return_value=httpx.Response(500)) @@ -938,10 +943,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. - "runloop/_legacy_response.py", - "runloop/_response.py", + "runloop_minus_api_minus_client/_legacy_response.py", + "runloop_minus_api_minus_client/_response.py", # pydantic.BaseModel.model_dump || pydantic.BaseModel.dict leak memory for some reason. - "runloop/_compat.py", + "runloop_minus_api_minus_client/_compat.py", # Standard library leaks we don't care about. "/logging/__init__.py", ] @@ -1444,7 +1449,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("runloop._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("runloop_minus_api_minus_client._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("/v1/devboxes").mock(side_effect=httpx.TimeoutException("Test timeout error")) @@ -1459,7 +1464,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) assert _get_open_connections(self.client) == 0 - @mock.patch("runloop._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @mock.patch("runloop_minus_api_minus_client._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("/v1/devboxes").mock(return_value=httpx.Response(500)) diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 146c66b16..4926690f5 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -1,4 +1,4 @@ -from runloop._utils import deepcopy_minimal +from runloop_minus_api_minus_client._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 05b269f35..0156cc3e0 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -4,8 +4,8 @@ import pytest -from runloop._types import FileTypes -from runloop._utils import extract_files +from runloop_minus_api_minus_client._types import FileTypes +from runloop_minus_api_minus_client._utils import extract_files def test_removes_files_from_input() -> None: diff --git a/tests/test_files.py b/tests/test_files.py index 17996af04..1b42f4478 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 runloop._files import to_httpx_files, async_to_httpx_files +from runloop_minus_api_minus_client._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 5440d06de..57a3f7b70 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -7,9 +7,9 @@ import pydantic from pydantic import Field -from runloop._utils import PropertyInfo -from runloop._compat import PYDANTIC_V2, parse_obj, model_dump, model_json -from runloop._models import BaseModel, construct_type +from runloop_minus_api_minus_client._utils import PropertyInfo +from runloop_minus_api_minus_client._compat import PYDANTIC_V2, parse_obj, model_dump, model_json +from runloop_minus_api_minus_client._models import BaseModel, construct_type class BasicModel(BaseModel): diff --git a/tests/test_qs.py b/tests/test_qs.py index 29abc6502..8cd0451b1 100644 --- a/tests/test_qs.py +++ b/tests/test_qs.py @@ -4,7 +4,7 @@ import pytest -from runloop._qs import Querystring, stringify +from runloop_minus_api_minus_client._qs import Querystring, stringify def test_empty() -> None: diff --git a/tests/test_required_args.py b/tests/test_required_args.py index fed9f93f4..fa5638c47 100644 --- a/tests/test_required_args.py +++ b/tests/test_required_args.py @@ -2,7 +2,7 @@ import pytest -from runloop._utils import required_args +from runloop_minus_api_minus_client._utils import required_args def test_too_many_positional_params() -> None: diff --git a/tests/test_response.py b/tests/test_response.py index 3b8149876..7da4f33db 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -6,8 +6,8 @@ import pytest import pydantic -from runloop import Runloop, BaseModel, AsyncRunloop -from runloop._response import ( +from runloop_minus_api_minus_client import Runloop, BaseModel, AsyncRunloop +from runloop_minus_api_minus_client._response import ( APIResponse, BaseAPIResponse, AsyncAPIResponse, @@ -15,8 +15,8 @@ AsyncBinaryAPIResponse, extract_response_type, ) -from runloop._streaming import Stream -from runloop._base_client import FinalRequestOptions +from runloop_minus_api_minus_client._streaming import Stream +from runloop_minus_api_minus_client._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: Runloop) -> None: with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from runloop import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from runloop_minus_api_minus_client import BaseModel`", ): response.parse(to=PydanticModel) @@ -90,7 +90,7 @@ async def test_async_response_parse_mismatched_basemodel(async_client: AsyncRunl with pytest.raises( TypeError, - match="Pydantic models must subclass our base model type, e.g. `from runloop import BaseModel`", + match="Pydantic models must subclass our base model type, e.g. `from runloop_minus_api_minus_client import BaseModel`", ): await response.parse(to=PydanticModel) diff --git a/tests/test_streaming.py b/tests/test_streaming.py index 2feefb892..0ef8906f6 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -5,8 +5,8 @@ import httpx import pytest -from runloop import Runloop, AsyncRunloop -from runloop._streaming import Stream, AsyncStream, ServerSentEvent +from runloop_minus_api_minus_client import Runloop, AsyncRunloop +from runloop_minus_api_minus_client._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio diff --git a/tests/test_transform.py b/tests/test_transform.py index 89057f3ec..261ef04d9 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -8,15 +8,15 @@ import pytest -from runloop._types import Base64FileInput -from runloop._utils import ( +from runloop_minus_api_minus_client._types import Base64FileInput +from runloop_minus_api_minus_client._utils import ( PropertyInfo, transform as _transform, parse_datetime, async_transform as _async_transform, ) -from runloop._compat import PYDANTIC_V2 -from runloop._models import BaseModel +from runloop_minus_api_minus_client._compat import PYDANTIC_V2 +from runloop_minus_api_minus_client._models import BaseModel _T = TypeVar("_T") diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 43354df6a..492853bd0 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 runloop._utils import LazyProxy +from runloop_minus_api_minus_client._utils import LazyProxy class RecursiveLazyProxy(LazyProxy[Any]): diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index bd85c7898..fb3ec09fe 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 runloop._utils import extract_type_var_from_base +from runloop_minus_api_minus_client._utils import extract_type_var_from_base _T = TypeVar("_T") _T2 = TypeVar("_T2") diff --git a/tests/utils.py b/tests/utils.py index c26d7cc0c..b497fdc13 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 runloop._types import NoneType -from runloop._utils import ( +from runloop_minus_api_minus_client._types import NoneType +from runloop_minus_api_minus_client._utils import ( is_dict, is_list, is_list_type, @@ -17,8 +17,8 @@ extract_type_arg, is_annotated_type, ) -from runloop._compat import PYDANTIC_V2, field_outer_type, get_model_fields -from runloop._models import BaseModel +from runloop_minus_api_minus_client._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from runloop_minus_api_minus_client._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel)