Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
19fe0dd
chore: update SDK settings
stainless-app[bot] Feb 10, 2026
2c177c7
chore: update SDK settings
stainless-app[bot] Feb 10, 2026
c2d9004
chore: update SDK settings
stainless-app[bot] Feb 10, 2026
ec90172
chore: update SDK settings
stainless-app[bot] Feb 10, 2026
e231259
chore: update SDK settings
stainless-app[bot] Feb 10, 2026
2a93203
Update config with full model mappings and docstrange branding
stainless-app[bot] Feb 12, 2026
1ccd494
Add pagination config, fix readme params
stainless-app[bot] Feb 12, 2026
4fc3af6
Fix pagination schema to match nested response structure
stainless-app[bot] Feb 12, 2026
5b89e7f
codegen metadata
stainless-app[bot] Feb 12, 2026
43a5e85
codegen metadata
stainless-app[bot] Feb 12, 2026
e1b836c
chore(internal): fix lint error on Python 3.14
stainless-app[bot] Feb 12, 2026
d88ea55
codegen metadata
stainless-app[bot] Feb 12, 2026
3d12679
feat(api): api update
stainless-app[bot] Feb 12, 2026
a1ada95
feat(api): api update
stainless-app[bot] Feb 12, 2026
a3d7c23
feat(api): api update
stainless-app[bot] Feb 12, 2026
9da26d4
feat(api): api update
stainless-app[bot] Feb 12, 2026
9cfaf51
feat(api): api update
stainless-app[bot] Feb 12, 2026
cee4e51
feat(api): api update
stainless-app[bot] Feb 12, 2026
0cb4863
feat(api): api update
stainless-app[bot] Feb 12, 2026
55c65e1
feat(api): api update
stainless-app[bot] Feb 12, 2026
f6e304a
feat(api): api update
stainless-app[bot] Feb 12, 2026
5d5fe8c
feat(api): api update
stainless-app[bot] Feb 12, 2026
b03ae9b
feat(api): api update
stainless-app[bot] Feb 12, 2026
e672aff
codegen metadata
stainless-app[bot] Feb 12, 2026
8e487a0
chore: update SDK settings
stainless-app[bot] Feb 13, 2026
f0813d5
release: 0.1.0
stainless-app[bot] Feb 13, 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
28 changes: 28 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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/NanoNets/docstrange-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@v6

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'

- name: Publish to PyPI
run: |
bash ./bin/publish-pypi
env:
PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Doctor
on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
if: github.repository == 'NanoNets/docstrange-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v6

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nanonets%2Fdocstrange-a418fe45369669cc2d14b549ee010f3a7ee52f6e47fea3489e560d33064be099.yml
openapi_spec_hash: 02f7f52faae1eb42188c290c32c25f10
config_hash: e00c8070feb190d613cf77e700818950
config_hash: b1979c16c99baf59cbbf8c7944a47297
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Changelog

## 0.1.0 (2026-02-13)

