Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
891e190
Add `__doc__` crate
ShaharNaveh Nov 1, 2025
e74c26f
Base auto-generate ci
ShaharNaveh Nov 3, 2025
d6e00ba
Add dummy files
ShaharNaveh Nov 3, 2025
b309e90
Update docs
ShaharNaveh Nov 3, 2025
d35a6bd
Set codegen-units to 1 for doc db
ShaharNaveh Nov 3, 2025
232fe6d
Mark `*.inc.rs` as auto generated
ShaharNaveh Nov 3, 2025
231318a
Disable doctest
ShaharNaveh Nov 7, 2025
aaa2006
Reset docs
ShaharNaveh Nov 7, 2025
c2b2249
Simplify `generate.py`
ShaharNaveh Nov 7, 2025
2db1227
No need for optimizatins in dev
ShaharNaveh Nov 7, 2025
c3b191e
simplify `lib.rs`
ShaharNaveh Nov 7, 2025
34d4f32
Regenerate docs
ShaharNaveh Nov 7, 2025
83ab568
ignore cspell
ShaharNaveh Nov 7, 2025
efd4de9
Merge remote-tracking branch 'upstream/main' into move-doc
ShaharNaveh Nov 9, 2025
6140114
Configurable python-version
ShaharNaveh Nov 9, 2025
7a432ec
Fix logic error
ShaharNaveh Nov 9, 2025
a590b8d
Output as json
ShaharNaveh Nov 9, 2025
315ef1d
GHA now uploads `data.inc.rs`
ShaharNaveh Nov 9, 2025
100a803
Generate `data.inc.rs`
ShaharNaveh Nov 9, 2025
833c786
Add info comments
ShaharNaveh Nov 9, 2025
25cf146
Fix typo of missing type
ShaharNaveh Nov 9, 2025
83c03a5
Fix typo
ShaharNaveh Nov 9, 2025
4e21b6f
Assert raw_doc is not None
ShaharNaveh Nov 9, 2025
174cb87
Check if attr is callable
ShaharNaveh Nov 9, 2025
1542895
Merge remote-tracking branch 'upstream/main' into move-doc
ShaharNaveh Nov 10, 2025
4544be3
Rename to `rustpython-doc`
ShaharNaveh Nov 10, 2025
e089740
Merge remote-tracking branch 'upstream/main' into move-doc
ShaharNaveh Nov 10, 2025
15546ab
Rename to `crates/doc`
ShaharNaveh Nov 14, 2025
4bee896
Merge remote-tracking branch 'upstream/main' into move-doc
ShaharNaveh Nov 14, 2025
9e5ed29
Increase unix CI timeout to 35 minutes (was 30)
ShaharNaveh Nov 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ vm/src/stdlib/ast/gen.rs linguist-generated -merge
Lib/*.py text working-tree-encoding=UTF-8 eol=LF
**/*.rs text working-tree-encoding=UTF-8 eol=LF
*.pck binary
crates/rustpython_doc_db/src/*.inc.rs linguist-generated=true
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
RUST_BACKTRACE: full
name: Run rust tests
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ contains(matrix.os, 'windows') && 45 || 30 }}
timeout-minutes: ${{ contains(matrix.os, 'windows') && 45 || 35 }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
Expand Down Expand Up @@ -239,7 +239,7 @@ jobs:
RUST_BACKTRACE: full
name: Run snippets and cpython tests
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ contains(matrix.os, 'windows') && 45 || 30 }}
timeout-minutes: ${{ contains(matrix.os, 'windows') && 45 || 35 }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/update-doc-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Update doc DB

permissions:
contents: read

on:
workflow_dispatch:
inputs:
python-version:
description: Target python version to generate doc db for
type: string
default: "3.13.9"

defaults:
run:
shell: bash
working-directory: ./crates/rustpython-doc

jobs:
generate:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
sparse-checkout: |
crates/rustpython-doc

- uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: ${{ inputs.python-version }}

- name: Generate docs
run: python ./generate.py

- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: doc-db-${{ inputs.python-version }}-${{ matrix.os }}
path: "crates/rustpython-doc/generated/*.json"
if-no-files-found: error
retention-days: 7
overwrite: true

merge:
runs-on: ubuntu-latest
needs: generate
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
sparse-checkout: |
crates/rustpython-doc

- name: Download generated doc DBs
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
pattern: "doc-db-${{ inputs.python-version }}-**"
path: crates/rustpython-doc/generated/
merge-multiple: true

- name: Transform JSON
run: |
# Merge all artifacts
jq -s "add" --sort-keys generated/*.json > generated/merged.json

# Format merged json for the phf macro
jq -r 'to_entries[] | " \(.key | @json) => \(.value | @json),"' generated/merged.json > generated/raw_entries.txt

OUTPUT_FILE='src/data.inc.rs'

echo -n '' > $OUTPUT_FILE

echo '// This file was auto-generated by `.github/workflows/update-doc-db.yml`.' >> $OUTPUT_FILE
echo "// CPython version: ${{ inputs.python-version }}" >> $OUTPUT_FILE
echo '// spell-checker: disable' >> $OUTPUT_FILE

echo '' >> $OUTPUT_FILE

echo "pub static DB: phf::Map<&'static str, &'static str> = phf::phf_map! {" >> $OUTPUT_FILE
cat generated/raw_entries.txt >> $OUTPUT_FILE
echo '};' >> $OUTPUT_FILE

- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: doc-db-${{ inputs.python-version }}
path: "crates/rustpython-doc/src/data.inc.rs"
if-no-files-found: error
retention-days: 7
overwrite: true
73 changes: 60 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ opt-level = 3
# https://github.com/rust-lang/rust/issues/92869
# lto = "thin"

# Doesn't change often
[profile.release.package.rustpython-doc]
codegen-units = 1

[profile.bench]
lto = "thin"
codegen-units = 1
Expand Down Expand Up @@ -132,6 +136,7 @@ members = [
"derive-impl",
"wtf8",
"wasm/lib",
"crates/*",
]

[workspace.package]
Expand All @@ -156,13 +161,14 @@ rustpython-pylib = { path = "pylib", version = "0.4.0" }
rustpython-stdlib = { path = "stdlib", default-features = false, version = "0.4.0" }
rustpython-sre_engine = { path = "vm/sre_engine", version = "0.4.0" }
rustpython-wtf8 = { path = "wtf8", version = "0.4.0" }
rustpython-doc = { git = "https://github.com/RustPython/__doc__", tag = "0.3.0", version = "0.3.0" }
rustpython-doc = { path = "crates/doc", version = "0.4.0" }

ruff_python_parser = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_python_ast = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_text_size = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }
ruff_source_file = { git = "https://github.com/astral-sh/ruff.git", tag = "0.14.1" }

phf = { version = "0.13.1", default-features = false, features = ["macros"]}
ahash = "0.8.12"
ascii = "1.1"
bitflags = "2.9.4"
Expand Down
1 change: 1 addition & 0 deletions crates/doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated/
17 changes: 17 additions & 0 deletions crates/doc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "rustpython-doc"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
repository.workspace = true
license-file = "LICENSE"

[dependencies]
phf = { workspace = true }

[lib]
doctest = false # Crashes when true

[lints]
workspace = true
Loading
Loading