Skip to content

Commit 3f06cb7

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
chore: rebuild project due to codegen change (#56)
1 parent 762488e commit 3f06cb7

File tree

73 files changed

+1720
-893
lines changed

Some content is hidden

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

73 files changed

+1720
-893
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
33

44
USER vscode
55

6-
RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
77
ENV PATH=/home/vscode/.rye/shims:$PATH
88

99
RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
pull_request:
77
branches:
88
- main
9+
- next
910

1011
jobs:
1112
lint:
@@ -18,10 +19,10 @@ jobs:
1819

1920
- name: Install Rye
2021
run: |
21-
curl -sSf https://rye-up.com/get | bash
22+
curl -sSf https://rye.astral.sh/get | bash
2223
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2324
env:
24-
RYE_VERSION: 0.24.0
25+
RYE_VERSION: '0.35.0'
2526
RYE_INSTALL_OPTION: '--yes'
2627

2728
- name: Install dependencies
@@ -38,10 +39,10 @@ jobs:
3839

3940
- name: Install Rye
4041
run: |
41-
curl -sSf https://rye-up.com/get | bash
42+
curl -sSf https://rye.astral.sh/get | bash
4243
echo "$HOME/.rye/shims" >> $GITHUB_PATH
4344
env:
44-
RYE_VERSION: 0.24.0
45+
RYE_VERSION: '0.35.0'
4546
RYE_INSTALL_OPTION: '--yes'
4647

4748
- name: Bootstrap

.github/workflows/publish-pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818

1919
- name: Install Rye
2020
run: |
21-
curl -sSf https://rye-up.com/get | bash
21+
curl -sSf https://rye.astral.sh/get | bash
2222
echo "$HOME/.rye/shims" >> $GITHUB_PATH
2323
env:
24-
RYE_VERSION: 0.24.0
25-
RYE_INSTALL_OPTION: "--yes"
24+
RYE_VERSION: '0.35.0'
25+
RYE_INSTALL_OPTION: '--yes'
2626

2727
- name: Publish to PyPI
2828
run: |

.github/workflows/release-doctor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Release Doctor
22
on:
33
pull_request:
4+
branches:
5+
- main
46
workflow_dispatch:
57

68
jobs:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.prism.log
12
.vscode
23
_dev
34

CONTRIBUTING.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
### With Rye
44

5-
We use [Rye](https://rye-up.com/) to manage dependencies so we highly recommend [installing it](https://rye-up.com/guide/installation/) as it will automatically provision a Python environment with the expected Python version.
5+
We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:
66

7-
After installing Rye, you'll just have to run this command:
7+
```sh
8+
$ ./scripts/bootstrap
9+
```
10+
11+
Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
812

913
```sh
1014
$ rye sync --all-features
@@ -31,25 +35,25 @@ $ pip install -r requirements-dev.lock
3135

3236
## Modifying/Adding code
3337

34-
Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
35-
`src/dataherald/lib/` and `examples/` directories are exceptions and will never be overridden.
38+
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
39+
result in merge conflicts between manual patches and changes from the generator. The generator will never
40+
modify the contents of the `src/dataherald/lib/` and `examples/` directories.
3641

3742
## Adding and running examples
3843

39-
All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
40-
added to.
44+
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
4145

42-
```bash
46+
```py
4347
# add an example to examples/<your-example>.py
4448

4549
#!/usr/bin/env -S rye run python
4650
4751
```
4852

49-
```
50-
chmod +x examples/<your-example>.py
53+
```sh
54+
$ chmod +x examples/<your-example>.py
5155
# run the example against your api
52-
./examples/<your-example>.py
56+
$ ./examples/<your-example>.py
5357
```
5458

5559
## Using the repository from source
@@ -58,8 +62,8 @@ If you’d like to use the repository from source, you can either install from g
5862

5963
To install via git:
6064

61-
```bash
62-
pip install git+ssh://[email protected]/Dataherald/dataherald-python#main.git
65+
```sh
66+
$ pip install git+ssh://[email protected]/Dataherald/dataherald-python#main.git
6367
```
6468

6569
Alternatively, you can build from source and install the wheel file:
@@ -68,29 +72,29 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz
6872

6973
To create a distributable version of the library, all you have to do is run this command:
7074

71-
```bash
72-
rye build
75+
```sh
76+
$ rye build
7377
# or
74-
python -m build
78+
$ python -m build
7579
```
7680

7781
Then to install:
7882

7983
```sh
80-
pip install ./path-to-wheel-file.whl
84+
$ pip install ./path-to-wheel-file.whl
8185
```
8286

8387
## Running tests
8488

8589
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
8690

87-
```bash
91+
```sh
8892
# you will need npm installed
89-
npx prism mock path/to/your/openapi.yml
93+
$ npx prism mock path/to/your/openapi.yml
9094
```
9195

92-
```bash
93-
rye run pytest
96+
```sh
97+
$ ./scripts/test
9498
```
9599

96100
## Linting and formatting
@@ -100,14 +104,14 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and
100104

101105
To lint:
102106

103-
```bash
104-
rye run lint
107+
```sh
108+
$ ./scripts/lint
105109
```
106110

107111
To format and fix all ruff issues automatically:
108112

109-
```bash
110-
rye run format
113+
```sh
114+
$ ./scripts/format
111115
```
112116

113117
## Publishing and releases

README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
[![PyPI version](https://img.shields.io/pypi/v/dataherald.svg)](https://pypi.org/project/dataherald/)
44

5-
The Dataherald Python library provides convenient access to the Dataherald REST API from any Python 3.7+
5+
The Dataherald Python library provides convenient access to the Dataherald REST API from any Python 3.8+
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

99
It is generated with [Stainless](https://www.stainlessapi.com/).
1010

1111
## Documentation
1212

13-
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).
13+
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).
1414

1515
## Installation
1616

@@ -32,8 +32,8 @@ client = Dataherald(
3232
)
3333

3434
db_connection_response = client.database_connections.create(
35-
alias="string",
36-
connection_uri="string",
35+
alias="alias",
36+
connection_uri="connection_uri",
3737
)
3838
print(db_connection_response.id)
3939
```
@@ -59,8 +59,8 @@ client = AsyncDataherald(
5959

6060
async def main() -> None:
6161
db_connection_response = await client.database_connections.create(
62-
alias="string",
63-
connection_uri="string",
62+
alias="alias",
63+
connection_uri="connection_uri",
6464
)
6565
print(db_connection_response.id)
6666

@@ -96,8 +96,8 @@ client = Dataherald()
9696

9797
try:
9898
client.database_connections.create(
99-
alias="string",
100-
connection_uri="string",
99+
alias="alias",
100+
connection_uri="connection_uri",
101101
)
102102
except dataherald.APIConnectionError as e:
103103
print("The server could not be reached")
@@ -142,8 +142,8 @@ client = Dataherald(
142142

143143
# Or, configure per-request:
144144
client.with_options(max_retries=5).database_connections.create(
145-
alias="string",
146-
connection_uri="string",
145+
alias="alias",
146+
connection_uri="connection_uri",
147147
)
148148
```
149149

@@ -168,8 +168,8 @@ client = Dataherald(
168168

169169
# Override per-request:
170170
client.with_options(timeout=5.0).database_connections.create(
171-
alias="string",
172-
connection_uri="string",
171+
alias="alias",
172+
connection_uri="connection_uri",
173173
)
174174
```
175175

@@ -210,8 +210,8 @@ from dataherald import Dataherald
210210

211211
client = Dataherald()
212212
response = client.database_connections.with_raw_response.create(
213-
alias="string",
214-
connection_uri="string",
213+
alias="alias",
214+
connection_uri="connection_uri",
215215
)
216216
print(response.headers.get('X-My-Header'))
217217

@@ -231,8 +231,8 @@ To stream the response body, use `.with_streaming_response` instead, which requi
231231

232232
```python
233233
with client.database_connections.with_streaming_response.create(
234-
alias="string",
235-
connection_uri="string",
234+
alias="alias",
235+
connection_uri="connection_uri",
236236
) as response:
237237
print(response.headers.get("X-My-Header"))
238238

@@ -283,7 +283,7 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
283283

284284
- Support for proxies
285285
- Custom transports
286-
- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality
286+
- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality
287287

288288
```python
289289
from dataherald import Dataherald, DefaultHttpxClient
@@ -298,6 +298,12 @@ client = Dataherald(
298298
)
299299
```
300300

301+
You can also customize the client on a per-request basis by using `with_options()`:
302+
303+
```python
304+
client.with_options(http_client=DefaultHttpxClient(...))
305+
```
306+
301307
### Managing HTTP resources
302308

303309
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
@@ -314,6 +320,21 @@ We take backwards-compatibility seriously and work hard to ensure you can rely o
314320

315321
We are keen for your feedback; please open an [issue](https://www.github.com/Dataherald/dataherald-python/issues) with questions, bugs, or suggestions.
316322

323+
### Determining the installed version
324+
325+
If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version.
326+
327+
You can determine the version that is being used at runtime with:
328+
329+
```py
330+
import dataherald
331+
print(dataherald.__version__)
332+
```
333+
317334
## Requirements
318335

319-
Python 3.7 or higher.
336+
Python 3.8 or higher.
337+
338+
## Contributing
339+
340+
See [the contributing documentation](./CONTRIBUTING.md).

bin/publish-pypi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
set -eux
44
mkdir -p dist
55
rye build --clean
6+
# Patching importlib-metadata version until upstream library version is updated
7+
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
8+
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
69
rye publish --yes --token=$PYPI_TOKEN

0 commit comments

Comments
 (0)