Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
24026a3
feat: feat(queues): add queues metrics endpoint
stainless-app[bot] Apr 24, 2026
2b3061a
feat: chore: skip failing tests for dns.records and workers.beta.workers
stainless-app[bot] Apr 24, 2026
6b156d9
chore(api): update composite API spec
stainless-app[bot] Apr 27, 2026
3d8af2c
codegen metadata
stainless-app[bot] Apr 27, 2026
cb19f09
codegen metadata
stainless-app[bot] Apr 28, 2026
5934108
chore(api): update composite API spec
stainless-app[bot] Apr 28, 2026
e6c37b0
codegen metadata
stainless-app[bot] Apr 28, 2026
4dab5b0
chore(api): update composite API spec
stainless-app[bot] Apr 28, 2026
d42e065
codegen metadata
stainless-app[bot] Apr 28, 2026
3ebe4bc
codegen metadata
stainless-app[bot] Apr 28, 2026
f781a02
chore(api): update composite API spec
stainless-app[bot] Apr 29, 2026
9a6518a
chore(api): update composite API spec
stainless-app[bot] Apr 29, 2026
68ea77d
chore(api): update composite API spec
stainless-app[bot] Apr 29, 2026
5c7db6b
codegen metadata
stainless-app[bot] Apr 29, 2026
434e873
chore(api): update composite API spec
stainless-app[bot] Apr 29, 2026
94536a0
feat: chore: skip failing tests for email_security.settings and worke…
stainless-app[bot] Apr 29, 2026
57311bf
codegen metadata
stainless-app[bot] Apr 30, 2026
5cc95f1
chore(api): update composite API spec
stainless-app[bot] Apr 30, 2026
3ef3fff
chore(api): update composite API spec
stainless-app[bot] Apr 30, 2026
40a47dc
feat: chore: skip fraud.update test (HTTP 422 from prism)
stainless-app[bot] Apr 30, 2026
df2b7b8
codegen metadata
stainless-app[bot] Apr 30, 2026
c4fe313
feat: feat(python): switch package manager from rye to uv
stainless-app[bot] Apr 30, 2026
3092db2
codegen metadata
stainless-app[bot] Apr 30, 2026
659ab00
codegen metadata
stainless-app[bot] May 1, 2026
2cf81d5
chore(api): update composite API spec
stainless-app[bot] May 1, 2026
5613798
feat: feat(api): add zero_trust_device_deployment_groups resource
stainless-app[bot] May 1, 2026
051abef
feat: chore: skip failing deployment_groups tests
stainless-app[bot] May 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

USER vscode

RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"context": ".."
},

"postStartCommand": "rye sync --all-features",
"postStartCommand": "uv sync --all-extras",

"customizations": {
"vscode": {
Expand All @@ -20,7 +20,7 @@
"python.defaultInterpreterPath": ".venv/bin/python",
"python.typeChecking": "basic",
"terminal.integrated.env.linux": {
"PATH": "/home/vscode/.rye/shims:${env:PATH}"
"PATH": "${env:PATH}"
}
}
}
Expand Down
55 changes: 21 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.10.2'

- name: Install dependencies
run: rye sync --all-features
run: uv sync --all-extras

- name: Run lints
run: ./scripts/lint
Expand All @@ -53,19 +50,16 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.10.2'

- name: Install dependencies
run: rye sync --all-features
run: uv sync --all-extras

- name: Run build
run: rye build
run: uv build

- name: Get GitHub OIDC Token
if: |-
Expand Down Expand Up @@ -94,13 +88,10 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.10.2'

- name: Bootstrap
run: ./scripts/bootstrap
Expand All @@ -117,21 +108,17 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.10.2'
- name: Install dependencies
run: |
rye sync --all-features
run: uv sync --all-extras

- env:
CLOUDFLARE_ACCOUNT_ID: f037e56e89293a057740de681ac9abbe
CLOUDFLARE_EMAIL: terraform-acceptance-test@cfapi.net
CLOUDFLARE_ZONE_ID: 0da42c8d2132a9ddaf714f9e7c920711
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
run: |
rye run python ./examples/dns/record.py
uv run python ./examples/dns/record.py
16 changes: 6 additions & 10 deletions .github/workflows/detect-breaking-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,15 @@ jobs:
# Ensure we can check out the pull request base in the script below.
fetch-depth: ${{ env.FETCH_DEPTH }}

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.10.2'
- name: Install dependencies
run: |
rye sync --all-features
run: uv sync --all-extras
- name: Detect removed symbols
run: |
rye run python scripts/detect-breaking-changes.py "${{ github.event.pull_request.base.sha }}"
uv run python scripts/detect-breaking-changes.py "${{ github.event.pull_request.base.sha }}"

