Skip to content

Commit 2588250

Browse files
Stainless Botstainless-app[bot]
Stainless Bot
authored andcommitted
feat(api): manual updates (#360)
1 parent f1c1ea6 commit 2588250

34 files changed

+1072
-139
lines changed

.release-please-manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
".": "0.2.0-alpha.31"
3-
}
3+
}

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 13
1+
configured_endpoints: 14

CONTRIBUTING.md

+28-24
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
### With Rye
44

5-
We use [Rye](https://rye.astral.sh/) to manage dependencies so we highly recommend [installing it](https://rye.astral.sh/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/openlayer/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/openlayer/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://git@github.com/openlayer-ai/openlayer-python.git
65+
```sh
66+
$ pip install git+ssh://git@github.com/openlayer-ai/openlayer-python.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

+26-11
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ client = Openlayer(
3232
api_key=os.environ.get("OPENLAYER_API_KEY"),
3333
)
3434

35-
data_stream_response = client.inference_pipelines.data.stream(
35+
response = client.inference_pipelines.data.stream(
3636
inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
3737
config={
3838
"input_variable_names": ["user_query"],
@@ -47,11 +47,11 @@ data_stream_response = client.inference_pipelines.data.stream(
4747
"output": "42",
4848
"tokens": 7,
4949
"cost": 0.02,
50-
"timestamp": 1620000000,
50+
"timestamp": 1610000000,
5151
}
5252
],
5353
)
54-
print(data_stream_response.success)
54+
print(response.success)
5555
```
5656

5757
While you can provide an `api_key` keyword argument,
@@ -75,7 +75,7 @@ client = AsyncOpenlayer(
7575

7676

7777
async def main() -> None:
78-
data_stream_response = await client.inference_pipelines.data.stream(
78+
response = await client.inference_pipelines.data.stream(
7979
inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
8080
config={
8181
"input_variable_names": ["user_query"],
@@ -90,11 +90,11 @@ async def main() -> None:
9090
"output": "42",
9191
"tokens": 7,
9292
"cost": 0.02,
93-
"timestamp": 1620000000,
93+
"timestamp": 1610000000,
9494
}
9595
],
9696
)
97-
print(data_stream_response.success)
97+
print(response.success)
9898

9999

100100
asyncio.run(main())
@@ -142,7 +142,7 @@ try:
142142
"output": "42",
143143
"tokens": 7,
144144
"cost": 0.02,
145-
"timestamp": 1620000000,
145+
"timestamp": 1610000000,
146146
}
147147
],
148148
)
@@ -203,7 +203,7 @@ client.with_options(max_retries=5).inference_pipelines.data.stream(
203203
"output": "42",
204204
"tokens": 7,
205205
"cost": 0.02,
206-
"timestamp": 1620000000,
206+
"timestamp": 1610000000,
207207
}
208208
],
209209
)
@@ -244,7 +244,7 @@ client.with_options(timeout=5.0).inference_pipelines.data.stream(
244244
"output": "42",
245245
"tokens": 7,
246246
"cost": 0.02,
247-
"timestamp": 1620000000,
247+
"timestamp": 1610000000,
248248
}
249249
],
250250
)
@@ -300,7 +300,7 @@ response = client.inference_pipelines.data.with_raw_response.stream(
300300
"output": "42",
301301
"tokens": 7,
302302
"cost": 0.02,
303-
"timestamp": 1620000000,
303+
"timestamp": 1610000000,
304304
}],
305305
)
306306
print(response.headers.get('X-My-Header'))
@@ -335,7 +335,7 @@ with client.inference_pipelines.data.with_streaming_response.stream(
335335
"output": "42",
336336
"tokens": 7,
337337
"cost": 0.02,
338-
"timestamp": 1620000000,
338+
"timestamp": 1610000000,
339339
}
340340
],
341341
) as response:
@@ -425,6 +425,21 @@ We take backwards-compatibility seriously and work hard to ensure you can rely o
425425

