cloudflare-r2
Small Python and CLI wrapper for Cloudflare R2's S3-compatible API.
Use it when you want a reusable r2 command for directory transfers, dotenv
configuration, and bucket access checks across apps.
Install
uv add cloudflare-r2
Configure
Create a .env file:
R2_ACCOUNT_ID=your-account-id
R2_BUCKET=your-bucket
R2_ACCESS_KEY_ID=your-token-key
R2_SECRET_ACCESS_KEY=your-token-secret
R2_REGION=auto
R2_PREFIX=
Then verify that credentials and bucket access work:
r2 doctor --env-file .env --show-bucket
Common Commands
Upload a local directory:
r2 upload-dir --source data --prefix "" --overwrite skip
Download a remote prefix:
r2 download-prefix --target data --prefix "" --preserve-key
Single-object compatibility commands are still available:
r2 upload --bucket test-bucket --src README.md --key README.md
r2 download --bucket test-bucket --key README.md
1Password
Generate a local dotenv file from item references:
op inject -i env.example -o .env
op run --env-file .env -- r2 doctor --show-bucket
Mounted 1Password .env files work the same way because the package reads
normal environment variables and dotenv files.
App Integration
Delegate app-specific upload and download tasks to the package command:
download:
uv run r2 download-prefix --target data
upload:
uv run r2 upload-dir --source data
Full usage notes and API reference are published at justmars.github.io/cloudflare-r2.
Release files for cloudflare-r2 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cloudflare_r2-0.0.6.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cloudflare_r2-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.3 kB
Release files / cloudflare_r2-0.0.6.tar.gz
| Download URL | cloudflare_r2-0.0.6.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ff48c83e46cfa2e52bb00a1bfa7cd87b36c81000be70b07b8b63f3d974ee360
|
|
BLAKE2b-256 checksum How to use checksums |
0819eedd300493fd8d3b18b7d1b5ddb320a7f9ebc40d0b5000cba89d62475d82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cloudflare_r2-0.0.6-py3-none-any.whl
| Download URL | cloudflare_r2-0.0.6-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43464b10590ad59669ffe1362c7f75f4bdbe478ec01bb8aeeff10c95cc6d7bc7
|
|
BLAKE2b-256 checksum How to use checksums |
579bcb262d1312fe368ab51f2bc52280def79717208a0d03af71b86ea9ca31df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|