Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae76a37

Browse files
chore: configure new SDK language
1 parent 2b894d6 commit ae76a37

File tree

143 files changed

+25380
-1
lines changed
  • .devcontainer
    • Dockerfile
    • devcontainer.json
  • .github/workflows
    • ci.yml
  • .gitignore
  • .python-version
  • .stats.yml
  • .vscode
    • settings.json
  • Brewfile
  • CONTRIBUTING.md
  • LICENSE
  • README.md
  • SECURITY.md
  • api.md
  • bin
    • publish-pypi
  • examples
    • .keep
  • noxfile.py
  • pyproject.toml
  • requirements-dev.lock
  • requirements.lock
  • scripts
    • bootstrap
    • format
    • lint
    • mock
    • test
    • utils
      • ruffen-docs.py
      • upload-artifact.sh
  • src/chunkify
    • __init__.py
    • _base_client.py
    • _client.py
    • _compat.py
    • _constants.py
    • _exceptions.py
    • _files.py
    • _models.py
    • _qs.py
    • _resource.py
    • _response.py
    • _streaming.py
    • _types.py
    • _utils
      • __init__.py
      • _compat.py
      • _datetime_parse.py
      • _logs.py
      • _proxy.py
      • _reflection.py
      • _resources_proxy.py
      • _streams.py
      • _sync.py
      • _transform.py
      • _typing.py
      • _utils.py
    • _version.py
    • lib
      • .keep
    • pagination.py
    • py.typed
    • resources
      • __init__.py
      • files.py
      • jobs.py
      • notifications.py
      • projects.py
      • sources.py
      • storages.py
      • tokens.py
      • uploads.py
      • webhooks.py
    • types
      • __init__.py
      • api_file.py
      • file_list_params.py
      • file_retrieve_response.py
      • job.py
      • job_create_params.py
      • job_create_response.py
      • job_get_files_response.py
      • job_get_logs_params.py
      • job_get_logs_response.py
      • job_get_transcoders_response.py
      • job_list_params.py
      • job_retrieve_response.py
      • notification.py
      • notification_create_params.py
      • notification_create_response.py
      • notification_list_params.py
      • notification_retrieve_response.py
      • project.py
      • project_create_params.py
      • project_create_response.py
      • project_list_params.py
      • project_list_response.py
      • project_retrieve_response.py
      • project_update_params.py
      • response_ok.py
      • source.py
      • source_create_params.py
      • source_create_response.py
      • source_list_params.py
      • source_retrieve_response.py
      • storage.py
      • storage_create_params.py
      • storage_create_response.py
      • storage_list_response.py
      • storage_retrieve_response.py
      • token.py
      • token_create_params.py
      • token_create_response.py
      • token_list_response.py
      • upload.py
      • upload_create_params.py
      • upload_create_response.py
      • upload_list_params.py
      • upload_retrieve_response.py
      • webhook.py
      • webhook_create_params.py
      • webhook_create_response.py
      • webhook_list_response.py
      • webhook_retrieve_response.py
      • webhook_update_params.py
  • tests
    • __init__.py
    • api_resources
      • __init__.py
      • test_files.py
      • test_jobs.py
      • test_notifications.py
      • test_projects.py
      • test_sources.py
      • test_storages.py
      • test_tokens.py
      • test_uploads.py
      • test_webhooks.py
    • conftest.py
    • sample_file.txt
    • test_client.py
    • test_deepcopy.py
    • test_extract_files.py
    • test_files.py
    • test_models.py
    • test_qs.py
    • test_required_args.py
    • test_response.py
    • test_streaming.py
    • test_transform.py
    • test_utils
      • test_datetime_parse.py
      • test_proxy.py
      • test_typing.py
    • utils.py

Some content is hidden

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

143 files changed

