Skip to content

Commit d6efb9d

Browse files
initial commit
1 parent b5c8c6d commit d6efb9d

File tree

414 files changed

+61733
-1
lines changed

Some content is hidden

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

414 files changed

+61733
-1
lines changed

.devcontainer/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ARG VARIANT="3.9"
2+
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
3+
4+
USER vscode
5+
6+
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
7+
ENV PATH=/home/vscode/.rye/shims:$PATH
8+
9+
RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc

.devcontainer/devcontainer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Debian",
5+
"build": {
6+
"dockerfile": "Dockerfile",
7+
"context": ".."
8+
},
9+
10+
"postStartCommand": "rye sync --all-features",
11+
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-python.python"
16+
],
17+
"settings": {
18+
"terminal.integrated.shell.linux": "/bin/bash",
19+
"python.pythonPath": ".venv/bin/python",
20+
"python.defaultInterpreterPath": ".venv/bin/python",
21+
"python.typeChecking": "basic",
22+
"terminal.integrated.env.linux": {
23+
"PATH": "/home/vscode/.rye/shims:${env:PATH}"
24+
}
25+
}
26+
}
27+
},
28+
"features": {
29+
"ghcr.io/devcontainers/features/node:1": {}
30+
}
31+
32+
// Features to add to the dev container. More info: https://containers.dev/features.
33+
// "features": {},
34+
35+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
36+
// "forwardPorts": [],
37+
38+
// Configure tool-specific properties.
39+
// "customizations": {},
40+
41+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
42+
// "remoteUser": "root"
43+
}

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
on:
3+
push:
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'stl-preview-head/**'
9+
- 'stl-preview-base/**'
10+
11+
jobs:
12+
lint:
13+
timeout-minutes: 10
14+
name: lint
15+
runs-on: ${{ github.repository == 'stainless-sdks/digitalocean-genai-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
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: Install dependencies
28+
run: rye sync --all-features
29+
30+
- name: Run lints
31+
run: ./scripts/lint
32+
33+
upload:
34+
if: github.repository == 'stainless-sdks/digitalocean-genai-sdk-python'
35+
timeout-minutes: 10
36+
name: upload
37+
permissions:
38+
contents: read
39+
id-token: write
40+
runs-on: depot-ubuntu-24.04
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Get GitHub OIDC Token
45+
id: github-oidc
46+
uses: actions/github-script@v6
47+
with:
48+
script: core.setOutput('github_token', await core.getIDToken());
49+
50+
- name: Upload tarball
51+
env:
52+
URL: https://pkg.stainless.com/s
53+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
54+
SHA: ${{ github.sha }}
55+
run: ./scripts/utils/upload-artifact.sh
56+
57+
test:
58+
timeout-minutes: 10
59+
name: test
60+
runs-on: ${{ github.repository == 'stainless-sdks/digitalocean-genai-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Install Rye
65+
run: |
66+
curl -sSf https://rye.astral.sh/get | bash
67+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
68+
env:
69+
RYE_VERSION: '0.44.0'
70+
RYE_INSTALL_OPTION: '--yes'
71+
72+
- name: Bootstrap
73+
run: ./scripts/bootstrap
74+
75+
- name: Run tests
76+
run: ./scripts/test

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.prism.log
2+
.vscode
3+
_dev
4+
5+
__pycache__
6+
.mypy_cache
7+
8+
dist
9+
10+
.venv
11+
.idea
12+
13+
.env
14+
.envrc
15+
codegen.log
16+
Brewfile.lock.json

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.9.18

.stats.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
configured_endpoints: 126
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/digitalocean%2Fdigitalocean-genai-sdk-bdf24159c6ebb5402d6c05a5165cb1501dc37cf6c664baa9eb318efb0f89dddd.yml
3+
openapi_spec_hash: 686329a97002025d118dc2367755c18d
4+
config_hash: 39a1554af43cd406e37b5ed5c943649c

Brewfile

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

CONTRIBUTING.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
## Setting up the environment
2+
3+
### With Rye
4+
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:
6+
7+
```sh
8+
$ ./scripts/bootstrap
9+
```
10+
11+
Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
12+
13+
```sh
14+
$ rye sync --all-features
15+
```
16+
17+
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
18+
19+
```sh
20+
$ rye shell
21+
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
22+
$ source .venv/bin/activate
23+
24+
# now you can omit the `rye run` prefix
25+
$ python script.py
26+
```
27+
28+
### Without Rye
29+
30+
Alternatively if you don't want to install `Rye`, you can stick with the standard `pip` setup by ensuring you have the Python version specified in `.python-version`, create a virtual environment however you desire and then install dependencies using this command:
31+
32+
```sh
33+
$ pip install -r requirements-dev.lock
34+
```
35+
36+
## Modifying/Adding code
37+
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/digitalocean_genai_sdk/lib/` and `examples/` directories.
41+
42+
## Adding and running examples
43+
44+
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
45+
46+
```py
47+
# add an example to examples/<your-example>.py
48+
49+
#!/usr/bin/env -S rye run python
50+
51+
```
52+
53+
```sh
54+
$ chmod +x examples/<your-example>.py
55+
# run the example against your api
56+
$ ./examples/<your-example>.py
57+
```
58+
59+
## Using the repository from source
60+
61+
If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
62+
63+
To install via git:
64+
65+
```sh
66+
$ pip install git+ssh://git@github.com/stainless-sdks/digitalocean-genai-sdk-python.git
67+
```
68+
69+
Alternatively, you can build from source and install the wheel file:
70+
71+
Building this package will create two files in the `dist/` directory, a `.tar.gz` containing the source files and a `.whl` that can be used to install the package efficiently.
72+
73+
To create a distributable version of the library, all you have to do is run this command:
74+
75+
```sh
76+
$ rye build
77+
# or
78+
$ python -m build
79+
```
80+
81+
Then to install:
82+
83+
```sh
84+
$ pip install ./path-to-wheel-file.whl
85+
```
86+
87+
## Running tests
88+
89+
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
90+
91+
```sh
92+
# you will need npm installed
93+
$ npx prism mock path/to/your/openapi.yml
94+
```
95+
96+
```sh
97+
$ ./scripts/test
98+
```
99+
100+
## Linting and formatting
101+
102+
This repository uses [ruff](https://github.com/astral-sh/ruff) and
103+
[black](https://github.com/psf/black) to format the code in the repository.
104+
105+
To lint:
106+
107+
```sh
108+
$ ./scripts/lint
109+
```
110+
111+
To format and fix all ruff issues automatically:
112+
113+
```sh
114+
$ ./scripts/format
115+
```
116+
117+
## Publishing and releases
118+
119+
Changes made to this repository via the automated release PR pipeline should publish to PyPI automatically. If
120+
the changes aren't made through the automated pipeline, you may want to make releases manually.
121+
122+
### Publish with a GitHub workflow
123+
124+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/stainless-sdks/digitalocean-genai-sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
125+
126+
### Publish manually
127+
128+
If you need to manually release a package, you can run the `bin/publish-pypi` script with a `PYPI_TOKEN` set on
129+
the environment.

LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2025 digitalocean-genai-sdk
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)