Skip to content

Commit d690171

Browse files
authored
Merge pull request #1 from Not-Diamond/release-please--branches--main--changes--next
release: 0.1.0
2 parents 1cb2087 + 566d68c commit d690171

54 files changed

Lines changed: 392 additions & 2167 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: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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/Not-Diamond/not-diamond-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@v4
18+
19+
- name: Install Rye
20+
run: |
21+
curl -sSf https://rye.astral.sh/get | bash
22+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
23+
env:
24+
RYE_VERSION: '0.44.0'
25+
RYE_INSTALL_OPTION: '--yes'
26+
27+
- name: Publish to PyPI
28+
run: |
29+
bash ./bin/publish-pypi
30+
env:
31+
PYPI_TOKEN: ${{ secrets.NOT_DIAMOND_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 == 'Not-Diamond/not-diamond-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@v4
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
PYPI_TOKEN: ${{ secrets.NOT_DIAMOND_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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 62
1+
configured_endpoints: 57
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnot-diamond-16cbc3880d2b786cefa8c80a6dd1129791483c0b487955104c68a5c13f00a69b.yml
33
openapi_spec_hash: 4c16e5753f4b9e0a20dd01706c5d07d7
4-
config_hash: 7a7b41bad030056cc97c625ec505912b
4+
config_hash: 9677dbeed46c9972dd85705a35091068

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
## 0.1.0 (2025-10-09)
4+
5+
Full Changelog: [v0.0.1...v0.1.0](https://github.com/Not-Diamond/not-diamond-python/compare/v0.0.1...v0.1.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([8062369](https://github.com/Not-Diamond/not-diamond-python/commit/80623692c7da0db7c57b7953af3ec9fdc1e0fca2))
10+
11+
12+
### Chores
13+
14+
* update SDK settings ([ecc0dc6](https://github.com/Not-Diamond/not-diamond-python/commit/ecc0dc63a8d98e9d2178f04cebde730257bae353))

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/not-diamond-python.git
65+
$ pip install git+ssh://git@github.com/Not-Diamond/not-diamond-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/not-diamond-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/Not-Diamond/not-diamond-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: 26 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ The full API of this library can be found in [api.md](api.md).
1616
## Installation
1717

1818
```sh
19-
# install from this staging repo
20-
pip install git+ssh://git@github.com/stainless-sdks/not-diamond-python.git
19+
# install from the production repo
20+
pip install git+ssh://git@github.com/Not-Diamond/not-diamond-python.git
2121
```
2222

2323
> [!NOTE]
@@ -28,19 +28,14 @@ pip install git+ssh://git@github.com/stainless-sdks/not-diamond-python.git
2828
The full API of this library can be found in [api.md](api.md).
2929

3030
```python
31+
import os
3132
from not_diamond import NotDiamond
3233

33-
client = NotDiamond()
34-
35-
response = client.optimizer.select_model(
36-
llm_providers=[
37-
{
38-
"model": "model",
39-
"provider": "provider",
40-
}
41-
],
42-
messages=[{"foo": "string"}],
34+
client = NotDiamond(
35+
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
4336
)
37+
38+
response = client.retrieve_root()
4439
```
4540

4641
While you can provide an `api_key` keyword argument,
@@ -53,22 +48,17 @@ so that your API Key is not stored in source control.
5348
Simply import `AsyncNotDiamond` instead of `NotDiamond` and use `await` with each API call:
5449

5550
```python
51+
import os
5652
import asyncio
5753
from not_diamond import AsyncNotDiamond
5854

59-
client = AsyncNotDiamond()
55+
client = AsyncNotDiamond(
56+
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
57+
)
6058

6159

6260
async def main() -> None:
63-
response = await client.optimizer.select_model(
64-
llm_providers=[
65-
{
66-
"model": "model",
67-
"provider": "provider",
68-
}
69-
],
70-
messages=[{"foo": "string"}],
71-
)
61+
response = await client.retrieve_root()
7262

7363

7464
asyncio.run(main())
@@ -83,8 +73,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
8373
You can enable this by installing `aiohttp`:
8474

8575
```sh
86-
# install from this staging repo
87-
pip install 'not_diamond[aiohttp] @ git+ssh://git@github.com/stainless-sdks/not-diamond-python.git'
76+
# install from the production repo
77+
pip install 'not_diamond[aiohttp] @ git+ssh://git@github.com/Not-Diamond/not-diamond-python.git'
8878
```
8979

9080
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
@@ -97,17 +87,10 @@ from not_diamond import AsyncNotDiamond
9787

9888
async def main() -> None:
9989
async with AsyncNotDiamond(
90+
api_key="My API Key",
10091
http_client=DefaultAioHttpClient(),
10192
) as client:
102-
response = await client.optimizer.select_model(
103-
llm_providers=[
104-
{
105-
"model": "model",
106-
"provider": "provider",
107-
}
108-
],
109-
messages=[{"foo": "string"}],
110-
)
93+
response = await client.retrieve_root()
11194

11295

11396
asyncio.run(main())
@@ -182,15 +165,7 @@ from not_diamond import NotDiamond
182165
client = NotDiamond()
183166

184167
try:
185-
client.optimizer.select_model(
186-
llm_providers=[
187-
{
188-
"model": "model",
189-
"provider": "provider",
190-
}
191-
],
192-
messages=[{"foo": "string"}],
193-
)
168+
client.retrieve_root()
194169
except not_diamond.APIConnectionError as e:
195170
print("The server could not be reached")
196171
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -233,15 +208,7 @@ client = NotDiamond(
233208
)
234209

235210
# Or, configure per-request:
236-
client.with_options(max_retries=5).optimizer.select_model(
237-
llm_providers=[
238-
{
239-
"model": "model",
240-
"provider": "provider",
241-
}
242-
],
243-
messages=[{"foo": "string"}],
244-
)
211+
client.with_options(max_retries=5).retrieve_root()
245212
```
246213

247214
### Timeouts
@@ -264,15 +231,7 @@ client = NotDiamond(
264231
)
265232

266233
# Override per-request:
267-
client.with_options(timeout=5.0).optimizer.select_model(
268-
llm_providers=[
269-
{
270-
"model": "model",
271-
"provider": "provider",
272-
}
273-
],
274-
messages=[{"foo": "string"}],
275-
)
234+
client.with_options(timeout=5.0).retrieve_root()
276235
```
277236

278237
On timeout, an `APITimeoutError` is thrown.
@@ -313,24 +272,16 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
313272
from not_diamond import NotDiamond
314273

315274
client = NotDiamond()
316-
response = client.optimizer.with_raw_response.select_model(
317-
llm_providers=[{
318-
"model": "model",
319-
"provider": "provider",
320-
}],
321-
messages=[{
322-
"foo": "string"
323-
}],
324-
)
275+
response = client.with_raw_response.retrieve_root()
325276
print(response.headers.get('X-My-Header'))
326277

327-
optimizer = response.parse() # get the object that `optimizer.select_model()` would have returned
328-
print(optimizer)
278+
client = response.parse() # get the object that `retrieve_root()` would have returned
279+
print(client)
329280
```
330281

331-
These methods return an [`APIResponse`](https://github.com/stainless-sdks/not-diamond-python/tree/main/src/not_diamond/_response.py) object.
282+
These methods return an [`APIResponse`](https://github.com/Not-Diamond/not-diamond-python/tree/main/src/not_diamond/_response.py) object.
332283

333-
The async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/not-diamond-python/tree/main/src/not_diamond/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
284+
The async client returns an [`AsyncAPIResponse`](https://github.com/Not-Diamond/not-diamond-python/tree/main/src/not_diamond/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
334285

335286
#### `.with_streaming_response`
336287

@@ -339,15 +290,7 @@ The above interface eagerly reads the full response body when you make the reque
339290
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.
340291

341292
```python
342-
with client.optimizer.with_streaming_response.select_model(
343-
llm_providers=[
344-
{
345-
"model": "model",
346-
"provider": "provider",
347-
}
348-
],
349-
messages=[{"foo": "string"}],
350-
) as response:
293+
with client.with_streaming_response.retrieve_root() as response:
351294
print(response.headers.get("X-My-Header"))
352295

353296
for line in response.iter_lines():
@@ -442,7 +385,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
442385

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

445-
We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/not-diamond-python/issues) with questions, bugs, or suggestions.
388+
We are keen for your feedback; please open an [issue](https://www.github.com/Not-Diamond/not-diamond-python/issues) with questions, bugs, or suggestions.
446389

447390
### Determining the installed version
448391

api.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@ Methods:
1010

1111
- <code title="get /">client.<a href="./src/not_diamond/_client.py">retrieve_root</a>() -> <a href="./src/not_diamond/types/retrieve_root_response.py">RetrieveRootResponse</a></code>
1212

13-
# Optimizer
14-
15-
Types:
16-
17-
```python
18-
from not_diamond.types import FrontendHashOptimizerRequest, OpenRouterProvider, OptimizerBaseRequest
19-
```
20-
21-
Methods:
22-
23-
- <code title="post /v2/optimizer/frontendArenaModels">client.optimizer.<a href="./src/not_diamond/resources/optimizer.py">get_frontend_arena_models</a>(\*\*<a href="src/not_diamond/types/optimizer_get_frontend_arena_models_params.py">params</a>) -> object</code>
24-
- <code title="post /v2/optimizer/frontendHashModelSelect">client.optimizer.<a href="./src/not_diamond/resources/optimizer.py">select_frontend_hash_model</a>(\*\*<a href="src/not_diamond/types/optimizer_select_frontend_hash_model_params.py">params</a>) -> object</code>
25-
- <code title="post /v2/optimizer/hashModelSelect">client.optimizer.<a href="./src/not_diamond/resources/optimizer.py">select_hash_model</a>(\*\*<a href="src/not_diamond/types/optimizer_select_hash_model_params.py">params</a>) -> object</code>
26-
- <code title="post /v2/optimizer/modelSelect">client.optimizer.<a href="./src/not_diamond/resources/optimizer.py">select_model</a>(\*\*<a href="src/not_diamond/types/optimizer_select_model_params.py">params</a>) -> object</code>
27-
- <code title="post /v2/optimizer/userIDModelSelect">client.optimizer.<a href="./src/not_diamond/resources/optimizer.py">select_userid_model</a>(\*\*<a href="src/not_diamond/types/optimizer_select_userid_model_params.py">params</a>) -> object</code>
28-
2913
# ModelRouter
3014

3115
Methods:

bin/check-release-environment

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
errors=()
4+
5+
if [ -z "${PYPI_TOKEN}" ]; then
6+
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
7+
fi
8+
9+
lenErrors=${#errors[@]}
10+
11+
if [[ lenErrors -gt 0 ]]; then
12+
echo -e "Found the following errors in the release environment:\n"
13+
14+
for error in "${errors[@]}"; do
15+
echo -e "- $error\n"
16+
done
17+
18+
exit 1
19+
fi
20+
21+
echo "The environment is ready to push releases!"

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "not_diamond"
3-
version = "0.0.1"
3+
version = "0.1.0"
44
description = "The official Python library for the not-diamond API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -35,8 +35,8 @@ classifiers = [
3535
]
3636

3737
[project.urls]
38-
Homepage = "https://github.com/stainless-sdks/not-diamond-python"
39-
Repository = "https://github.com/stainless-sdks/not-diamond-python"
38+
Homepage = "https://github.com/Not-Diamond/not-diamond-python"
39+
Repository = "https://github.com/Not-Diamond/not-diamond-python"
4040

4141
[project.optional-dependencies]
4242
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
@@ -124,7 +124,7 @@ path = "README.md"
124124
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
125125
# replace relative links with absolute links
126126
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
127-
replacement = '[\1](https://github.com/stainless-sdks/not-diamond-python/tree/main/\g<2>)'
127+
replacement = '[\1](https://github.com/Not-Diamond/not-diamond-python/tree/main/\g<2>)'
128128

129129
[tool.pytest.ini_options]
130130
testpaths = ["tests"]

0 commit comments

Comments
 (0)