[PR #3705] feat: auto-sync install snippets with latest pypi/npm versions [closes DOC-1030] #3740

Open
opened 2026-06-05 18:52:59 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/3705
Author: @open-swe[bot]
Created: 4/24/2026
Status: 🔄 Open

Base: mainHead: open-swe/4df2a389-91bf-200d-3f68-6161a6e64b71


📝 Commits (1)

  • 7ef5cfa feat: auto-sync install snippets with latest pypi/npm versions

📊 Changes

9 files changed (+381 additions, -6 deletions)

View changed files

📝 AGENTS.md (+4 -0)
📝 CLAUDE.md (+4 -0)
📝 pipeline/preprocessors/__init__.py (+2 -1)
📝 pipeline/preprocessors/markdown_preprocessor.py (+4 -0)
pipeline/preprocessors/package_versions.py (+70 -0)
scripts/update_package_versions.py (+126 -0)
📝 src/oss/versioning.mdx (+5 -5)
tests/unit_tests/test_package_versions.py (+102 -0)
versions.yml (+64 -0)

📄 Description

Description

Install/upgrade snippets currently hardcode version strings (e.g., langgraph==1.0.0) that go stale quickly. This adds a build-time token system so snippets can reference {{LANGGRAPH_PY_VERSION}} etc. and be rewritten to the latest published version. A new script (scripts/update_package_versions.py) refreshes versions.yml from PyPI/npm so docs can stay in sync without manual updates.

Note

A scheduled workflow (.github/workflows/update-package-versions.yml) that runs the updater and opens a PR needs to be added separately — the GitHub App used by this agent can't push workflow files. The intended YAML is included below; please commit it in a follow-up by a maintainer.

.github/workflows/update-package-versions.yml
---
name: Update Package Versions

on:
  schedule:
    - cron: "17 0 * * *"
  workflow_dispatch:

jobs:
  generate-versions:
    name: Fetch latest PyPI/npm versions
    runs-on: ubuntu-latest
    timeout-minutes: 15
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 1
      - name: Set up Python 3.13 + uv
        uses: "./.github/actions/uv_setup"
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: uv sync --group test
      - name: Update latest versions
        run: uv run scripts/update_package_versions.py
      - name: Upload updated versions.yml as artifact
        uses: actions/upload-artifact@v6
        with:
          name: versions-yml
          path: versions.yml
          retention-days: 1

  commit-versions:
    name: Create PR with updated versions
    needs: generate-versions
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 1
      - name: Download updated versions.yml
        uses: actions/download-artifact@v7
        with:
          name: versions-yml
          path: .
      - name: Create PR with changes
        env:
          GH_TOKEN: ${{ github.token }}
        run: |
          git config --global user.name "github-actions[bot]"
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          if git diff -U0 versions.yml | grep -E '^[+-][[:space:]]*version:' | grep -v '^+++\|^---' > /dev/null; then
            echo "Version changes detected"
          else
            echo "No version changes to commit"
            git checkout -- versions.yml
            exit 0
          fi
          BRANCH_NAME="chore/update-package-versions-$(date +%Y%m%d-%H%M%S)"
          git checkout -b "$BRANCH_NAME"
          git add versions.yml
          git commit -m "chore: update package versions"
          git push origin "$BRANCH_NAME"
          gh pr create \
            --title "chore: update package versions" \
            --body "Automated update of latest PyPI/npm versions in versions.yml." \
            --base main \
            --head "$BRANCH_NAME"
          gh pr merge "$BRANCH_NAME" --auto --squash

Test Plan

  • Verify the built versioning.mdx shows versions substituted into the upgrade snippets (pip install langgraph==<latest>, npm install langchain@<latest>, etc.)
  • After the workflow is added, manually trigger it and confirm it opens a PR when a bump is available

Opened collaboratively by Naomi Pentrel and open-swe.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/3705 **Author:** [@open-swe[bot]](https://github.com/apps/open-swe) **Created:** 4/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `open-swe/4df2a389-91bf-200d-3f68-6161a6e64b71` --- ### 📝 Commits (1) - [`7ef5cfa`](https://github.com/langchain-ai/docs/commit/7ef5cfa25682041ed8fd6420c3a825ee697a4ac7) feat: auto-sync install snippets with latest pypi/npm versions ### 📊 Changes **9 files changed** (+381 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+4 -0) 📝 `CLAUDE.md` (+4 -0) 📝 `pipeline/preprocessors/__init__.py` (+2 -1) 📝 `pipeline/preprocessors/markdown_preprocessor.py` (+4 -0) ➕ `pipeline/preprocessors/package_versions.py` (+70 -0) ➕ `scripts/update_package_versions.py` (+126 -0) 📝 `src/oss/versioning.mdx` (+5 -5) ➕ `tests/unit_tests/test_package_versions.py` (+102 -0) ➕ `versions.yml` (+64 -0) </details> ### 📄 Description ## Description Install/upgrade snippets currently hardcode version strings (e.g., `langgraph==1.0.0`) that go stale quickly. This adds a build-time token system so snippets can reference `{{LANGGRAPH_PY_VERSION}}` etc. and be rewritten to the latest published version. A new script (`scripts/update_package_versions.py`) refreshes `versions.yml` from PyPI/npm so docs can stay in sync without manual updates. > [!NOTE] > A scheduled workflow (`.github/workflows/update-package-versions.yml`) that runs the updater and opens a PR needs to be added separately — the GitHub App used by this agent can't push workflow files. The intended YAML is included below; please commit it in a follow-up by a maintainer. <details> <summary><code>.github/workflows/update-package-versions.yml</code></summary> ```yaml --- name: Update Package Versions on: schedule: - cron: "17 0 * * *" workflow_dispatch: jobs: generate-versions: name: Fetch latest PyPI/npm versions runs-on: ubuntu-latest timeout-minutes: 15 permissions: contents: read steps: - uses: actions/checkout@v6 with: fetch-depth: 1 - name: Set up Python 3.13 + uv uses: "./.github/actions/uv_setup" with: python-version: "3.13" - name: Install dependencies run: uv sync --group test - name: Update latest versions run: uv run scripts/update_package_versions.py - name: Upload updated versions.yml as artifact uses: actions/upload-artifact@v6 with: name: versions-yml path: versions.yml retention-days: 1 commit-versions: name: Create PR with updated versions needs: generate-versions runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: actions/checkout@v6 with: fetch-depth: 1 - name: Download updated versions.yml uses: actions/download-artifact@v7 with: name: versions-yml path: . - name: Create PR with changes env: GH_TOKEN: ${{ github.token }} run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" if git diff -U0 versions.yml | grep -E '^[+-][[:space:]]*version:' | grep -v '^+++\|^---' > /dev/null; then echo "Version changes detected" else echo "No version changes to commit" git checkout -- versions.yml exit 0 fi BRANCH_NAME="chore/update-package-versions-$(date +%Y%m%d-%H%M%S)" git checkout -b "$BRANCH_NAME" git add versions.yml git commit -m "chore: update package versions" git push origin "$BRANCH_NAME" gh pr create \ --title "chore: update package versions" \ --body "Automated update of latest PyPI/npm versions in versions.yml." \ --base main \ --head "$BRANCH_NAME" gh pr merge "$BRANCH_NAME" --auto --squash ``` </details> ## Test Plan - [ ] Verify the built `versioning.mdx` shows versions substituted into the upgrade snippets (`pip install langgraph==<latest>`, `npm install langchain@<latest>`, etc.) - [ ] After the workflow is added, manually trigger it and confirm it opens a PR when a bump is available _Opened collaboratively by Naomi Pentrel and open-swe._ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:52:59 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#3740