DSPy: The framework for programming—not prompting—language models
Python
Pin CI actions to SHA and replace curl-pipe-bash Deno install (#9509)
TomuHirata39a477d3b951
diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.ymlindex 2bcc18e80..356d51a10 100644--- a/.github/workflows/build_and_release.yml+++ b/.github/workflows/build_and_release.yml@@ -10,7 +10,7 @@ jobs:outputs:version: ${{ steps.extract_tag.outputs.tag }}steps:- - uses: actions/checkout@v4+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4- id: extract_tagname: Extract tag namerun: echo "tag=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT"@@ -24,19 +24,17 @@ jobs:id-token: write # IMPORTANT: mandatory for trusted publishingcontents: writesteps:- - uses: actions/checkout@v4+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4- name: Set up Python 3.11- uses: actions/setup-python@v3+ uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3with:python-version: "3.11"- name: Install dependenciesrun: python3 -m pip install --upgrade setuptools wheel twine build semver packaging- name: Install Deno- run: |- curl -fsSL https://deno.land/install.sh | sh- echo "${HOME}/.deno/bin" >> $GITHUB_PATH- - name: Verify Deno installation- run: deno --version+ uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3+ with:+ deno-version: v2.7.7- name: Get correct version for TestPyPI releaseid: check_versionrun: |@@ -64,7 +62,7 @@ jobs:deactivate# Publish to test-PyPI- name: Publish distribution 📦 to test-PyPI- uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi/testpypi+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 # This requires a trusted publisher to be setup in pypi/testpypiwith:repository-url: https://test.pypi.org/legacy/@@ -81,19 +79,17 @@ jobs:id-token: write # IMPORTANT: mandatory for trusted publishingcontents: writesteps:- - uses: actions/checkout@v4+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4- name: Set up Python 3.11- uses: actions/setup-python@v3+ uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566 # v3with:python-version: "3.11"- name: Install dependenciesrun: python3 -m pip install --upgrade setuptools wheel twine build- name: Install Deno- run: |- curl -fsSL https://deno.land/install.sh | sh- echo "${HOME}/.deno/bin" >> $GITHUB_PATH- - name: Verify Deno installation- run: deno --version+ uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3+ with:+ deno-version: v2.7.7- name: Update version in pyproject.tomlrun: sed -i '/#replace_package_version_marker/{n;s/version *= *"[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' pyproject.toml- name: Update version in __metadata__.py@@ -117,7 +113,7 @@ jobs:deactivaterm -r test_before_pypi- name: Publish distribution 📦 to PyPI (dspy)- uses: pypa/gh-action-pypi-publish@release/v1+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1with:attestations: false# Publish to dspy-ai@@ -131,11 +127,11 @@ jobs:- name: Build a binary wheel (dspy-ai)run: python3 -m build .github/.internal_dspyai/- name: Publish distribution 📦 to PyPI (dspy-ai)- uses: pypa/gh-action-pypi-publish@release/v1+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1with:attestations: falsepackages-dir: .github/.internal_dspyai/dist/- - uses: stefanzweifel/git-auto-commit-action@v5 # auto commit changes to main+ - uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5 # auto commit changes to mainwith:commit_message: Update versionscreate_branch: truediff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.ymlindex 85eb4c4be..de66f0f87 100644--- a/.github/workflows/docs-push.yml+++ b/.github/workflows/docs-push.yml@@ -16,9 +16,9 @@ jobs:runs-on: ubuntu-lateststeps:- name: Checkout code- uses: actions/checkout@v3+ uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3- name: Set up Node.js- uses: actions/setup-node@v3+ uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e210 # v3with:node-version: "18"- name: Install dependencies and build@@ -31,11 +31,11 @@ jobs:if: github.event_name == 'push' && github.repository == 'stanfordnlp/dspy'runs-on: ubuntu-lateststeps:- - uses: actions/checkout@v3+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3with:fetch-depth: 0- name: Push docs to separate repo- uses: cpina/github-action-push-to-another-repository@main+ uses: cpina/github-action-push-to-another-repository@55306faa4ed53b815ae49e564af8cfb359d32ae2 # mainenv:API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}with:diff --git a/.github/workflows/precommits_check.yml b/.github/workflows/precommits_check.ymlindex 4bc380816..c38bdd72b 100644--- a/.github/workflows/precommits_check.yml+++ b/.github/workflows/precommits_check.yml@@ -6,19 +6,19 @@ jobs:pre-commit-checks:runs-on: ubuntu-lateststeps:- - uses: actions/checkout@v3+ - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3- name: Set up Python- uses: actions/setup-python@v4+ uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4with:python-version: "3.10"cache: "pip"- name: Check Pull Request Title- uses: Slashgear/action-check-pr-title@main+ uses: Slashgear/action-check-pr-title@76166c63ec0b25cdbe693e5e972e83ca186313fb # mainwith:regexp: '(break|build|ci|docs|feat|fix|perf|refactor|style|test|ops|hotfix|release|maint|init|enh|revert)\([a-z,A-Z,0-9,\-,\_,\/,:]+\)(:)\s{1}([\w\s]+)' # Regex the title should match.- name: Getting changed files listid: files- uses: jitterbit/get-changed-files@master+ uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42 # v1- name: Checking changed filesshell: bashrun: |diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 6b90aeddc..12618bf33 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -14,12 +14,12 @@ jobs:permissions:contents: readsteps:- - uses: actions/checkout@v4- - uses: actions/setup-python@v5+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5with:python-version: "3.11"- name: Install uv with caching- uses: astral-sh/setup-uv@v5+ uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5with:enable-cache: truecache-dependency-glob: |@@ -51,18 +51,18 @@ jobs:matrix:python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]steps:- - uses: actions/checkout@v4- - uses: actions/setup-python@v5+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5with:python-version: ${{ matrix.python-version }}- name: Install Deno- run: |- curl -fsSL https://deno.land/install.sh | sh- echo "${HOME}/.deno/bin" >> $GITHUB_PATH+ uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3+ with:+ deno-version: v2.7.7- name: Verify Deno installationrun: deno --version- name: Install uv with caching- uses: astral-sh/setup-uv@v5+ uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5with:enable-cache: truecache-dependency-glob: |@@ -77,7 +77,7 @@ jobs:uv sync --dev -p .venv --extra devuv pip list- name: Run lint with tests- uses: chartboost/ruff-action@v1+ uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1with:args: check --fix-only- name: Run tests with pytest@@ -91,12 +91,12 @@ jobs:name: Run Tests with Real LMruns-on: ubuntu-lateststeps:- - uses: actions/checkout@v4- - uses: actions/setup-python@v5+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5with:python-version: 3.11- name: Install uv with caching- uses: astral-sh/setup-uv@v5+ uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5with:enable-cache: truecache-dependency-glob: |@@ -112,7 +112,7 @@ jobs:uv pip list- name: Cache Ollama modelsid: cache-ollama- uses: actions/cache@v4+ uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4with:path: ollama-datakey: ollama-llama3.2-3b-${{ runner.os }}-v1@@ -145,12 +145,12 @@ jobs:matrix:python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]steps:- - uses: actions/checkout@v4- - uses: actions/setup-python@v5+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4+ - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5with:python-version: ${{ matrix.python-version }}- name: Install uv with caching- uses: astral-sh/setup-uv@v5+ uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5with:enable-cache: truecache-dependency-glob: |