+25380
-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: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
pull_request:
11+
branches-ignore:
12+
- 'stl-preview-head/**'
13+
- 'stl-preview-base/**'
14+
15+
jobs:
16+
lint:
17+
timeout-minutes: 10
18+
name: lint
19+
runs-on: ${{ github.repository == 'stainless-sdks/chunkify-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
20+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install Rye
25+
run: |
26+
curl -sSf https://rye.astral.sh/get | bash
27+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
28+
env:
29+
RYE_VERSION: '0.44.0'
30+
RYE_INSTALL_OPTION: '--yes'
31+
32+
- name: Install dependencies
33+
run: rye sync --all-features
34+
35+
- name: Run lints
36+
run: ./scripts/lint
37+
38+
build:
39+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
40+
timeout-minutes: 10
41+
name: build
42+
permissions:
43+
contents: read
44+
id-token: write
45+
runs-on: ${{ github.repository == 'stainless-sdks/chunkify-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Install Rye
50+
run: |
51+
curl -sSf https://rye.astral.sh/get | bash
52+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
53+
env:
54+
RYE_VERSION: '0.44.0'
55+
RYE_INSTALL_OPTION: '--yes'
56+
57+
- name: Install dependencies
58+
run: rye sync --all-features
59+
60+
- name: Run build
61+
run: rye build
62+
63+
- name: Get GitHub OIDC Token
64+
if: github.repository == 'stainless-sdks/chunkify-python'
65+
id: github-oidc
66+
uses: actions/github-script@v6
67+
with:
68+
script: core.setOutput('github_token', await core.getIDToken());
69+
70+
- name: Upload tarball
71+
if: github.repository == 'stainless-sdks/chunkify-python'
72+
env:
73+
URL: https://pkg.stainless.com/s
74+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
75+
SHA: ${{ github.sha }}
76+
run: ./scripts/utils/upload-artifact.sh
77+
78+
test:
79+
timeout-minutes: 10
80+
name: test
81+
runs-on: ${{ github.repository == 'stainless-sdks/chunkify-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
82+
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
83+
steps:
84+
- uses: actions/checkout@v4
85+
86+
- name: Install Rye
87+
run: |
88+
curl -sSf https://rye.astral.sh/get | bash
89+
echo "$HOME/.rye/shims" >> $GITHUB_PATH
90+
env:
91+
RYE_VERSION: '0.44.0'
92+
RYE_INSTALL_OPTION: '--yes'
93+
94+
- name: Bootstrap
95+
run: ./scripts/bootstrap
96+
97+
- name: Run tests
98+
run: ./scripts/test

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.prism.log
2+
_dev
3+
4+
__pycache__
5+
.mypy_cache
6+
7+
dist
8+
9+
.venv
10+
.idea
11+
12+
.env
13+
.envrc
14+
codegen.log
15+
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: 40
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/chunkify%2Fchunkify-d29db7136f4c757d60522d63b7e12703a2723a12caed39479cdb32c8e768ef71.yml
3+
openapi_spec_hash: 623742a55cc9c10fa34577a2d0773b12
4+
config_hash: adb9fa87e175e10555229a2e4b286931

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.analysis.importFormat": "relative",
3+
}

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: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
21+
$ source .venv/bin/activate
22+
23+
# now you can omit the `rye run` prefix
24+
$ python script.py
25+
```
26+
27+
### Without Rye
28+
29+
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:
30+
31+
```sh
32+
$ pip install -r requirements-dev.lock
33+
```
34+
35+
## Modifying/Adding code
36+
37+
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
38+
result in merge conflicts between manual patches and changes from the generator. The generator will never
39+
modify the contents of the `src/chunkify/lib/` and `examples/` directories.
40+
41+
## Adding and running examples
42+
43+
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
44+
45+
```py
46+
# add an example to examples/.py
47+
48+
#!/usr/bin/env -S rye run python
49+
...
50+
```
51+
52+
```sh
53+
$ chmod +x examples/<your-example>.py
54+
# run the example against your api
55+
$ ./examples/<your-example>.py
56+
```
57+
58+
## Using the repository from source
59+
60+
If you'd like to use the repository from source, you can either install from git or link to a cloned repository:
61+
62+
To install via git:
63+
64+
```sh
65+
$ pip install git+ssh://git@github.com/stainless-sdks/chunkify-python.git
66+
```
67+
68+
Alternatively, you can build from source and install the wheel file: