diff --git a/.github/workflows/_publish-wheel.yml b/.github/workflows/_publish-wheel.yml index e36b63226..71d422e20 100644 --- a/.github/workflows/_publish-wheel.yml +++ b/.github/workflows/_publish-wheel.yml @@ -128,19 +128,6 @@ jobs: find "$ARTIFACTS_PATH" -maxdepth 1 -type f -name "*.whl" -printf "- \`%f\`\n" } >> "$GITHUB_STEP_SUMMARY" - - name: Require immutable releases - if: github.ref == 'refs/heads/main' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - enabled=$(gh api \ - "repos/${{ github.repository }}/immutable-releases" \ - --jq '.enabled') - if [[ "$enabled" != 'true' ]]; then - echo "::error::Immutable releases must be enabled for ${{ github.repository }}." - exit 1 - fi - - name: Create draft release and upload assets if: github.ref == 'refs/heads/main' env: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 7a856d1b3..5402dfacf 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -40,11 +40,11 @@ jobs: - name: Install package doc generator dependencies if: github.event.action != 'closed' - run: pip install -r docs/requirements.txt + run: pip install -r ci_scripts/requirements.txt - name: Generate package pages from YAML if: github.event.action != 'closed' - run: python docs/packages/generate_packages_doc.py + run: python ci_scripts/generate_packages_doc.py - name: Compute preview baseurl if: github.event.action != 'closed' @@ -103,10 +103,10 @@ jobs: python-version: '3' - name: Install package doc generator dependencies - run: pip install -r docs/requirements.txt + run: pip install -r ci_scripts/requirements.txt - name: Generate package pages from YAML - run: python docs/packages/generate_packages_doc.py + run: python ci_scripts/generate_packages_doc.py - name: Build with Jekyll uses: actions/jekyll-build-pages@v1 diff --git a/docs/packages/generate_packages_doc.py b/ci_scripts/generate_packages_doc.py similarity index 97% rename from docs/packages/generate_packages_doc.py rename to ci_scripts/generate_packages_doc.py index cfa5d3d35..4426cc626 100644 --- a/docs/packages/generate_packages_doc.py +++ b/ci_scripts/generate_packages_doc.py @@ -4,6 +4,7 @@ import glob import html import os +from pathlib import Path import re from urllib.parse import quote @@ -17,6 +18,9 @@ RST_LINK_RE = re.compile(r"`([^`<]+?)\s*<([^>]+)>`_+") PACKAGE_NORMALIZE_RE = re.compile(r"[-_.]+") +CI_SCRIPTS_DIR = Path(os.path.dirname(os.path.abspath(__file__))) +DOCS_DIR = (CI_SCRIPTS_DIR / ".." / "docs" / "packages").resolve() + def normalize_package_name(package_name): """Return the normalized project name required by the Simple API.""" @@ -256,8 +260,8 @@ def generate_md_page(yaml_file, output_md): return package_name, output_md -def process_all_yaml_files(): - out_dir = os.path.dirname(os.path.abspath(__file__)) +def process_all_yaml_files(out_dir): + print(f"Processing all YAML files in {out_dir}...") yaml_files = sorted(glob.glob(os.path.join(out_dir, "*.yaml"))) if not yaml_files: print(f"No YAML files found in {out_dir}") @@ -349,4 +353,4 @@ def generate_index(package_entries, out_dir): if __name__ == "__main__": - process_all_yaml_files() + process_all_yaml_files(DOCS_DIR) diff --git a/docs/requirements.txt b/ci_scripts/requirements.txt similarity index 100% rename from docs/requirements.txt rename to ci_scripts/requirements.txt diff --git a/ci_scripts/update_doc.py b/ci_scripts/update_doc.py index e28ad6c6c..e71d1cf26 100644 --- a/ci_scripts/update_doc.py +++ b/ci_scripts/update_doc.py @@ -7,7 +7,7 @@ corresponding docs/packages/.yaml entry with the new version, and open a pull request with the change. -docs/packages/generate_packages_doc.py renders this YAML into the published +generate_packages_doc.py renders this YAML into the published Markdown pages, so this script only needs to maintain the YAML source of truth; it never touches docs/packages/*.md or index.md directly. """ @@ -27,8 +27,9 @@ import yaml REPO = "riseproject-dev/python-wheels" -DOCS_DIR = Path("docs/packages") -PACKAGES_FILE = Path("ci_scripts/packages.txt") +CI_SCRIPTS_DIR = Path(os.path.dirname(os.path.abspath(__file__))) +DOCS_DIR = (CI_SCRIPTS_DIR / ".." / "docs" / "packages").resolve() +PACKAGES_FILE = CI_SCRIPTS_DIR / "packages.txt" ARTIFACTS_PATH = os.environ.get("ARTIFACTS_PATH", "dist") RELEASE_TAG = os.environ.get("RELEASE_TAG") GPL_SOURCES_DESCRIPTION = os.environ.get("GPL_SOURCES_DESCRIPTION", "").strip() diff --git a/docs/development.md b/docs/development.md index 80fa2e45c..e64e6fb30 100644 --- a/docs/development.md +++ b/docs/development.md @@ -135,7 +135,7 @@ apply for certain projects. Every `build-.yml` workflow calls 1. Downloads the built wheel(s) from the previous job 2. Creates an immutable GitHub Release containing the wheels 3. Opens a PR against `docs/packages/.yaml` documenting the new version - (via `ci_scripts/update_doc.py`), which `docs/packages/generate_packages_doc.py` + (via `ci_scripts/update_doc.py`), which `ci_scripts/generate_packages_doc.py` later renders into the published Markdown page. With it in place, the `build-numpy.yml` script's `publish` job looks like this: diff --git a/docs/requirements-dev.txt b/docs/requirements-dev.txt deleted file mode 100644 index 7e66a17d4..000000000 --- a/docs/requirements-dev.txt +++ /dev/null @@ -1 +0,0 @@ -black diff --git a/skills/python-project-porting/references/gotchas/sdist-source-and-versioning.md b/skills/python-project-porting/references/gotchas/sdist-source-and-versioning.md index 14f77a8b0..3d6e07d1e 100644 --- a/skills/python-project-porting/references/gotchas/sdist-source-and-versioning.md +++ b/skills/python-project-porting/references/gotchas/sdist-source-and-versioning.md @@ -51,7 +51,7 @@ To pull up one entry: `grep -n '^N\. ' references/gotchas/sdist-source-and-versi up in the `.whl` filename (driven by `BUILD_VERSION`) must match, byte for byte: (1) the wheel filename, (2) the `docs/packages/.yaml` `version:` key (auto-populated by `update_doc.py` from the wheel), and (3) the - `patches///` directory name — `docs/.../generate_packages_doc.py` + `patches///` directory name — `generate_packages_doc.py` links patches as the literal path `patches/{name}/{version}`, so a mismatch is a 404. torch ships a **local segment** (`2.13.0+cpu`, pytorch's CPU-index convention) so its patches live under `patches/torch/2.13.0+cpu/`.