Full Changelog: [v0.0.1...v0.1.0](https://github.com/NanoNets/docstrange-python/compare/v0.0.1...v0.1.0)

### Features

* **api:** api update ([b03ae9b](https://github.com/NanoNets/docstrange-python/commit/b03ae9b0d7d5940df2aaff8b4cfa22c163a31b6b))
* **api:** api update ([5d5fe8c](https://github.com/NanoNets/docstrange-python/commit/5d5fe8c9980e169a262eeed5601a568b8688a666))
* **api:** api update ([f6e304a](https://github.com/NanoNets/docstrange-python/commit/f6e304ad4aea0364c89273b1a17f53cf730c9f09))
* **api:** api update ([55c65e1](https://github.com/NanoNets/docstrange-python/commit/55c65e11f1cbfcd60df5ec2d65c503330bc29a3c))
* **api:** api update ([0cb4863](https://github.com/NanoNets/docstrange-python/commit/0cb48631aa0c08788f26a3abb051fef2c12aaa20))
* **api:** api update ([cee4e51](https://github.com/NanoNets/docstrange-python/commit/cee4e51ef55edee2402626eeb04dfe74f41c4676))
* **api:** api update ([9cfaf51](https://github.com/NanoNets/docstrange-python/commit/9cfaf51d7c188ab63fc6352d6a689e5c0a8dbe58))
* **api:** api update ([9da26d4](https://github.com/NanoNets/docstrange-python/commit/9da26d4a173539f2a94608833b3002c5bf4d7f37))
* **api:** api update ([a3d7c23](https://github.com/NanoNets/docstrange-python/commit/a3d7c23e4f6027cb4eabb422a08aae1f1f4db511))
* **api:** api update ([a1ada95](https://github.com/NanoNets/docstrange-python/commit/a1ada95fffb116ab7c5a59f5d69eb24fa69f5827))
* **api:** api update ([3d12679](https://github.com/NanoNets/docstrange-python/commit/3d12679a9c3ff3c58563bc17c15fab514dd3aa36))


### Chores

* **internal:** fix lint error on Python 3.14 ([e1b836c](https://github.com/NanoNets/docstrange-python/commit/e1b836c1338d0c34eeae2156a19ae1a9a68b9269))
* update SDK settings ([8e487a0](https://github.com/NanoNets/docstrange-python/commit/8e487a02975b8b2873fdcbf51df22a2c7f04275d))
* update SDK settings ([e231259](https://github.com/NanoNets/docstrange-python/commit/e231259dabdfcb1ee3d818f5720d484dbc48d7fd))
* update SDK settings ([ec90172](https://github.com/NanoNets/docstrange-python/commit/ec90172800803c48e72e6105e265ccd757f80314))
* update SDK settings ([c2d9004](https://github.com/NanoNets/docstrange-python/commit/c2d9004668a9eb79f6cc5a19879ed8d9928f316f))
* update SDK settings ([2c177c7](https://github.com/NanoNets/docstrange-python/commit/2c177c784f8492fd77ae6371e2cf229f5fd6d151))
* update SDK settings ([19fe0dd](https://github.com/NanoNets/docstrange-python/commit/19fe0ddf024bf761e50dc300b02903068ea3a2cf))
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you鈥檇 like to use the repository from source, you can either install from g
To install via git:

```sh
$ pip install git+ssh://git@github.com/stainless-sdks/docstrange-python.git
$ pip install git+ssh://git@github.com/NanoNets/docstrange-python.git
```

Alternatively, you can build from source and install the wheel file:
Expand Down Expand Up @@ -120,7 +120,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/docstrange-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/NanoNets/docstrange-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

Expand Down
102 changes: 80 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Docstrange Python API library

<!-- prettier-ignore -->
[![PyPI version](https://img.shields.io/pypi/v/docstrange.svg?label=pypi%20(stable))](https://pypi.org/project/docstrange/)
[![PyPI version](https://img.shields.io/pypi/v/docstrange-api.svg?label=pypi%20(stable))](https://pypi.org/project/docstrange-api/)

The Docstrange Python library provides convenient access to the Docstrange REST API from any Python 3.9+
application. The library includes type definitions for all request params and response fields,
Expand All @@ -11,18 +11,15 @@ It is generated with [Stainless](https://www.stainless.com/).

## Documentation

The full API of this library can be found in [api.md](api.md).
The REST API documentation can be found on [docs.nanonets.com](https://docs.nanonets.com). The full API of this library can be found in [api.md](api.md).

## Installation

```sh
# install from this staging repo
pip install git+ssh://git@github.com/stainless-sdks/docstrange-python.git
# install from PyPI
pip install docstrange-api
```

> [!NOTE]
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install docstrange`

## Usage

The full API of this library can be found in [api.md](api.md).
Expand All @@ -35,7 +32,7 @@ client = Docstrange(
api_key=os.environ.get("DOCSTRANGE_API_KEY"), # This is the default and can be omitted
)

extract_response = client.api.v1.extract.sync(
extract_response = client.extract.sync(
output_format="markdown",
)
print(extract_response.record_id)
Expand All @@ -61,7 +58,7 @@ client = AsyncDocstrange(


async def main() -> None:
extract_response = await client.api.v1.extract.sync(
extract_response = await client.extract.sync(
output_format="markdown",
)
print(extract_response.record_id)
Expand All @@ -79,8 +76,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
You can enable this by installing `aiohttp`:

```sh
# install from this staging repo
pip install 'docstrange[aiohttp] @ git+ssh://git@github.com/stainless-sdks/docstrange-python.git'
# install from PyPI
pip install docstrange-api[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
Expand All @@ -97,7 +94,7 @@ async def main() -> None:
api_key=os.environ.get("DOCSTRANGE_API_KEY"), # This is the default and can be omitted
http_client=DefaultAioHttpClient(),
) as client:
extract_response = await client.api.v1.extract.sync(
extract_response = await client.extract.sync(
output_format="markdown",
)
print(extract_response.record_id)
Expand All @@ -115,6 +112,67 @@ Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typ

Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.

## Pagination

List methods in the Docstrange API are paginated.

This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:

```python
from docstrange import Docstrange

client = Docstrange()

all_results = []
# Automatically fetches more pages as needed.
for result in client.extract.results.list():
# Do something with result here
all_results.append(result)
print(all_results)
```

Or, asynchronously:

```python
import asyncio
from docstrange import AsyncDocstrange

client = AsyncDocstrange()


async def main() -> None:
all_results = []
# Iterate through items across all pages, issuing requests as needed.
async for result in client.extract.results.list():
all_results.append(result)
print(all_results)


asyncio.run(main())
```

Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:

```python
first_page = await client.extract.results.list()
if first_page.has_next_page():
print(f"will fetch next page using these details: {first_page.next_page_info()}")
next_page = await first_page.get_next_page()
print(f"number of items we just fetched: {len(next_page.results)}")

# Remove `await` for non-async usage.
```

Or just work directly with the returned data:

```python
first_page = await client.extract.results.list()
for result in first_page.results:
print(result.record_id)

# Remove `await` for non-async usage.
```

## File uploads

Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.
Expand All @@ -125,7 +183,7 @@ from docstrange import Docstrange

client = Docstrange()

client.api.v1.extract.sync(
client.extract.sync(
output_format="markdown",
file=Path("/path/to/file"),
)
Expand All @@ -149,7 +207,7 @@ from docstrange import Docstrange
client = Docstrange()

try:
client.api.v1.extract.sync(
client.extract.sync(
output_format="markdown",
)
except docstrange.APIConnectionError as e:
Expand Down Expand Up @@ -194,7 +252,7 @@ client = Docstrange(
)

# Or, configure per-request:
client.with_options(max_retries=5).api.v1.extract.sync(
client.with_options(max_retries=5).extract.sync(
output_format="markdown",
)
```
Expand All @@ -219,7 +277,7 @@ client = Docstrange(
)

# Override per-request:
client.with_options(timeout=5.0).api.v1.extract.sync(
client.with_options(timeout=5.0).extract.sync(
output_format="markdown",
)
```
Expand Down Expand Up @@ -262,18 +320,18 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
from docstrange import Docstrange

client = Docstrange()
response = client.api.v1.extract.with_raw_response.sync(
response = client.extract.with_raw_response.sync(
output_format="markdown",
)
print(response.headers.get('X-My-Header'))

extract = response.parse() # get the object that `api.v1.extract.sync()` would have returned
extract = response.parse() # get the object that `extract.sync()` would have returned
print(extract.record_id)
```

These methods return an [`APIResponse`](https://github.com/stainless-sdks/docstrange-python/tree/main/src/docstrange/_response.py) object.
These methods return an [`APIResponse`](https://github.com/NanoNets/docstrange-python/tree/main/src/docstrange/_response.py) object.

The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/docstrange-python/tree/main/src/docstrange/_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/NanoNets/docstrange-python/tree/main/src/docstrange/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.

#### `.with_streaming_response`

Expand All @@ -282,7 +340,7 @@ The above interface eagerly reads the full response body when you make the reque
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.

```python
with client.api.v1.extract.with_streaming_response.sync(
with client.extract.with_streaming_response.sync(
output_format="markdown",
) as response:
print(response.headers.get("X-My-Header"))
Expand Down Expand Up @@ -379,7 +437,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/docstrange-python/issues) with questions, bugs, or suggestions.
We are keen for your feedback; please open an [issue](https://www.github.com/NanoNets/docstrange-python/issues) with questions, bugs, or suggestions.

### Determining the installed version

Expand Down
Loading
Loading