Simple CLI wrapper for the Readthedocs REST API
Project description
rtd: simple Readthedocs CLI
Install
pip install rtd-cli
# Set this env var, or write the token to ~/.config/rtd-cli/token
RTD_TOKEN=your_token
Usage
rtd --help
# Usage: rtd [OPTIONS] COMMAND [ARGS]...
#
# Simple CLI wrapper for the Readthedocs REST API.
#
# Options:
# --help Show this message and exit.
#
# Commands:
# api Make a request to the Readthedocs REST API.
# build Trigger a build for a project version.
# deactivate Deactivate one or more versions
# hide Hide one or more versions
# logs Get build logs for a specific build ID.
# open Open project page in browser.
rtd api --help
# Usage: rtd api [OPTIONS] ENDPOINT
#
# Make a request to the Readthedocs REST API.
#
# RTD API docs: https://docs.readthedocs.io/en/stable/api/v3.html
#
# Options:
# -b, --body TEXT JSON string to send in the body of a PATCH/POST request;
# if absent, a GET request is sent
# -m, --method [GET|POST|PATCH] HTTP method to use; defaults to GET if no body,
# PATCH if body provided
# -u, --show-updated After a PATCH/POST request (with -b/--body), send a GET
# to the same endpoint, to verify the updated state of the
# resource
# --help Show this message and exit.
rtd build --help
# Usage: rtd build [OPTIONS] PROJECT
#
# Trigger a build for a project version.
#
# Options:
# -v, --version TEXT Version slug (default: latest)
# --help Show this message and exit.
rtd logs --help
# Usage: rtd logs BUILD_ID
#
# Get build logs for a specific build ID.
rtd open --help
# Usage: rtd open [OPTIONS] PROJECT
#
# Open project page in browser.
#
# Options:
# -b, --build TEXT Open specific build page
# -d, --docs Open docs site (not dashboard)
# --help Show this message and exit.
Examples
List projects:
rtd api projects
# {
# "count": …,
# "next": null,
# "previous": null,
# "results": [
# …
# ]
# }
Trigger a build:
rtd build your_project
# or specify a version
rtd build your_project -v stable
View build logs:
rtd logs 30253885
Open project pages in browser:
rtd open levanter # Opens builds page
rtd open levanter -b 30253885 # Opens specific build
rtd open levanter -d # Opens docs site
Update project default branch:
rtd api projects/your_project/ -b '{"default_branch": "main"}' -u
Sync versions from repository:
rtd api projects/your_project/sync-versions/ -m POST
Hide all versions except for a specific list:
project=your_project
keep=(latest 1.11.) # grep patterns to keep
limit=100
# Exclude `keep` patterns above, when calling `rtd hide` below
grep_args=(-v)
for v in "${keep[@]}"; do
grep_args+=(-e "$v")
done
rtd api "projects/$project/versions?limit=$limit&active=true&built=true" \
| jq -r '.results[] | select(.hidden | not) | .slug' \
| grep "${grep_args[@]}" \
| xargs rtd hide -p $p
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rtd_cli-0.1.0.tar.gz.
File metadata
- Download URL: rtd_cli-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcf56661278f1dbef01062bb4891e4f4ba6ebad669985b338a161984d108aef4
|
|
| MD5 |
4e92fb1e00865e07c8ea355c1a524af6
|
|
| BLAKE2b-256 |
2061f4ff21cf941647e88290fc02a2a0966e3c158b5d922800bc1e5a6ccfa2b1
|
Provenance
The following attestation bundles were made for rtd_cli-0.1.0.tar.gz:
Publisher:
release.yml on runsascoded/rtd-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtd_cli-0.1.0.tar.gz -
Subject digest:
bcf56661278f1dbef01062bb4891e4f4ba6ebad669985b338a161984d108aef4 - Sigstore transparency entry: 685847593
- Sigstore integration time:
-
Permalink:
runsascoded/rtd-cli@a457c3fa0b7070c1c87752ad2499b1e624f5284c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/runsascoded
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a457c3fa0b7070c1c87752ad2499b1e624f5284c -
Trigger Event:
push
-
Statement type:
File details
Details for the file rtd_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rtd_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8b2b409ef6519ee7598e132f87a2fa16e79b28d78461b5d3233cbc1bcb7f4bc
|
|
| MD5 |
8a26567e22de58dd18c49ce5709c2f26
|
|
| BLAKE2b-256 |
c3f840c092c1f01d1bf2f39c6683ff24d0443699e6038b85026fc07b38a763e5
|
Provenance
The following attestation bundles were made for rtd_cli-0.1.0-py3-none-any.whl:
Publisher:
release.yml on runsascoded/rtd-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtd_cli-0.1.0-py3-none-any.whl -
Subject digest:
f8b2b409ef6519ee7598e132f87a2fa16e79b28d78461b5d3233cbc1bcb7f4bc - Sigstore transparency entry: 685847594
- Sigstore integration time:
-
Permalink:
runsascoded/rtd-cli@a457c3fa0b7070c1c87752ad2499b1e624f5284c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/runsascoded
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a457c3fa0b7070c1c87752ad2499b1e624f5284c -
Trigger Event:
push
-
Statement type: