Skip to content

release: 0.2.0-alpha.45 #422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.0-alpha.44"
".": "0.2.0-alpha.45"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 14
configured_endpoints: 15
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ 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.45 (2025-03-13)

Full Changelog: [v0.2.0-alpha.44...v0.2.0-alpha.45](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.44...v0.2.0-alpha.45)

### Features

* **api:** add endpoint to retrieve commit by id ([#421](https://github.com/openlayer-ai/openlayer-python/issues/421)) ([d7c8489](https://github.com/openlayer-ai/openlayer-python/commit/d7c84892a258c15b23fac3dedd2c074357595613))

## 0.2.0-alpha.44 (2025-02-26)

Full Changelog: [v0.2.0-alpha.43...v0.2.0-alpha.44](https://github.com/openlayer-ai/openlayer-python/compare/v0.2.0-alpha.43...v0.2.0-alpha.44)
Expand Down
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ Methods:

# Commits

Types:

```python
from openlayer.types import CommitRetrieveResponse
```

Methods:

- <code title="get /versions/{projectVersionId}">client.commits.<a href="./src/openlayer/resources/commits/commits.py">retrieve</a>(project_version_id) -> <a href="./src/openlayer/types/commit_retrieve_response.py">CommitRetrieveResponse</a></code>

## TestResults

Types:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openlayer"
version = "0.2.0-alpha.44"
version = "0.2.0-alpha.45"
description = "The official Python library for the openlayer API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/openlayer/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openlayer"
__version__ = "0.2.0-alpha.44" # x-release-please-version
__version__ = "0.2.0-alpha.45" # x-release-please-version
93 changes: 93 additions & 0 deletions src/openlayer/resources/commits/commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

from __future__ import annotations

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
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,
Expand All @@ -12,6 +21,8 @@
TestResultsResourceWithStreamingResponse,
AsyncTestResultsResourceWithStreamingResponse,
)
from ..._base_client import make_request_options
from ...types.commit_retrieve_response import CommitRetrieveResponse

__all__ = ["CommitsResource", "AsyncCommitsResource"]

Expand Down Expand Up @@ -40,6 +51,39 @@ def with_streaming_response(self) -> CommitsResourceWithStreamingResponse:
"""
return CommitsResourceWithStreamingResponse(self)

def retrieve(
self,
project_version_id: str,
*,
# 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,
) -> CommitRetrieveResponse:
"""
Retrieve a project version (commit) by its id.

Args:
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_version_id:
raise ValueError(f"Expected a non-empty value for `project_version_id` but received {project_version_id!r}")
return self._get(
f"/versions/{project_version_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CommitRetrieveResponse,
)


class AsyncCommitsResource(AsyncAPIResource):
@cached_property
Expand All @@ -65,11 +109,48 @@ def with_streaming_response(self) -> AsyncCommitsResourceWithStreamingResponse:
"""
return AsyncCommitsResourceWithStreamingResponse(self)

async def retrieve(
self,
project_version_id: str,
*,
# 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,
) -> CommitRetrieveResponse:
"""
Retrieve a project version (commit) by its id.

Args:
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_version_id:
raise ValueError(f"Expected a non-empty value for `project_version_id` but received {project_version_id!r}")
return await self._get(
f"/versions/{project_version_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=CommitRetrieveResponse,
)


class CommitsResourceWithRawResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits

self.retrieve = to_raw_response_wrapper(
commits.retrieve,
)

@cached_property
def test_results(self) -> TestResultsResourceWithRawResponse:
return TestResultsResourceWithRawResponse(self._commits.test_results)
Expand All @@ -79,6 +160,10 @@ class AsyncCommitsResourceWithRawResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits

self.retrieve = async_to_raw_response_wrapper(
commits.retrieve,
)

@cached_property
def test_results(self) -> AsyncTestResultsResourceWithRawResponse:
return AsyncTestResultsResourceWithRawResponse(self._commits.test_results)
Expand All @@ -88,6 +173,10 @@ class CommitsResourceWithStreamingResponse:
def __init__(self, commits: CommitsResource) -> None:
self._commits = commits

self.retrieve = to_streamed_response_wrapper(
commits.retrieve,
)

@cached_property
def test_results(self) -> TestResultsResourceWithStreamingResponse:
return TestResultsResourceWithStreamingResponse(self._commits.test_results)
Expand All @@ -97,6 +186,10 @@ class AsyncCommitsResourceWithStreamingResponse:
def __init__(self, commits: AsyncCommitsResource) -> None:
self._commits = commits

self.retrieve = async_to_streamed_response_wrapper(
commits.retrieve,
)

@cached_property
def test_results(self) -> AsyncTestResultsResourceWithStreamingResponse:
return AsyncTestResultsResourceWithStreamingResponse(self._commits.test_results)
1 change: 1 addition & 0 deletions src/openlayer/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .project_create_params import ProjectCreateParams as ProjectCreateParams
from .project_list_response import ProjectListResponse as ProjectListResponse
from .project_create_response import ProjectCreateResponse as ProjectCreateResponse
from .commit_retrieve_response import CommitRetrieveResponse as CommitRetrieveResponse
from .inference_pipeline_update_params import InferencePipelineUpdateParams as InferencePipelineUpdateParams
from .inference_pipeline_retrieve_params import InferencePipelineRetrieveParams as InferencePipelineRetrieveParams
from .inference_pipeline_update_response import InferencePipelineUpdateResponse as InferencePipelineUpdateResponse
Expand Down
106 changes: 106 additions & 0 deletions src/openlayer/types/commit_retrieve_response.py
Original file line number Diff line number Diff line change
@@ -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__ = ["CommitRetrieveResponse", "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 CommitRetrieveResponse(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
Loading