Skip to content
Open
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
5 changes: 3 additions & 2 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
publish:
name: publish
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v6
Expand All @@ -27,5 +30,3 @@ jobs:
- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.HYPERSPELL_PYPI_TOKEN || secrets.PYPI_TOKEN }}
2 changes: 0 additions & 2 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,3 @@ jobs:
- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.HYPERSPELL_PYPI_TOKEN || secrets.PYPI_TOKEN }}
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.33.0"
".": "0.34.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 23
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-36cb6e2474f3fe09749b7a2f24409d48c8db332d624fa7eeb1ee6b6135774133.yml
openapi_spec_hash: 339a1b55d6b1a55213d16bf336045d0d
config_hash: 983708fc30c86269c2149a960d0bfec1
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hyperspell%2Fhyperspell-d6e895ab5ce17b403a1981c9f3e3e1a357d2016683627cbbc725c10f6aa2e13a.yml
openapi_spec_hash: 36fc6b210e87fbd995fd578adcbe6626
config_hash: fd3005a8f140e5baadd3d25b3c9cd79f
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## 0.34.0 (2026-03-06)

Full Changelog: [v0.33.0...v0.34.0](https://github.com/hyperspell/python-sdk/compare/v0.33.0...v0.34.0)

### Features

* **api:** api update ([0f66c9d](https://github.com/hyperspell/python-sdk/commit/0f66c9dfe8e50d22f1a66f6de9b3ee0f1a89ab38))
* **api:** api update ([b76b873](https://github.com/hyperspell/python-sdk/commit/b76b873e4c01f4c9421cc6e452f216c19374b687))
* **api:** api update ([b75e2b3](https://github.com/hyperspell/python-sdk/commit/b75e2b3bbb5a871a39d147e4cb0949d7279f3271))
* **api:** api update ([d330dea](https://github.com/hyperspell/python-sdk/commit/d330deaec6f907f4abee6dd8fc786da018ea72a7))
* **api:** api update ([e01d911](https://github.com/hyperspell/python-sdk/commit/e01d911cb400b1ee3827332299f054d278f867d4))


### Chores

* **api:** python trusted publisher ([3d7a283](https://github.com/hyperspell/python-sdk/commit/3d7a283ebe54b78a23964a17a3167c50da0aeba2))
* **internal:** add request options to SSE classes ([6b5c9ad](https://github.com/hyperspell/python-sdk/commit/6b5c9ad8271ecb8887faf8cb678805e6d481459c))
* **internal:** make `test_proxy_environment_variables` more resilient ([3cc3332](https://github.com/hyperspell/python-sdk/commit/3cc33321d35a6162c6c8540b571d4d3c2b63a022))
* **internal:** make `test_proxy_environment_variables` more resilient to env ([2c99a7f](https://github.com/hyperspell/python-sdk/commit/2c99a7f619b2581f2bf7bc2bea4519fc1f6c5733))

## 0.33.0 (2026-02-20)

Full Changelog: [v0.32.0...v0.33.0](https://github.com/hyperspell/python-sdk/compare/v0.32.0...v0.33.0)
Expand Down
4 changes: 0 additions & 4 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

errors=()

Comment on lines 2 to 4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctness: Removing the PYPI_TOKEN validation lets the script pass even when the token is unset, which can cause release failures later (or worse, publish without auth). Reintroduce the check to fail fast when the secret is missing. 🚨

🤖 AI Agent Prompt for Cursor/Windsurf

📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue

In `bin/check-release-environment` around lines 2-4, reintroduce the PYPI_TOKEN validation block so the script errors when the token is missing. Restore the removed `if [ -z "${PYPI_TOKEN}" ]; then ... fi` block before `lenErrors`.

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
Expand Down
6 changes: 5 additions & 1 deletion bin/publish-pypi
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
set -eux
mkdir -p dist
rye build --clean
rye publish --yes --token=$PYPI_TOKEN
if [ -n "${PYPI_TOKEN:-}" ]; then
rye publish --yes --token=$PYPI_TOKEN
else
rye publish --yes
fi
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "hyperspell"
version = "0.33.0"
version = "0.34.0"
description = "The official Python library for the hyperspell API"
dynamic = ["readme"]
license = "MIT"
Expand Down
3 changes: 3 additions & 0 deletions src/hyperspell/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=extract_stream_chunk_type(self._stream_cls),
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand All @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
cast_to=cast_to,
response=self.http_response,
client=cast(Any, self._client),
options=self._options,
),
)

Expand Down
11 changes: 8 additions & 3 deletions src/hyperspell/_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import inspect
from types import TracebackType
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast
from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast
from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable

import httpx
Expand All @@ -13,6 +13,7 @@

if TYPE_CHECKING:
from ._client import Hyperspell, AsyncHyperspell
from ._models import FinalRequestOptions


_T = TypeVar("_T")
Expand All @@ -22,7 +23,7 @@ class Stream(Generic[_T]):
"""Provides the core interface to iterate over a synchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEBytesDecoder

def __init__(
Expand All @@ -31,6 +32,7 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: Hyperspell,
options: Optional[FinalRequestOptions] = None,
timeout: float | None = None,
) -> None:
"""Initialize the synchronous stream.
Expand All @@ -44,6 +46,7 @@ def __init__(
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
Comment on lines 46 to +49

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate Code: ⚠️ Duplicate Code Detected (Similarity: 95%)

This function Stream.__init__ duplicates existing code.

📍 Original Location:

src/hyperspell/_streaming.py:121-142

Function: AsyncStream.__init__

💡 Recommendation:
Introduce an abstract base class (e.g., BaseStream) that holds the shared state: _options, _cast_to, _client, _timeout, and their initialization. Both Stream and AsyncStream can inherit from it, eliminating the duplicated __init__ initialization block. Alternatively, if the sync/async split makes inheritance awkward, at least extract the shared options initialization into a _init_options(self, options) helper or use a @dataclass-style mixin.

Consider importing and reusing the existing function instead of duplicating the logic.

self._timeout = timeout
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()
Expand Down Expand Up @@ -115,7 +118,7 @@ class AsyncStream(Generic[_T]):
"""Provides the core interface to iterate over an asynchronous stream response."""

response: httpx.Response

_options: Optional[FinalRequestOptions] = None
_decoder: SSEDecoder | SSEBytesDecoder

def __init__(
Expand All @@ -124,6 +127,7 @@ def __init__(
cast_to: type[_T],
response: httpx.Response,
client: AsyncHyperspell,
options: Optional[FinalRequestOptions] = None,
timeout: float | None = None,
) -> None:
"""Initialize the asynchronous stream.
Expand All @@ -137,6 +141,7 @@ def __init__(
self.response = response
self._cast_to = cast_to
self._client = client
self._options = options
self._timeout = timeout
self._decoder = client._make_sse_decoder()
self._iterator = self.__stream__()
Expand Down
2 changes: 1 addition & 1 deletion src/hyperspell/_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__ = "hyperspell"
__version__ = "0.33.0" # x-release-please-version
__version__ = "0.34.0" # x-release-please-version
20 changes: 20 additions & 0 deletions src/hyperspell/resources/memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,10 @@ def update(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
collection: Union[str, object, None] | Omit = omit,
metadata: Union[Dict[str, Union[str, float, bool, None]], object, None] | Omit = omit,
Expand Down Expand Up @@ -152,8 +154,10 @@ def list(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
| Omit = omit,
Expand Down Expand Up @@ -225,8 +229,10 @@ def delete(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
# 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.
Expand Down Expand Up @@ -395,8 +401,10 @@ def get(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
# 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.
Expand Down Expand Up @@ -446,8 +454,10 @@ def search(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
| Omit = omit,
Expand Down Expand Up @@ -613,8 +623,10 @@ async def update(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
collection: Union[str, object, None] | Omit = omit,
metadata: Union[Dict[str, Union[str, float, bool, None]], object, None] | Omit = omit,
Expand Down Expand Up @@ -693,8 +705,10 @@ def list(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
| Omit = omit,
Expand Down Expand Up @@ -766,8 +780,10 @@ async def delete(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
# 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.
Expand Down Expand Up @@ -936,8 +952,10 @@ async def get(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
],
# 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.
Expand Down Expand Up @@ -987,8 +1005,10 @@ async def search(
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
| Omit = omit,
Expand Down
4 changes: 4 additions & 0 deletions src/hyperspell/types/auth_me_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ class AuthMeResponse(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
"""All integrations available for the app"""
Expand All @@ -58,8 +60,10 @@ class AuthMeResponse(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
"""All integrations installed for the user"""
Expand Down
2 changes: 2 additions & 0 deletions src/hyperspell/types/connection_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ class Connection(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
"""The connection's provider"""

Expand Down
2 changes: 2 additions & 0 deletions src/hyperspell/types/integration_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ class Integration(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
"""The integration's provider"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ class WebCrawlerIndexResponse(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]

status: Literal["pending", "processing", "completed", "failed"]
2 changes: 2 additions & 0 deletions src/hyperspell/types/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ class Memory(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]

type: str
Expand Down
2 changes: 2 additions & 0 deletions src/hyperspell/types/memory_delete_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class MemoryDeleteResponse(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]

success: bool
2 changes: 2 additions & 0 deletions src/hyperspell/types/memory_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class MemoryListParams(TypedDict, total=False):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]
]
"""Filter documents by source."""
Expand Down
2 changes: 2 additions & 0 deletions src/hyperspell/types/memory_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class MemoryListResponse(BaseModel):
"box",
"dropbox",
"google_drive",
"github",
"vault",
"web_crawler",
"trace",
]

metadata: Optional[Metadata] = None
Expand Down
Loading