- name: Detect breaking changes
run: |
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v6

- name: Install Rye
run: |
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: '0.9.13'

- name: Publish to PyPI
run: |
Expand Down
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 2194
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ce49e6bb0d3819f135b9a567b661205fdf5df21cff157eab2b7abd7b5b50347.yml
openapi_spec_hash: 512a5bb3a32860590c8949765605d65a
config_hash: 5367ae3e3a9a0d6578c2756965a99e3a
configured_endpoints: 2200
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml
openapi_spec_hash: 4cd58fdf7a6fa895b2514a2e60d131b1
config_hash: a6f7ab07cd1fde3ee07c4cae6ed2d568
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
brew "rye"
brew "uv"

22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
## Setting up the environment

### With Rye
### With `uv`

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:
We use [uv](https://docs.astral.sh/uv/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run:

```sh
$ ./scripts/bootstrap
```

Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run:
Or [install uv manually](https://docs.astral.sh/uv/getting-started/installation/) and run:

```sh
$ rye sync --all-features
$ uv sync --all-extras
```

You can then run scripts using `rye run python script.py` or by activating the virtual environment:
You can then run scripts using `uv run python script.py` or by manually activating the virtual environment:

```sh
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
# manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
# now you can omit the `uv run` prefix
$ python script.py
```

### Without Rye
### Without `uv`

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:
Alternatively if you don't want to install `uv`, 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:

```sh
$ pip install -r requirements-dev.lock
Expand All @@ -45,7 +45,7 @@ All files in the `examples/` directory are not modified by the generator and can
```py
# add an example to examples/<your-example>.py

#!/usr/bin/env -S rye run python
#!/usr/bin/env -S uv run python
```

Expand All @@ -72,7 +72,7 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz
To create a distributable version of the library, all you have to do is run this command:

```sh
$ rye build
$ uv build
# or
$ python -m build
```
Expand Down
5 changes: 3 additions & 2 deletions bin/publish-pypi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -eux
rm -rf dist
mkdir -p dist
rye build --clean
rye publish --yes --token=$PYPI_TOKEN
uv build
uv publish --token=$PYPI_TOKEN
9 changes: 0 additions & 9 deletions noxfile.py

This file was deleted.

52 changes: 19 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,53 +43,39 @@ Repository = "https://github.com/cloudflare/cloudflare-python"
[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]

[tool.rye]
[tool.uv]
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
required-version = ">=0.9"
conflicts = [
[
{ group = "pydantic-v1" },
{ group = "pydantic-v2" },
],
]

[dependency-groups]
# version pins are in uv.lock
dev = [
"pyright==1.1.399",
"mypy==1.17",
"respx",
"pytest",
"pytest-asyncio",
"ruff",
"time-machine",
"nox",
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
"pytest-xdist>=3.6.1",
"griffe>=1",
]

[tool.rye.scripts]
format = { chain = [
"format:ruff",
"format:docs",
"fix:ruff",
# run formatting again to fix any inconsistencies when imports are stripped
"format:ruff",
]}
"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'"
"format:ruff" = "ruff format"

"lint" = { chain = [
"check:ruff",
"typecheck",
"check:importable",
]}
"check:ruff" = "ruff check ."
"fix:ruff" = "ruff check --fix ."

"check:importable" = "python -c 'import cloudflare'"

typecheck = { chain = [
"typecheck:pyright",
"typecheck:mypy"
]}
"typecheck:pyright" = "pyright"
"typecheck:verify-types" = "pyright --verifytypes cloudflare --ignoreexternal"
"typecheck:mypy" = "mypy ."
pydantic-v1 = [
"pydantic>=1.9.0,<2",
]
pydantic-v2 = [
"pydantic~=2.0 ; python_full_version < '3.14'",
"pydantic~=2.12 ; python_full_version >= '3.14'",
]

[build-system]
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
Expand Down
Loading
Loading