Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7c314a2
fix: ensure file data are only sent as 1 parameter
stainless-app[bot] Apr 11, 2026
f40bfc4
codegen metadata
stainless-app[bot] Apr 12, 2026
3d6e0ec
codegen metadata
stainless-app[bot] Apr 12, 2026
cb002b7
codegen metadata
stainless-app[bot] Apr 12, 2026
ba47230
codegen metadata
stainless-app[bot] Apr 12, 2026
b9374f5
feat(api): api update
stainless-app[bot] Apr 16, 2026
3fc9944
feat(api): api update
stainless-app[bot] Apr 17, 2026
656e585
feat(api): api update
stainless-app[bot] Apr 17, 2026
648e71b
feat(api): api update
stainless-app[bot] Apr 17, 2026
f5cd0d0
codegen metadata
stainless-app[bot] Apr 17, 2026
241bacf
feat(api): api update
stainless-app[bot] Apr 17, 2026
bd68035
codegen metadata
stainless-app[bot] Apr 17, 2026
bbc2458
feat(api): api update
stainless-app[bot] Apr 17, 2026
707a6c3
feat(api): api update
stainless-app[bot] Apr 17, 2026
ec8ff2d
feat(api): manual updates
stainless-app[bot] Apr 17, 2026
639075e
feat(api): api update
stainless-app[bot] Apr 17, 2026
9ddc161
feat(api): api update
stainless-app[bot] Apr 17, 2026
ccc0734
codegen metadata
stainless-app[bot] Apr 17, 2026
826959b
codegen metadata
stainless-app[bot] Apr 17, 2026
d6acbc6
feat(api): manual updates
stainless-app[bot] Apr 17, 2026
f98376c
feat(api): api update
stainless-app[bot] Apr 17, 2026
512bf26
feat(api): api update
stainless-app[bot] Apr 18, 2026
2af78a4
feat(api): manual updates
stainless-app[bot] Apr 18, 2026
5969281
codegen metadata
stainless-app[bot] Apr 18, 2026
573a70c
perf(client): optimize file structure copying in multipart requests
stainless-app[bot] Apr 18, 2026
c3dd013
codegen metadata
stainless-app[bot] Apr 19, 2026
0b47fd4
release: 0.8.0
stainless-app[bot] Apr 19, 2026
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.7.0"
".": "0.8.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: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-5ee7a321f8e01d2678d56277f011f71294c2b8ac4d0cff0bda412362c0d9cf73.yml
openapi_spec_hash: bf5d57e3bddb6975770cf85c267b5035
config_hash: 682b89b02a20f5d1c13e2c91ecbcf5ce
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-5afee68d7308a77a9ef51fb53917080746f96327c6d745fc029363a7d1494c3c.yml
openapi_spec_hash: b2e32bb58d92a00f6ede04c4f7bf1a34
config_hash: 7d13dca2b2c6f71fc463cb6062efa5ea
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# Changelog

## 0.8.0 (2026-04-19)

Full Changelog: [v0.7.0...v0.8.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.7.0...v0.8.0)

### Features

* **api:** api update ([512bf26](https://github.com/context-dot-dev/context-python-sdk/commit/512bf2610e59733e0e950531ca9e6018a5446672))
* **api:** api update ([f98376c](https://github.com/context-dot-dev/context-python-sdk/commit/f98376cf22a331138f716f8abeb4458a8e1e38c2))
* **api:** api update ([9ddc161](https://github.com/context-dot-dev/context-python-sdk/commit/9ddc161215cd12384152295997b95d5ac44bec08))
* **api:** api update ([639075e](https://github.com/context-dot-dev/context-python-sdk/commit/639075e0a0aa6203375592b8b67438ae0719ca26))
* **api:** api update ([707a6c3](https://github.com/context-dot-dev/context-python-sdk/commit/707a6c3e49096e2248ec9e4ae7e683138647c2d6))
* **api:** api update ([bbc2458](https://github.com/context-dot-dev/context-python-sdk/commit/bbc2458c38933208b22e234d6bf1f1ffee7f883e))
* **api:** api update ([241bacf](https://github.com/context-dot-dev/context-python-sdk/commit/241bacf196c1e316aef39429e3919fda1c5a78eb))
* **api:** api update ([648e71b](https://github.com/context-dot-dev/context-python-sdk/commit/648e71bf7afb870dceafe6485bf47932c74ebe1b))
* **api:** api update ([656e585](https://github.com/context-dot-dev/context-python-sdk/commit/656e585bcdf228d8651cdab5ee37f1119a51eafa))
* **api:** api update ([3fc9944](https://github.com/context-dot-dev/context-python-sdk/commit/3fc9944ff014539c18e0216b93c936c1df2b0219))
* **api:** api update ([b9374f5](https://github.com/context-dot-dev/context-python-sdk/commit/b9374f57a2a0ed207c39e80b6fbf710bbe170e11))
* **api:** manual updates ([2af78a4](https://github.com/context-dot-dev/context-python-sdk/commit/2af78a43c1e9b5654668e82c009b679dc3ae8e73))
* **api:** manual updates ([d6acbc6](https://github.com/context-dot-dev/context-python-sdk/commit/d6acbc6552d84e58a6ff7a9e99952a2a7a624647))
* **api:** manual updates ([ec8ff2d](https://github.com/context-dot-dev/context-python-sdk/commit/ec8ff2d2a0d84fcb0c05791fa913441c60ed9c24))


### Bug Fixes

* ensure file data are only sent as 1 parameter ([7c314a2](https://github.com/context-dot-dev/context-python-sdk/commit/7c314a29f73103eb592686df101c86c6cfd26b3f))


### Performance Improvements

* **client:** optimize file structure copying in multipart requests ([573a70c](https://github.com/context-dot-dev/context-python-sdk/commit/573a70cee8cb9bed8377f816bfba419ecbe86109))

## 0.7.0 (2026-04-09)

Full Changelog: [v0.6.0...v0.7.0](https://github.com/context-dot-dev/context-python-sdk/compare/v0.6.0...v0.7.0)
Expand Down
21 changes: 6 additions & 15 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Types:

```python
from context.dev.types import (
WebExtractFontsResponse,
WebExtractStyleguideResponse,
WebScreenshotResponse,
WebWebCrawlMdResponse,
WebWebScrapeHTMLResponse,
Expand All @@ -15,7 +17,9 @@ from context.dev.types import (

Methods:

- <code title="get /brand/screenshot">client.web.<a href="./src/context/dev/resources/web.py">screenshot</a>(\*\*<a href="src/context/dev/types/web_screenshot_params.py">params</a>) -> <a href="./src/context/dev/types/web_screenshot_response.py">WebScreenshotResponse</a></code>
- <code title="get /web/fonts">client.web.<a href="./src/context/dev/resources/web.py">extract_fonts</a>(\*\*<a href="src/context/dev/types/web_extract_fonts_params.py">params</a>) -> <a href="./src/context/dev/types/web_extract_fonts_response.py">WebExtractFontsResponse</a></code>
- <code title="get /web/styleguide">client.web.<a href="./src/context/dev/resources/web.py">extract_styleguide</a>(\*\*<a href="src/context/dev/types/web_extract_styleguide_params.py">params</a>) -> <a href="./src/context/dev/types/web_extract_styleguide_response.py">WebExtractStyleguideResponse</a></code>
- <code title="get /web/screenshot">client.web.<a href="./src/context/dev/resources/web.py">screenshot</a>(\*\*<a href="src/context/dev/types/web_screenshot_params.py">params</a>) -> <a href="./src/context/dev/types/web_screenshot_response.py">WebScreenshotResponse</a></code>
- <code title="post /web/crawl">client.web.<a href="./src/context/dev/resources/web.py">web_crawl_md</a>(\*\*<a href="src/context/dev/types/web_web_crawl_md_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_crawl_md_response.py">WebWebCrawlMdResponse</a></code>
- <code title="get /web/scrape/html">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_html</a>(\*\*<a href="src/context/dev/types/web_web_scrape_html_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_html_response.py">WebWebScrapeHTMLResponse</a></code>
- <code title="get /web/scrape/images">client.web.<a href="./src/context/dev/resources/web.py">web_scrape_images</a>(\*\*<a href="src/context/dev/types/web_web_scrape_images_params.py">params</a>) -> <a href="./src/context/dev/types/web_web_scrape_images_response.py">WebWebScrapeImagesResponse</a></code>
Expand All @@ -36,19 +40,6 @@ Methods:
- <code title="post /brand/ai/product">client.ai.<a href="./src/context/dev/resources/ai.py">extract_product</a>(\*\*<a href="src/context/dev/types/ai_extract_product_params.py">params</a>) -> <a href="./src/context/dev/types/ai_extract_product_response.py">AIExtractProductResponse</a></code>
- <code title="post /brand/ai/products">client.ai.<a href="./src/context/dev/resources/ai.py">extract_products</a>(\*\*<a href="src/context/dev/types/ai_extract_products_params.py">params</a>) -> <a href="./src/context/dev/types/ai_extract_products_response.py">AIExtractProductsResponse</a></code>

# Style

Types:

```python
from context.dev.types import StyleExtractFontsResponse, StyleExtractStyleguideResponse
```

Methods:

- <code title="get /brand/fonts">client.style.<a href="./src/context/dev/resources/style.py">extract_fonts</a>(\*\*<a href="src/context/dev/types/style_extract_fonts_params.py">params</a>) -> <a href="./src/context/dev/types/style_extract_fonts_response.py">StyleExtractFontsResponse</a></code>
- <code title="get /brand/styleguide">client.style.<a href="./src/context/dev/resources/style.py">extract_styleguide</a>(\*\*<a href="src/context/dev/types/style_extract_styleguide_params.py">params</a>) -> <a href="./src/context/dev/types/style_extract_styleguide_response.py">StyleExtractStyleguideResponse</a></code>

# Brand

Types:
Expand Down Expand Up @@ -85,7 +76,7 @@ from context.dev.types import IndustryRetrieveNaicsResponse

Methods:

- <code title="get /brand/naics">client.industry.<a href="./src/context/dev/resources/industry.py">retrieve_naics</a>(\*\*<a href="src/context/dev/types/industry_retrieve_naics_params.py">params</a>) -> <a href="./src/context/dev/types/industry_retrieve_naics_response.py">IndustryRetrieveNaicsResponse</a></code>
- <code title="get /web/naics">client.industry.<a href="./src/context/dev/resources/industry.py">retrieve_naics</a>(\*\*<a href="src/context/dev/types/industry_retrieve_naics_params.py">params</a>) -> <a href="./src/context/dev/types/industry_retrieve_naics_response.py">IndustryRetrieveNaicsResponse</a></code>

# Utility

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 = "context.dev"
version = "0.7.0"
version = "0.8.0"
description = "The official Python library for the context.dev API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
39 changes: 1 addition & 38 deletions src/context/dev/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@
)

if TYPE_CHECKING:
from .resources import ai, web, brand, style, utility, industry
from .resources import ai, web, brand, utility, industry
from .resources.ai import AIResource, AsyncAIResource
from .resources.web import WebResource, AsyncWebResource
from .resources.brand import BrandResource, AsyncBrandResource
from .resources.style import StyleResource, AsyncStyleResource
from .resources.utility import UtilityResource, AsyncUtilityResource
from .resources.industry import IndustryResource, AsyncIndustryResource

Expand Down Expand Up @@ -118,12 +117,6 @@ def ai(self) -> AIResource:

return AIResource(self)

@cached_property
def style(self) -> StyleResource:
from .resources.style import StyleResource

return StyleResource(self)

@cached_property
def brand(self) -> BrandResource:
from .resources.brand import BrandResource
Expand Down Expand Up @@ -322,12 +315,6 @@ def ai(self) -> AsyncAIResource:

return AsyncAIResource(self)

@cached_property
def style(self) -> AsyncStyleResource:
from .resources.style import AsyncStyleResource

return AsyncStyleResource(self)

@cached_property
def brand(self) -> AsyncBrandResource:
from .resources.brand import AsyncBrandResource
Expand Down Expand Up @@ -477,12 +464,6 @@ def ai(self) -> ai.AIResourceWithRawResponse:

return AIResourceWithRawResponse(self._client.ai)

@cached_property
def style(self) -> style.StyleResourceWithRawResponse:
from .resources.style import StyleResourceWithRawResponse

return StyleResourceWithRawResponse(self._client.style)

@cached_property
def brand(self) -> brand.BrandResourceWithRawResponse:
from .resources.brand import BrandResourceWithRawResponse
Expand Down Expand Up @@ -520,12 +501,6 @@ def ai(self) -> ai.AsyncAIResourceWithRawResponse:

return AsyncAIResourceWithRawResponse(self._client.ai)

@cached_property
def style(self) -> style.AsyncStyleResourceWithRawResponse:
from .resources.style import AsyncStyleResourceWithRawResponse

return AsyncStyleResourceWithRawResponse(self._client.style)

@cached_property
def brand(self) -> brand.AsyncBrandResourceWithRawResponse:
from .resources.brand import AsyncBrandResourceWithRawResponse
Expand Down Expand Up @@ -563,12 +538,6 @@ def ai(self) -> ai.AIResourceWithStreamingResponse:

return AIResourceWithStreamingResponse(self._client.ai)

@cached_property
def style(self) -> style.StyleResourceWithStreamingResponse:
from .resources.style import StyleResourceWithStreamingResponse

return StyleResourceWithStreamingResponse(self._client.style)

@cached_property
def brand(self) -> brand.BrandResourceWithStreamingResponse:
from .resources.brand import BrandResourceWithStreamingResponse
Expand Down Expand Up @@ -606,12 +575,6 @@ def ai(self) -> ai.AsyncAIResourceWithStreamingResponse:

return AsyncAIResourceWithStreamingResponse(self._client.ai)

@cached_property
def style(self) -> style.AsyncStyleResourceWithStreamingResponse:
from .resources.style import AsyncStyleResourceWithStreamingResponse

return AsyncStyleResourceWithStreamingResponse(self._client.style)

@cached_property
def brand(self) -> brand.AsyncBrandResourceWithStreamingResponse:
from .resources.brand import AsyncBrandResourceWithStreamingResponse
Expand Down
56 changes: 53 additions & 3 deletions src/context/dev/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import io
import os
import pathlib
from typing import overload
from typing_extensions import TypeGuard
from typing import Sequence, cast, overload
from typing_extensions import TypeVar, TypeGuard

import anyio

Expand All @@ -17,7 +17,9 @@
HttpxFileContent,
HttpxRequestFiles,
)
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t

_T = TypeVar("_T")


def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
Expand Down Expand Up @@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
return await anyio.Path(file).read_bytes()

return file


def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
"""Copy only the containers along the given paths.

Used to guard against mutation by extract_files without copying the entire structure.
Only dicts and lists that lie on a path are copied; everything else
is returned by reference.

For example, given paths=[["foo", "files", "file"]] and the structure:
{
"foo": {
"bar": {"baz": {}},
"files": {"file": <content>}
}
}
The root dict, "foo", and "files" are copied (they lie on the path).
"bar" and "baz" are returned by reference (off the path).
"""
return _deepcopy_with_paths(item, paths, 0)


def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
if not paths:
return item
if is_mapping(item):
key_to_paths: dict[str, list[Sequence[str]]] = {}
for path in paths:
if index < len(path):
key_to_paths.setdefault(path[index], []).append(path)

# if no path continues through this mapping, it won't be mutated and copying it is redundant
if not key_to_paths:
return item

result = dict(item)
for key, subpaths in key_to_paths.items():
if key in result:
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
return cast(_T, result)
if is_list(item):
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]

# if no path expects a list here, nothing will be mutated inside it - return by reference
if not array_paths:
return cast(_T, item)
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
return item
1 change: 0 additions & 1 deletion src/context/dev/_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
coerce_integer as coerce_integer,
file_from_path as file_from_path,
strip_not_given as strip_not_given,
deepcopy_minimal as deepcopy_minimal,
get_async_library as get_async_library,
maybe_coerce_float as maybe_coerce_float,
get_required_header as get_required_header,
Expand Down
20 changes: 3 additions & 17 deletions src/context/dev/_utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def _extract_items(
index += 1
if is_dict(obj):
try:
# We are at the last entry in the path so we must remove the field
if (len(path)) == index:
# Remove the field if there are no more dict keys in the path,
# only "<array>" traversal markers or end.
if all(p == "<array>" for p in path[index:]):
item = obj.pop(key)
else:
item = obj[key]
Expand Down Expand Up @@ -176,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
return isinstance(obj, Iterable)


def deepcopy_minimal(item: _T) -> _T:
"""Minimal reimplementation of copy.deepcopy() that will only copy certain object types:

- mappings, e.g. `dict`
- list

This is done for performance reasons.
"""
if is_mapping(item):
return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
if is_list(item):
return cast(_T, [deepcopy_minimal(entry) for entry in item])
return item


# copied from https://github.com/Rapptz/RoboDanny
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
size = len(seq)
Expand Down
2 changes: 1 addition & 1 deletion src/context/dev/_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__ = "context.dev"
__version__ = "0.7.0" # x-release-please-version
__version__ = "0.8.0" # x-release-please-version
14 changes: 0 additions & 14 deletions src/context/dev/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
BrandResourceWithStreamingResponse,
AsyncBrandResourceWithStreamingResponse,
)
from .style import (
StyleResource,
AsyncStyleResource,
StyleResourceWithRawResponse,
AsyncStyleResourceWithRawResponse,
StyleResourceWithStreamingResponse,
AsyncStyleResourceWithStreamingResponse,
)
from .utility import (
UtilityResource,
AsyncUtilityResource,
Expand Down Expand Up @@ -62,12 +54,6 @@
"AsyncAIResourceWithRawResponse",
"AIResourceWithStreamingResponse",
"AsyncAIResourceWithStreamingResponse",
"StyleResource",
"AsyncStyleResource",
"StyleResourceWithRawResponse",
"AsyncStyleResourceWithRawResponse",
"StyleResourceWithStreamingResponse",
"AsyncStyleResourceWithStreamingResponse",
"BrandResource",
"AsyncBrandResource",
"BrandResourceWithRawResponse",
Expand Down
Loading
Loading