426426
We are keen for your feedback; please open an [issue](https://www.github.com/openlayer-ai/openlayer-python/issues) with questions, bugs, or suggestions.
427427

428+
### Determining the installed version
429+
430+
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.
431+
432+
You can determine the version that is being used at runtime with:
433+
434+
```py
435+
import openlayer
436+
print(openlayer.__version__)
437+
```
438+
428439
## Requirements
429440

430441
Python 3.7 or higher.
442+
443+
## Contributing
444+
445+
See [the contributing documentation](./CONTRIBUTING.md).

api.md

+10
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ Methods:
3838

3939
# Commits
4040

41+
Types:
42+
43+
```python
44+
from openlayer.types import CommitCreateResponse
45+
```
46+
47+
Methods:
48+
49+
- <code title="post /projects/{projectId}/versions">client.commits.<a href="./src/openlayer/resources/commits/commits.py">create</a>(project_id, \*\*<a href="src/openlayer/types/commit_create_params.py">params</a>) -> <a href="./src/openlayer/types/commit_create_response.py">CommitCreateResponse</a></code>
50+
4151
## TestResults
4252

4353
Types:

pyproject.toml

+2-9
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ classifiers = [
3939
"License :: OSI Approved :: Apache Software License"
4040
]
4141

42-
43-
4442
[project.urls]
4543
Homepage = "https://github.com/openlayer-ai/openlayer-python"
4644
Repository = "https://github.com/openlayer-ai/openlayer-python"
@@ -62,19 +60,18 @@ dev-dependencies = [
6260
"dirty-equals>=0.6.0",
6361
"importlib-metadata>=6.7.0",
6462
"rich>=13.7.1",
65-
6663
]
6764

6865
[tool.rye.scripts]
6966
format = { chain = [
7067
"format:ruff",
7168
"format:docs",
7269
"fix:ruff",
70+
# run formatting again to fix any inconsistencies when imports are stripped
71+
"format:ruff",
7372
]}
74-
"format:black" = "black ."
7573
"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md"
7674
"format:ruff" = "ruff format"
77-
"format:isort" = "isort ."
7875

7976
"lint" = { chain = [
8077
"check:ruff",
@@ -132,10 +129,6 @@ path = "README.md"
132129
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
133130
replacement = '[\1](https://github.com/openlayer-ai/openlayer-python/tree/main/\g<2>)'
134131

135-
[tool.black]
136-
line-length = 120
137-
target-version = ["py37"]
138-
139132
[tool.pytest.ini_options]
140133
testpaths = ["tests"]
141134
addopts = "--tb=short"

requirements-dev.lock

+12-15
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ anyio==4.4.0
1616
# via openlayer
1717
argcomplete==3.1.2
1818
# via nox
19-
attrs==23.1.0
20-
# via pytest
2119
certifi==2023.7.22
2220
# via httpcore
2321
# via httpx
@@ -28,8 +26,9 @@ distlib==0.3.7
2826
# via virtualenv
2927
distro==1.8.0
3028
# via openlayer
31-
exceptiongroup==1.1.3
29+
exceptiongroup==1.2.2
3230
# via anyio
31+
# via pytest
3332
filelock==3.12.4
3433
# via virtualenv
3534
h11==0.14.0
@@ -49,7 +48,7 @@ markdown-it-py==3.0.0
4948
# via rich
5049
mdurl==0.1.2
5150
# via markdown-it-py
52-
mypy==1.10.1
51+
mypy==1.11.2
5352
mypy-extensions==1.0.0
5453
# via mypy
5554
nodeenv==1.8.0
@@ -64,20 +63,18 @@ pandas==2.2.2
6463
# via openlayer
6564
platformdirs==3.11.0
6665
# via virtualenv
67-
pluggy==1.3.0
68-
# via pytest
69-
py==1.11.0
66+
pluggy==1.5.0
7067
# via pytest
71-
pydantic==2.7.1
68+
pydantic==2.9.2
7269
# via openlayer
73-
pydantic-core==2.18.2
70+
pydantic-core==2.23.4
7471
# via pydantic
7572
pygments==2.18.0
7673
# via rich
77-
pyright==1.1.374
78-
pytest==7.1.1
74+
pyright==1.1.380
75+
pytest==8.3.3
7976
# via pytest-asyncio
80-
pytest-asyncio==0.21.1
77+
pytest-asyncio==0.24.0
8178
python-dateutil==2.8.2
8279
# via pandas
8380
# via time-machine
@@ -86,7 +83,7 @@ pytz==2023.3.post1
8683
# via pandas
8784
respx==0.20.2
8885
rich==13.7.1
89-
ruff==0.5.6
86+
ruff==0.6.9
9087
setuptools==68.2.2
9188
# via nodeenv
9289
six==1.16.0
@@ -96,10 +93,10 @@ sniffio==1.3.0
9693
# via httpx
9794
# via openlayer
9895
time-machine==2.9.0
99-
tomli==2.0.1
96+
tomli==2.0.2
10097
# via mypy
10198
# via pytest
102-
typing-extensions==4.8.0
99+
typing-extensions==4.12.2
103100
# via anyio
104101
# via mypy
105102
# via openlayer

0 commit comments

Comments
 (0)