Skip to content

Commit 4a449e4

Browse files
authored
Merge pull request #53 from Dataherald/release-please--branches--main--changes--next
release: 0.20.0
2 parents c8c1d8e + 2b575d1 commit 4a449e4

142 files changed

Lines changed: 2524 additions & 1193 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
2424
RYE_VERSION: 0.24.0
25-
RYE_INSTALL_OPTION: "--yes"
25+
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Install dependencies
2828
run: |
@@ -39,3 +39,24 @@ jobs:
3939
- name: Ensure importable
4040
run: |
4141
rye run python -c 'import dataherald'
42+
test:
43+
name: test
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Install Rye
50+
run: |
51+
curl -sSf https://rye-up.com/get | bash
52+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
53+
env:
54+
RYE_VERSION: 0.24.0
55+
RYE_INSTALL_OPTION: '--yes'
56+
57+
- name: Bootstrap
58+
run: ./scripts/bootstrap
59+
60+
- name: Run tests
61+
run: ./scripts/test
62+

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818

1919
- name: Install Rye
2020
run: |

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: github.repository == 'Dataherald/dataherald-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

1515
- name: Check release environment
1616
run: |

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ dist
1212
.env
1313
.envrc
1414
codegen.log
15+
Brewfile.lock.json

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.19.0"
2+
".": "0.20.0"
33
}

.stats.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
configured_endpoints: 46
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/Dataherald%2FDataherald-e168e98625a857aa05a5619a5dfd3cc3007a45d78630dfd9fbfdc6c700ce7f11.yml

Brewfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
brew "rye"
2+

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.20.0 (2024-05-06)
4+
5+
Full Changelog: [v0.19.0...v0.20.0](https://github.com/Dataherald/dataherald-python/compare/v0.19.0...v0.20.0)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([#52](https://github.com/Dataherald/dataherald-python/issues/52)) ([84b46e9](https://github.com/Dataherald/dataherald-python/commit/84b46e9a1aa8046a1b8c909669c746f95ef6c567))
10+
311
## 0.19.0 (2024-02-28)
412

513
Full Changelog: [v0.18.0...v0.19.0](https://github.com/Dataherald/dataherald-python/compare/v0.18.0...v0.19.0)

CONTRIBUTING.md

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

6161
```bash
62-
pip install git+ssh://git@github.com:Dataherald/dataherald-python.git
62+
pip install git+ssh://git@github.com/Dataherald/dataherald-python.git
6363
```
6464

6565
Alternatively, you can build from source and install the wheel file:
@@ -82,11 +82,11 @@ pip install ./path-to-wheel-file.whl
8282

8383
## Running tests
8484

85-
Most tests will require you to [setup a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
85+
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
8686

8787
```bash
8888
# you will need npm installed
89-
npx prism path/to/your/openapi.yml
89+
npx prism mock path/to/your/openapi.yml
9090
```
9191

9292
```bash
@@ -117,9 +117,9 @@ the changes aren't made through the automated pipeline, you may want to make rel
117117

118118
### Publish with a GitHub workflow
119119

120-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/Dataherald/dataherald-python/actions/workflows/publish-pypi.yml). This will require a setup organization or repository secret to be set up.
120+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/Dataherald/dataherald-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
121121

122122
### Publish manually
123123

124-
If you need to manually release a package, you can run the `bin/publish-pypi` script with an `PYPI_TOKEN` set on
124+
If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
125125
the environment.

README.md

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@ The Dataherald Python library provides convenient access to the Dataherald REST
66
application. The library includes type definitions for all request params and response fields,
77
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
88

9+
It is generated with [Stainless](https://www.stainlessapi.com/).
10+
911
## Documentation
1012

1113
The REST API documentation can be found [on dataherald.readthedocs.io](https://dataherald.readthedocs.io/en/latest/). The full API of this library can be found in [api.md](api.md).
1214

1315
## Installation
1416

1517
```sh
18+
# install from PyPI
1619
pip install dataherald
1720
```
1821

@@ -21,12 +24,9 @@ pip install dataherald
2124
The full API of this library can be found in [api.md](api.md).
2225

2326
```python
24-
import os
2527
from dataherald import Dataherald
2628

2729
client = Dataherald(
28-
# This is the default and can be omitted
29-
api_key=os.environ.get("DATAHERALD_API_KEY"),
3030
# defaults to "production".
3131
environment="staging",
3232
)
@@ -48,13 +48,10 @@ so that your API Key is not stored in source control.
4848
Simply import `AsyncDataherald` instead of `Dataherald` and use `await` with each API call:
4949

5050
```python
51-
import os
5251
import asyncio
5352
from dataherald import AsyncDataherald
5453

5554
client = AsyncDataherald(
56-
# This is the default and can be omitted
57-
api_key=os.environ.get("DATAHERALD_API_KEY"),
5855
# defaults to "production".
5956
environment="staging",
6057
)
@@ -75,10 +72,10 @@ Functionality between the synchronous and asynchronous clients is otherwise iden
7572

7673
## Using types
7774

78-
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like:
75+
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
7976

80-
- Serializing back into JSON, `model.model_dump_json(indent=2, exclude_unset=True)`
81-
- Converting to a dictionary, `model.model_dump(exclude_unset=True)`
77+
- Serializing back into JSON, `model.to_json()`
78+
- Converting to a dictionary, `model.to_dict()`
8279

8380
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`.
8481

@@ -128,7 +125,7 @@ Error codes are as followed:
128125

129126
### Retries
130127

131-
Certain errors are automatically retried 0 times by default, with a short exponential backoff.
128+
Certain errors are automatically retried 2 times by default, with a short exponential backoff.
132129
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
133130
429 Rate Limit, and >=500 Internal errors are all retried by default.
134131

@@ -170,7 +167,7 @@ client = Dataherald(
170167
)
171168

172169
# Override per-request:
173-
client.with_options(timeout=5 * 1000).database_connections.create(
170+
client.with_options(timeout=5.0).database_connections.create(
174171
alias="string",
175172
connection_uri="string",
176173
)
@@ -245,6 +242,41 @@ with client.database_connections.with_streaming_response.create(
245242

246243
The context manager is required so that the response will reliably be closed.
247244

245+
### Making custom/undocumented requests
246+
247+
This library is typed for convenient access to the documented API.
248+
249+
If you need to access undocumented endpoints, params, or response properties, the library can still be used.
250+
251+
#### Undocumented endpoints
252+
253+
To make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other
254+
http verbs. Options on the client will be respected (such as retries) will be respected when making this
255+
request.
256+
257+
```py
258+
import httpx
259+
260+
response = client.post(
261+
"/foo",
262+
cast_to=httpx.Response,
263+
body={"my_param": True},
264+
)
265+
266+
print(response.headers.get("x-foo"))
267+
```
268+
269+
#### Undocumented request params
270+
271+
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request
272+
options.
273+
274+
#### Undocumented response properties
275+
276+
To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You
277+
can also get all the extra fields on the Pydantic model as a dict with
278+
[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).
279+
248280
### Configuring the HTTP client
249281

250282
You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:
@@ -254,13 +286,12 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
254286
- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality
255287

256288
```python
257-
import httpx
258-
from dataherald import Dataherald
289+
from dataherald import Dataherald, DefaultHttpxClient
259290

260291
client = Dataherald(
261292
# Or use the `DATAHERALD_BASE_URL` env var
262293
base_url="http://my.test.server.example.com:8083",
263-
http_client=httpx.Client(
294+
http_client=DefaultHttpxClient(
264295
proxies="http://my.test.proxy.example.com",
265296
transport=httpx.HTTPTransport(local_address="0.0.0.0"),
266297
),

0 commit comments

Comments
 (0)