Skip to content

Commit 214ff0f

Browse files
authored
Merge pull request #1 from NanoNets/release-please--branches--main--changes--next
release: 0.1.0
2 parents c5ea9cc + f0813d5 commit 214ff0f

60 files changed

Lines changed: 903 additions & 844 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-pypi.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/NanoNets/docstrange-python/actions/workflows/publish-pypi.yml
4+
name: Publish PyPI
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v6
18+
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v5
21+
with:
22+
version: '0.9.13'
23+
24+
- name: Publish to PyPI
25+
run: |
26+
bash ./bin/publish-pypi
27+
env:
28+
PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
release_doctor:
10+
name: release doctor
11+
runs-on: ubuntu-latest
12+
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')
13+
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
PYPI_TOKEN: ${{ secrets.DOCSTRANGE_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0"
3+
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 9
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/nanonets%2Fdocstrange-a418fe45369669cc2d14b549ee010f3a7ee52f6e47fea3489e560d33064be099.yml
33
openapi_spec_hash: 02f7f52faae1eb42188c290c32c25f10
4-
config_hash: e00c8070feb190d613cf77e700818950
4+
config_hash: b1979c16c99baf59cbbf8c7944a47297

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changelog
2+
3+
## 0.1.0 (2026-02-13)
4+
5+
Full Changelog: [v0.0.1...v0.1.0](https://github.com/NanoNets/docstrange-python/compare/v0.0.1...v0.1.0)
6+
7+
### Features
8+
9+
* **api:** api update ([b03ae9b](https://github.com/NanoNets/docstrange-python/commit/b03ae9b0d7d5940df2aaff8b4cfa22c163a31b6b))
10+
* **api:** api update ([5d5fe8c](https://github.com/NanoNets/docstrange-python/commit/5d5fe8c9980e169a262eeed5601a568b8688a666))
11+
* **api:** api update ([f6e304a](https://github.com/NanoNets/docstrange-python/commit/f6e304ad4aea0364c89273b1a17f53cf730c9f09))
12+
* **api:** api update ([55c65e1](https://github.com/NanoNets/docstrange-python/commit/55c65e11f1cbfcd60df5ec2d65c503330bc29a3c))
13+
* **api:** api update ([0cb4863](https://github.com/NanoNets/docstrange-python/commit/0cb48631aa0c08788f26a3abb051fef2c12aaa20))
14+
* **api:** api update ([cee4e51](https://github.com/NanoNets/docstrange-python/commit/cee4e51ef55edee2402626eeb04dfe74f41c4676))
15+
* **api:** api update ([9cfaf51](https://github.com/NanoNets/docstrange-python/commit/9cfaf51d7c188ab63fc6352d6a689e5c0a8dbe58))
16+
* **api:** api update ([9da26d4](https://github.com/NanoNets/docstrange-python/commit/9da26d4a173539f2a94608833b3002c5bf4d7f37))
17+
* **api:** api update ([a3d7c23](https://github.com/NanoNets/docstrange-python/commit/a3d7c23e4f6027cb4eabb422a08aae1f1f4db511))
18+
* **api:** api update ([a1ada95](https://github.com/NanoNets/docstrange-python/commit/a1ada95fffb116ab7c5a59f5d69eb24fa69f5827))
19+
* **api:** api update ([3d12679](https://github.com/NanoNets/docstrange-python/commit/3d12679a9c3ff3c58563bc17c15fab514dd3aa36))
20+
21+
22+
### Chores
23+
24+
* **internal:** fix lint error on Python 3.14 ([e1b836c](https://github.com/NanoNets/docstrange-python/commit/e1b836c1338d0c34eeae2156a19ae1a9a68b9269))
25+
* update SDK settings ([8e487a0](https://github.com/NanoNets/docstrange-python/commit/8e487a02975b8b2873fdcbf51df22a2c7f04275d))
26+
* update SDK settings ([e231259](https://github.com/NanoNets/docstrange-python/commit/e231259dabdfcb1ee3d818f5720d484dbc48d7fd))
27+
* update SDK settings ([ec90172](https://github.com/NanoNets/docstrange-python/commit/ec90172800803c48e72e6105e265ccd757f80314))
28+
* update SDK settings ([c2d9004](https://github.com/NanoNets/docstrange-python/commit/c2d9004668a9eb79f6cc5a19879ed8d9928f316f))
29+
* update SDK settings ([2c177c7](https://github.com/NanoNets/docstrange-python/commit/2c177c784f8492fd77ae6371e2cf229f5fd6d151))
30+
* update SDK settings ([19fe0dd](https://github.com/NanoNets/docstrange-python/commit/19fe0ddf024bf761e50dc300b02903068ea3a2cf))

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
6262
To install via git:
6363

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

6868
Alternatively, you can build from source and install the wheel file:
@@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
120120

121121
### Publish with a GitHub workflow
122122

123-
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.
123+
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.
124124

125125
### Publish manually
126126

README.md

Lines changed: 80 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Docstrange Python API library
22

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

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

1212
## Documentation
1313

14-
The full API of this library can be found in [api.md](api.md).
14+
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).
1515

1616
## Installation
1717

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

23-
> [!NOTE]
24-
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install docstrange`
25-
2623
## Usage
2724

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

38-
extract_response = client.api.v1.extract.sync(
35+
extract_response = client.extract.sync(
3936
output_format="markdown",
4037
)
4138
print(extract_response.record_id)
@@ -61,7 +58,7 @@ client = AsyncDocstrange(
6158

6259

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

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

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

116113
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`.
117114

115+
## Pagination
116+
117+
List methods in the Docstrange API are paginated.
118+
119+
This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
120+
121+
```python
122+
from docstrange import Docstrange
123+
124+
client = Docstrange()
125+
126+
all_results = []
127+
# Automatically fetches more pages as needed.
128+
for result in client.extract.results.list():
129+
# Do something with result here
130+
all_results.append(result)
131+
print(all_results)
132+
```
133+
134+
Or, asynchronously:
135+
136+
```python
137+
import asyncio
138+
from docstrange import AsyncDocstrange
139+
140+
client = AsyncDocstrange()
141+
142+
143+
async def main() -> None:
144+
all_results = []
145+
# Iterate through items across all pages, issuing requests as needed.
146+
async for result in client.extract.results.list():
147+
all_results.append(result)
148+
print(all_results)
149+
150+
151+
asyncio.run(main())
152+
```
153+
154+
Alternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:
155+
156+
```python
157+
first_page = await client.extract.results.list()
158+
if first_page.has_next_page():
159+
print(f"will fetch next page using these details: {first_page.next_page_info()}")
160+
next_page = await first_page.get_next_page()
161+
print(f"number of items we just fetched: {len(next_page.results)}")
162+
163+
# Remove `await` for non-async usage.
164+
```
165+
166+
Or just work directly with the returned data:
167+
168+
```python
169+
first_page = await client.extract.results.list()
170+
for result in first_page.results:
171+
print(result.record_id)
172+
173+
# Remove `await` for non-async usage.
174+
```
175+
118176
## File uploads
119177

120178
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)`.
@@ -125,7 +183,7 @@ from docstrange import Docstrange
125183

126184
client = Docstrange()
127185

128-
client.api.v1.extract.sync(
186+
client.extract.sync(
129187
output_format="markdown",
130188
file=Path("/path/to/file"),
131189
)
@@ -149,7 +207,7 @@ from docstrange import Docstrange
149207
client = Docstrange()
150208

151209
try:
152-
client.api.v1.extract.sync(
210+
client.extract.sync(
153211
output_format="markdown",
154212
)
155213
except docstrange.APIConnectionError as e:
@@ -194,7 +252,7 @@ client = Docstrange(
194252
)
195253

196254
# Or, configure per-request:
197-
client.with_options(max_retries=5).api.v1.extract.sync(
255+
client.with_options(max_retries=5).extract.sync(
198256
output_format="markdown",
199257
)
200258
```
@@ -219,7 +277,7 @@ client = Docstrange(
219277
)
220278

221279
# Override per-request:
222-
client.with_options(timeout=5.0).api.v1.extract.sync(
280+
client.with_options(timeout=5.0).extract.sync(
223281
output_format="markdown",
224282
)
225283
```
@@ -262,18 +320,18 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
262320
from docstrange import Docstrange
263321

264322
client = Docstrange()
265-
response = client.api.v1.extract.with_raw_response.sync(
323+
response = client.extract.with_raw_response.sync(
266324
output_format="markdown",
267325
)
268326
print(response.headers.get('X-My-Header'))
269327

270-
extract = response.parse() # get the object that `api.v1.extract.sync()` would have returned
328+
extract = response.parse() # get the object that `extract.sync()` would have returned
271329
print(extract.record_id)
272330
```
273331

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

276-
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.
334+
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.
277335

278336
#### `.with_streaming_response`
279337

@@ -282,7 +340,7 @@ The above interface eagerly reads the full response body when you make the reque
282340
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.
283341

284342
```python
285-
with client.api.v1.extract.with_streaming_response.sync(
343+
with client.extract.with_streaming_response.sync(
286344
output_format="markdown",
287345
) as response:
288346
print(response.headers.get("X-My-Header"))
@@ -379,7 +437,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
379437

380438
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
381439

382-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/docstrange-python/issues) with questions, bugs, or suggestions.
440+
We are keen for your feedback; please open an [issue](https://www.github.com/NanoNets/docstrange-python/issues) with questions, bugs, or suggestions.
383441

384442
### Determining the installed version
385443

0 commit comments

Comments
 (0)