-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Move __doc__ crate to crates/doc
#6234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 23 commits
891e190
e74c26f
d6e00ba
b309e90
d35a6bd
232fe6d
231318a
aaa2006
c2b2249
2db1227
c3b191e
34d4f32
83ab568
efd4de9
6140114
7a432ec
a590b8d
315ef1d
100a803
833c786
25cf146
83c03a5
4e21b6f
174cb87
1542895
4544be3
e089740
15546ab
4bee896
9e5ed29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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_db | ||
|
|
||
| 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_db | ||
|
|
||
| - 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_db/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_db | ||
|
|
||
| - name: Download generated doc DBs | ||
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | ||
| with: | ||
| pattern: "doc-db-${{ inputs.python-version }}-**" | ||
| path: crates/rustpython_doc_db/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_db/src/data.inc.rs" | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
| overwrite: true | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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_db] | ||||||
| codegen-units = 1 | ||||||
|
|
||||||
| [profile.bench] | ||||||
| lto = "thin" | ||||||
| codegen-units = 1 | ||||||
|
|
@@ -132,6 +136,7 @@ members = [ | |||||
| "derive-impl", | ||||||
| "wtf8", | ||||||
| "wasm/lib", | ||||||
| "crates/*", | ||||||
| ] | ||||||
|
|
||||||
| [workspace.package] | ||||||
|
|
@@ -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_db = { path = "crates/rustpython_doc_db", version = "0.4.0" } | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is worth discussing more. I haven't seen a single project that has both
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have that names for every crates. Actually I was missing the fundamental question about this change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
think we should choose one sperator and stick to it, as long as it's consistent.
Yeah, ofc
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I understand that there’s some validity to that point. |
||||||
|
|
||||||
| 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" | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| generated/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [package] | ||
| name = "rustpython_doc_db" | ||
| 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 |
Uh oh!
There was an error while loading. Please reload this page.