From f14669be5f6790af961657b4d7c8f8dca2371f30 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 31 Oct 2024 17:41:32 +0000
Subject: [PATCH 1/3] feat(api): manual updates (#364)
---
api.md | 13 +-
src/openlayer/resources/commits/commits.py | 142 ------------------
src/openlayer/resources/projects/commits.py | 125 ++++++++++++++-
src/openlayer/types/__init__.py | 2 -
src/openlayer/types/projects/__init__.py | 2 +
.../types/projects/commit_create_params.py | 29 ++++
.../types/projects/commit_create_response.py | 106 +++++++++++++
tests/api_resources/projects/test_commits.py | 116 +++++++++++++-
8 files changed, 378 insertions(+), 157 deletions(-)
create mode 100644 src/openlayer/types/projects/commit_create_params.py
create mode 100644 src/openlayer/types/projects/commit_create_response.py
diff --git a/api.md b/api.md
index 24e491a6..4276bab7 100644
--- a/api.md
+++ b/api.md
@@ -16,11 +16,12 @@ Methods:
Types:
```python
-from openlayer.types.projects import CommitListResponse
+from openlayer.types.projects import CommitCreateResponse, CommitListResponse
```
Methods:
+- client.projects.commits.create(project_id, \*\*params) -> CommitCreateResponse
- client.projects.commits.list(project_id, \*\*params) -> CommitListResponse
## InferencePipelines
@@ -38,16 +39,6 @@ Methods:
# Commits
-Types:
-
-```python
-from openlayer.types import CommitCreateResponse
-```
-
-Methods:
-
-- client.commits.create(project_id, \*\*params) -> CommitCreateResponse
-
## TestResults
Types:
diff --git a/src/openlayer/resources/commits/commits.py b/src/openlayer/resources/commits/commits.py
index 774ae94f..b5382274 100644
--- a/src/openlayer/resources/commits/commits.py
+++ b/src/openlayer/resources/commits/commits.py
@@ -2,24 +2,8 @@
from __future__ import annotations
-from typing import Optional
-
-import httpx
-
-from ...types import commit_create_params
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import (
- maybe_transform,
- async_maybe_transform,
-)
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
-from ..._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
from .test_results import (
TestResultsResource,
AsyncTestResultsResource,
@@ -28,8 +12,6 @@
TestResultsResourceWithStreamingResponse,
AsyncTestResultsResourceWithStreamingResponse,
)
-from ..._base_client import make_request_options
-from ...types.commit_create_response import CommitCreateResponse
__all__ = ["CommitsResource", "AsyncCommitsResource"]
@@ -58,60 +40,6 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
"""
return CommitsResourceWithStreamingResponse(self)
- def create(
- self,
- project_id: str,
- *,
- commit: commit_create_params.Commit,
- storage_uri: str,
- archived: Optional[bool] | NotGiven = NOT_GIVEN,
- deployment_status: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> CommitCreateResponse:
- """
- Create a new commit (project version) in a project.
-
- Args:
- commit: The details of a commit (project version).
-
- storage_uri: The storage URI where the commit bundle is stored.
-
- archived: Whether the commit is archived.
-
- deployment_status: The deployment status associated with the commit's model.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not project_id:
- raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
- return self._post(
- f"/projects/{project_id}/versions",
- body=maybe_transform(
- {
- "commit": commit,
- "storage_uri": storage_uri,
- "archived": archived,
- "deployment_status": deployment_status,
- },
- commit_create_params.CommitCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=CommitCreateResponse,
- )
-
class AsyncCommitsResource(AsyncAPIResource):
@cached_property
@@ -137,69 +65,11 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
"""
return AsyncCommitsResourceWithStreamingResponse(self)
- async def create(
- self,
- project_id: str,
- *,
- commit: commit_create_params.Commit,
- storage_uri: str,
- archived: Optional[bool] | NotGiven = NOT_GIVEN,
- deployment_status: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> CommitCreateResponse:
- """
- Create a new commit (project version) in a project.
-
- Args:
- commit: The details of a commit (project version).
-
- storage_uri: The storage URI where the commit bundle is stored.
-
- archived: Whether the commit is archived.
-
- deployment_status: The deployment status associated with the commit's model.
-
- extra_headers: Send extra headers
-
- extra_query: Add additional query parameters to the request
-
- extra_body: Add additional JSON properties to the request
-
- timeout: Override the client-level default timeout for this request, in seconds
- """
- if not project_id:
- raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
- return await self._post(
- f"/projects/{project_id}/versions",
- body=await async_maybe_transform(
- {
- "commit": commit,
- "storage_uri": storage_uri,
- "archived": archived,
- "deployment_status": deployment_status,
- },
- commit_create_params.CommitCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
- ),
- cast_to=CommitCreateResponse,
- )
-
class CommitsResourceWithRawResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits
- self.create = to_raw_response_wrapper(
- commits.create,
- )
-
@cached_property
def test_results(self) -> TestResultsResourceWithRawResponse:
return TestResultsResourceWithRawResponse(self._commits.test_results)
@@ -209,10 +79,6 @@ class AsyncCommitsResourceWithRawResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits
- self.create = async_to_raw_response_wrapper(
- commits.create,
- )
-
@cached_property
def test_results(self) -> AsyncTestResultsResourceWithRawResponse:
return AsyncTestResultsResourceWithRawResponse(self._commits.test_results)
@@ -222,10 +88,6 @@ class CommitsResourceWithStreamingResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits
- self.create = to_streamed_response_wrapper(
- commits.create,
- )
-
@cached_property
def test_results(self) -> TestResultsResourceWithStreamingResponse:
return TestResultsResourceWithStreamingResponse(self._commits.test_results)
@@ -235,10 +97,6 @@ class AsyncCommitsResourceWithStreamingResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits
- self.create = async_to_streamed_response_wrapper(
- commits.create,
- )
-
@cached_property
def test_results(self) -> AsyncTestResultsResourceWithStreamingResponse:
return AsyncTestResultsResourceWithStreamingResponse(self._commits.test_results)
diff --git a/src/openlayer/resources/projects/commits.py b/src/openlayer/resources/projects/commits.py
index fd16de8f..9bba5fb8 100644
--- a/src/openlayer/resources/projects/commits.py
+++ b/src/openlayer/resources/projects/commits.py
@@ -2,6 +2,8 @@
from __future__ import annotations
+from typing import Optional
+
import httpx
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
@@ -18,8 +20,9 @@
async_to_streamed_response_wrapper,
)
from ..._base_client import make_request_options
-from ...types.projects import commit_list_params
+from ...types.projects import commit_list_params, commit_create_params
from ...types.projects.commit_list_response import CommitListResponse
+from ...types.projects.commit_create_response import CommitCreateResponse
__all__ = ["CommitsResource", "AsyncCommitsResource"]
@@ -44,6 +47,60 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
"""
return CommitsResourceWithStreamingResponse(self)
+ def create(
+ self,
+ project_id: str,
+ *,
+ commit: commit_create_params.Commit,
+ storage_uri: str,
+ archived: Optional[bool] | NotGiven = NOT_GIVEN,
+ deployment_status: str | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> CommitCreateResponse:
+ """
+ Create a new commit (project version) in a project.
+
+ Args:
+ commit: The details of a commit (project version).
+
+ storage_uri: The storage URI where the commit bundle is stored.
+
+ archived: Whether the commit is archived.
+
+ deployment_status: The deployment status associated with the commit's model.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not project_id:
+ raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
+ return self._post(
+ f"/projects/{project_id}/versions",
+ body=maybe_transform(
+ {
+ "commit": commit,
+ "storage_uri": storage_uri,
+ "archived": archived,
+ "deployment_status": deployment_status,
+ },
+ commit_create_params.CommitCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=CommitCreateResponse,
+ )
+
def list(
self,
project_id: str,
@@ -114,6 +171,60 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
"""
return AsyncCommitsResourceWithStreamingResponse(self)
+ async def create(
+ self,
+ project_id: str,
+ *,
+ commit: commit_create_params.Commit,
+ storage_uri: str,
+ archived: Optional[bool] | NotGiven = NOT_GIVEN,
+ deployment_status: str | NotGiven = NOT_GIVEN,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> CommitCreateResponse:
+ """
+ Create a new commit (project version) in a project.
+
+ Args:
+ commit: The details of a commit (project version).
+
+ storage_uri: The storage URI where the commit bundle is stored.
+
+ archived: Whether the commit is archived.
+
+ deployment_status: The deployment status associated with the commit's model.
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not project_id:
+ raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
+ return await self._post(
+ f"/projects/{project_id}/versions",
+ body=await async_maybe_transform(
+ {
+ "commit": commit,
+ "storage_uri": storage_uri,
+ "archived": archived,
+ "deployment_status": deployment_status,
+ },
+ commit_create_params.CommitCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=CommitCreateResponse,
+ )
+
async def list(
self,
project_id: str,
@@ -168,6 +279,9 @@ class CommitsResourceWithRawResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits
+ self.create = to_raw_response_wrapper(
+ commits.create,
+ )
self.list = to_raw_response_wrapper(
commits.list,
)
@@ -177,6 +291,9 @@ class AsyncCommitsResourceWithRawResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits
+ self.create = async_to_raw_response_wrapper(
+ commits.create,
+ )
self.list = async_to_raw_response_wrapper(
commits.list,
)
@@ -186,6 +303,9 @@ class CommitsResourceWithStreamingResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits
+ self.create = to_streamed_response_wrapper(
+ commits.create,
+ )
self.list = to_streamed_response_wrapper(
commits.list,
)
@@ -195,6 +315,9 @@ class AsyncCommitsResourceWithStreamingResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits
+ self.create = async_to_streamed_response_wrapper(
+ commits.create,
+ )
self.list = async_to_streamed_response_wrapper(
commits.list,
)
diff --git a/src/openlayer/types/__init__.py b/src/openlayer/types/__init__.py
index 48381166..58883aff 100644
--- a/src/openlayer/types/__init__.py
+++ b/src/openlayer/types/__init__.py
@@ -3,10 +3,8 @@
from __future__ import annotations
from .project_list_params import ProjectListParams as ProjectListParams
-from .commit_create_params import CommitCreateParams as CommitCreateParams
from .project_create_params import ProjectCreateParams as ProjectCreateParams
from .project_list_response import ProjectListResponse as ProjectListResponse
-from .commit_create_response import CommitCreateResponse as CommitCreateResponse
from .project_create_response import ProjectCreateResponse as ProjectCreateResponse
from .inference_pipeline_update_params import InferencePipelineUpdateParams as InferencePipelineUpdateParams
from .inference_pipeline_update_response import InferencePipelineUpdateResponse as InferencePipelineUpdateResponse
diff --git a/src/openlayer/types/projects/__init__.py b/src/openlayer/types/projects/__init__.py
index 269c9127..d8b9520e 100644
--- a/src/openlayer/types/projects/__init__.py
+++ b/src/openlayer/types/projects/__init__.py
@@ -3,7 +3,9 @@
from __future__ import annotations
from .commit_list_params import CommitListParams as CommitListParams
+from .commit_create_params import CommitCreateParams as CommitCreateParams
from .commit_list_response import CommitListResponse as CommitListResponse
+from .commit_create_response import CommitCreateResponse as CommitCreateResponse
from .inference_pipeline_list_params import InferencePipelineListParams as InferencePipelineListParams
from .inference_pipeline_create_params import InferencePipelineCreateParams as InferencePipelineCreateParams
from .inference_pipeline_list_response import InferencePipelineListResponse as InferencePipelineListResponse
diff --git a/src/openlayer/types/projects/commit_create_params.py b/src/openlayer/types/projects/commit_create_params.py
new file mode 100644
index 00000000..d4430726
--- /dev/null
+++ b/src/openlayer/types/projects/commit_create_params.py
@@ -0,0 +1,29 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Required, Annotated, TypedDict
+
+from ..._utils import PropertyInfo
+
+__all__ = ["CommitCreateParams", "Commit"]
+
+
+class CommitCreateParams(TypedDict, total=False):
+ commit: Required[Commit]
+ """The details of a commit (project version)."""
+
+ storage_uri: Required[Annotated[str, PropertyInfo(alias="storageUri")]]
+ """The storage URI where the commit bundle is stored."""
+
+ archived: Optional[bool]
+ """Whether the commit is archived."""
+
+ deployment_status: Annotated[str, PropertyInfo(alias="deploymentStatus")]
+ """The deployment status associated with the commit's model."""
+
+
+class Commit(TypedDict, total=False):
+ message: Required[str]
+ """The commit message."""
diff --git a/src/openlayer/types/projects/commit_create_response.py b/src/openlayer/types/projects/commit_create_response.py
new file mode 100644
index 00000000..29a19ad5
--- /dev/null
+++ b/src/openlayer/types/projects/commit_create_response.py
@@ -0,0 +1,106 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+from datetime import datetime
+from typing_extensions import Literal
+
+from pydantic import Field as FieldInfo
+
+from ..._models import BaseModel
+
+__all__ = ["CommitCreateResponse", "Commit", "Links"]
+
+
+class Commit(BaseModel):
+ id: str
+ """The commit id."""
+
+ author_id: str = FieldInfo(alias="authorId")
+ """The author id of the commit."""
+
+ file_size: Optional[int] = FieldInfo(alias="fileSize", default=None)
+ """The size of the commit bundle in bytes."""
+
+ message: str
+ """The commit message."""
+
+ ml_model_id: Optional[str] = FieldInfo(alias="mlModelId", default=None)
+ """The model id."""
+
+ storage_uri: str = FieldInfo(alias="storageUri")
+ """The storage URI where the commit bundle is stored."""
+
+ training_dataset_id: Optional[str] = FieldInfo(alias="trainingDatasetId", default=None)
+ """The training dataset id."""
+
+ validation_dataset_id: Optional[str] = FieldInfo(alias="validationDatasetId", default=None)
+ """The validation dataset id."""
+
+ date_created: Optional[datetime] = FieldInfo(alias="dateCreated", default=None)
+ """The commit creation date."""
+
+ git_commit_ref: Optional[str] = FieldInfo(alias="gitCommitRef", default=None)
+ """The ref of the corresponding git commit."""
+
+ git_commit_sha: Optional[int] = FieldInfo(alias="gitCommitSha", default=None)
+ """The SHA of the corresponding git commit."""
+
+ git_commit_url: Optional[str] = FieldInfo(alias="gitCommitUrl", default=None)
+ """The URL of the corresponding git commit."""
+
+
+class Links(BaseModel):
+ app: str
+
+
+class CommitCreateResponse(BaseModel):
+ id: str
+ """The project version (commit) id."""
+
+ commit: Commit
+ """The details of a commit (project version)."""
+
+ date_archived: Optional[datetime] = FieldInfo(alias="dateArchived", default=None)
+ """The commit archive date."""
+
+ date_created: datetime = FieldInfo(alias="dateCreated")
+ """The project version (commit) creation date."""
+
+ failing_goal_count: int = FieldInfo(alias="failingGoalCount")
+ """The number of tests that are failing for the commit."""
+
+ ml_model_id: Optional[str] = FieldInfo(alias="mlModelId", default=None)
+ """The model id."""
+
+ passing_goal_count: int = FieldInfo(alias="passingGoalCount")
+ """The number of tests that are passing for the commit."""
+
+ project_id: str = FieldInfo(alias="projectId")
+ """The project id."""
+
+ status: Literal["queued", "running", "paused", "failed", "completed", "unknown"]
+ """The commit status.
+
+ Initially, the commit is `queued`, then, it switches to `running`. Finally, it
+ can be `paused`, `failed`, or `completed`.
+ """
+
+ status_message: Optional[str] = FieldInfo(alias="statusMessage", default=None)
+ """The commit status message."""
+
+ total_goal_count: int = FieldInfo(alias="totalGoalCount")
+ """The total number of tests for the commit."""
+
+ training_dataset_id: Optional[str] = FieldInfo(alias="trainingDatasetId", default=None)
+ """The training dataset id."""
+
+ validation_dataset_id: Optional[str] = FieldInfo(alias="validationDatasetId", default=None)
+ """The validation dataset id."""
+
+ archived: Optional[bool] = None
+ """Whether the commit is archived."""
+
+ deployment_status: Optional[str] = FieldInfo(alias="deploymentStatus", default=None)
+ """The deployment status associated with the commit's model."""
+
+ links: Optional[Links] = None
diff --git a/tests/api_resources/projects/test_commits.py b/tests/api_resources/projects/test_commits.py
index b0883779..62fc86ca 100644
--- a/tests/api_resources/projects/test_commits.py
+++ b/tests/api_resources/projects/test_commits.py
@@ -9,7 +9,7 @@
from openlayer import Openlayer, AsyncOpenlayer
from tests.utils import assert_matches_type
-from openlayer.types.projects import CommitListResponse
+from openlayer.types.projects import CommitListResponse, CommitCreateResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -17,6 +17,63 @@
class TestCommits:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ def test_method_create(self, client: Openlayer) -> None:
+ commit = client.projects.commits.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params(self, client: Openlayer) -> None:
+ commit = client.projects.commits.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ archived=False,
+ deployment_status="Deployed",
+ )
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ def test_raw_response_create(self, client: Openlayer) -> None:
+ response = client.projects.commits.with_raw_response.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ commit = response.parse()
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create(self, client: Openlayer) -> None:
+ with client.projects.commits.with_streaming_response.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ commit = response.parse()
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_create(self, client: Openlayer) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
+ client.projects.commits.with_raw_response.create(
+ project_id="",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+
@parametrize
def test_method_list(self, client: Openlayer) -> None:
commit = client.projects.commits.list(
@@ -68,6 +125,63 @@ def test_path_params_list(self, client: Openlayer) -> None:
class TestAsyncCommits:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+ @parametrize
+ async def test_method_create(self, async_client: AsyncOpenlayer) -> None:
+ commit = await async_client.projects.commits.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncOpenlayer) -> None:
+ commit = await async_client.projects.commits.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ archived=False,
+ deployment_status="Deployed",
+ )
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncOpenlayer) -> None:
+ response = await async_client.projects.commits.with_raw_response.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ commit = await response.parse()
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncOpenlayer) -> None:
+ async with async_client.projects.commits.with_streaming_response.create(
+ project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ commit = await response.parse()
+ assert_matches_type(CommitCreateResponse, commit, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncOpenlayer) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
+ await async_client.projects.commits.with_raw_response.create(
+ project_id="",
+ commit={"message": "Updated the prompt."},
+ storage_uri="s3://...",
+ )
+
@parametrize
async def test_method_list(self, async_client: AsyncOpenlayer) -> None:
commit = await async_client.projects.commits.list(
From 52247affd27056cbda7a8b8da1d7ca0b9f9253a9 Mon Sep 17 00:00:00 2001
From: David Meadows
Date: Thu, 31 Oct 2024 14:47:43 -0400
Subject: [PATCH 2/3] fix(internal): remove stale files
---
src/openlayer/types/commit_create_params.py | 29 ----
src/openlayer/types/commit_create_response.py | 106 --------------
tests/api_resources/test_commits.py | 136 ------------------
3 files changed, 271 deletions(-)
delete mode 100644 src/openlayer/types/commit_create_params.py
delete mode 100644 src/openlayer/types/commit_create_response.py
delete mode 100644 tests/api_resources/test_commits.py
diff --git a/src/openlayer/types/commit_create_params.py b/src/openlayer/types/commit_create_params.py
deleted file mode 100644
index 2a7d54de..00000000
--- a/src/openlayer/types/commit_create_params.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing import Optional
-from typing_extensions import Required, Annotated, TypedDict
-
-from .._utils import PropertyInfo
-
-__all__ = ["CommitCreateParams", "Commit"]
-
-
-class CommitCreateParams(TypedDict, total=False):
- commit: Required[Commit]
- """The details of a commit (project version)."""
-
- storage_uri: Required[Annotated[str, PropertyInfo(alias="storageUri")]]
- """The storage URI where the commit bundle is stored."""
-
- archived: Optional[bool]
- """Whether the commit is archived."""
-
- deployment_status: Annotated[str, PropertyInfo(alias="deploymentStatus")]
- """The deployment status associated with the commit's model."""
-
-
-class Commit(TypedDict, total=False):
- message: Required[str]
- """The commit message."""
diff --git a/src/openlayer/types/commit_create_response.py b/src/openlayer/types/commit_create_response.py
deleted file mode 100644
index 82bf6d16..00000000
--- a/src/openlayer/types/commit_create_response.py
+++ /dev/null
@@ -1,106 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-from datetime import datetime
-from typing_extensions import Literal
-
-from pydantic import Field as FieldInfo
-
-from .._models import BaseModel
-
-__all__ = ["CommitCreateResponse", "Commit", "Links"]
-
-
-class Commit(BaseModel):
- id: str
- """The commit id."""
-
- author_id: str = FieldInfo(alias="authorId")
- """The author id of the commit."""
-
- file_size: Optional[int] = FieldInfo(alias="fileSize", default=None)
- """The size of the commit bundle in bytes."""
-
- message: str
- """The commit message."""
-
- ml_model_id: Optional[str] = FieldInfo(alias="mlModelId", default=None)
- """The model id."""
-
- storage_uri: str = FieldInfo(alias="storageUri")
- """The storage URI where the commit bundle is stored."""
-
- training_dataset_id: Optional[str] = FieldInfo(alias="trainingDatasetId", default=None)
- """The training dataset id."""
-
- validation_dataset_id: Optional[str] = FieldInfo(alias="validationDatasetId", default=None)
- """The validation dataset id."""
-
- date_created: Optional[datetime] = FieldInfo(alias="dateCreated", default=None)
- """The commit creation date."""
-
- git_commit_ref: Optional[str] = FieldInfo(alias="gitCommitRef", default=None)
- """The ref of the corresponding git commit."""
-
- git_commit_sha: Optional[int] = FieldInfo(alias="gitCommitSha", default=None)
- """The SHA of the corresponding git commit."""
-
- git_commit_url: Optional[str] = FieldInfo(alias="gitCommitUrl", default=None)
- """The URL of the corresponding git commit."""
-
-
-class Links(BaseModel):
- app: str
-
-
-class CommitCreateResponse(BaseModel):
- id: str
- """The project version (commit) id."""
-
- commit: Commit
- """The details of a commit (project version)."""
-
- date_archived: Optional[datetime] = FieldInfo(alias="dateArchived", default=None)
- """The commit archive date."""
-
- date_created: datetime = FieldInfo(alias="dateCreated")
- """The project version (commit) creation date."""
-
- failing_goal_count: int = FieldInfo(alias="failingGoalCount")
- """The number of tests that are failing for the commit."""
-
- ml_model_id: Optional[str] = FieldInfo(alias="mlModelId", default=None)
- """The model id."""
-
- passing_goal_count: int = FieldInfo(alias="passingGoalCount")
- """The number of tests that are passing for the commit."""
-
- project_id: str = FieldInfo(alias="projectId")
- """The project id."""
-
- status: Literal["queued", "running", "paused", "failed", "completed", "unknown"]
- """The commit status.
-
- Initially, the commit is `queued`, then, it switches to `running`. Finally, it
- can be `paused`, `failed`, or `completed`.
- """
-
- status_message: Optional[str] = FieldInfo(alias="statusMessage", default=None)
- """The commit status message."""
-
- total_goal_count: int = FieldInfo(alias="totalGoalCount")
- """The total number of tests for the commit."""
-
- training_dataset_id: Optional[str] = FieldInfo(alias="trainingDatasetId", default=None)
- """The training dataset id."""
-
- validation_dataset_id: Optional[str] = FieldInfo(alias="validationDatasetId", default=None)
- """The validation dataset id."""
-
- archived: Optional[bool] = None
- """Whether the commit is archived."""
-
- deployment_status: Optional[str] = FieldInfo(alias="deploymentStatus", default=None)
- """The deployment status associated with the commit's model."""
-
- links: Optional[Links] = None
diff --git a/tests/api_resources/test_commits.py b/tests/api_resources/test_commits.py
deleted file mode 100644
index 15e0f5d9..00000000
--- a/tests/api_resources/test_commits.py
+++ /dev/null
@@ -1,136 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-import os
-from typing import Any, cast
-
-import pytest
-
-from openlayer import Openlayer, AsyncOpenlayer
-from tests.utils import assert_matches_type
-from openlayer.types import CommitCreateResponse
-
-base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
-
-
-class TestCommits:
- parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- def test_method_create(self, client: Openlayer) -> None:
- commit = client.commits.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- def test_method_create_with_all_params(self, client: Openlayer) -> None:
- commit = client.commits.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- archived=False,
- deployment_status="Deployed",
- )
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- def test_raw_response_create(self, client: Openlayer) -> None:
- response = client.commits.with_raw_response.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- commit = response.parse()
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- def test_streaming_response_create(self, client: Openlayer) -> None:
- with client.commits.with_streaming_response.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- commit = response.parse()
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- def test_path_params_create(self, client: Openlayer) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
- client.commits.with_raw_response.create(
- project_id="",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
-
-
-class TestAsyncCommits:
- parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
-
- @parametrize
- async def test_method_create(self, async_client: AsyncOpenlayer) -> None:
- commit = await async_client.commits.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- async def test_method_create_with_all_params(self, async_client: AsyncOpenlayer) -> None:
- commit = await async_client.commits.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- archived=False,
- deployment_status="Deployed",
- )
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- async def test_raw_response_create(self, async_client: AsyncOpenlayer) -> None:
- response = await async_client.commits.with_raw_response.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
-
- assert response.is_closed is True
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
- commit = await response.parse()
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- @parametrize
- async def test_streaming_response_create(self, async_client: AsyncOpenlayer) -> None:
- async with async_client.commits.with_streaming_response.create(
- project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- ) as response:
- assert not response.is_closed
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
-
- commit = await response.parse()
- assert_matches_type(CommitCreateResponse, commit, path=["response"])
-
- assert cast(Any, response.is_closed) is True
-
- @parametrize
- async def test_path_params_create(self, async_client: AsyncOpenlayer) -> None:
- with pytest.raises(ValueError, match=r"Expected a non-empty value for `project_id` but received ''"):
- await async_client.commits.with_raw_response.create(
- project_id="",
- commit={"message": "Updated the prompt."},
- storage_uri="s3://...",
- )
From 08056bce34fc5be06d4a665f49885d827d3632f5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 31 Oct 2024 18:48:19 +0000
Subject: [PATCH 3/3] release: 0.2.0-alpha.33
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 13 +++++++++++++
pyproject.toml | 2 +-
src/openlayer/_version.py | 2 +-
4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 40f7732f..29ed3591 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.2.0-alpha.32"
+ ".": "0.2.0-alpha.33"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea14207d..8bb4ddeb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## 0.2.0-alpha.33 (2024-10-31)
+
+Full Changelog: [v0.2.0-alpha.32...v0.2.0-alpha.33](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.32...v0.2.0-alpha.33)
+
+### Features
+
+* **api:** manual updates ([#364](https://github.com/openlayer-ai/openlayer-python/issues/364)) ([f14669b](https://github.com/openlayer-ai/openlayer-python/commit/f14669be5f6790af961657b4d7c8f8dca2371f30))
+
+
+### Bug Fixes
+
+* **internal:** remove stale files ([52247af](https://github.com/openlayer-ai/openlayer-python/commit/52247affd27056cbda7a8b8da1d7ca0b9f9253a9))
+
## 0.2.0-alpha.32 (2024-10-31)
Full Changelog: [v0.2.0-alpha.31...v0.2.0-alpha.32](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.31...v0.2.0-alpha.32)
diff --git a/pyproject.toml b/pyproject.toml
index 4b763dc6..5b8ae5a3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "openlayer"
-version = "0.2.0-alpha.32"
+version = "0.2.0-alpha.33"
description = "The official Python library for the openlayer API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/openlayer/_version.py b/src/openlayer/_version.py
index 4de2f174..909febbe 100644
--- a/src/openlayer/_version.py
+++ b/src/openlayer/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "openlayer"
-__version__ = "0.2.0-alpha.32" # x-release-please-version
+__version__ = "0.2.0-alpha.33" # x-release-please-version