DSPy: The framework for programming—not prompting—language models
Python
Fix lint problems of workflows so that we can remove .prettierignore in the future (#7941)
Chen Qian5cc3dcb7b754
diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.ymlindex ed117e1e2..47c7ef190 100644--- a/.github/workflows/build_and_release.yml+++ b/.github/workflows/build_and_release.yml@@ -5,23 +5,23 @@ on:tags:- "*"jobs:- extract-tag:- runs-on: ubuntu-latest- outputs:- version: ${{ steps.extract_tag.outputs.tag }}- steps:+ extract-tag:+ runs-on: ubuntu-latest+ outputs:+ version: ${{ steps.extract_tag.outputs.tag }}+ steps:- uses: actions/checkout@v4- - id: extract_tag- name: Extract tag name- run: echo "::set-output name=tag::$(echo $GITHUB_REF | cut -d / -f 3)"+ - id: extract_tag+ name: Extract tag name+ run: echo "::set-output name=tag::$(echo $GITHUB_REF | cut -d / -f 3)"build-and-publish-test-pypi:needs: extract-tagruns-on: ubuntu-latest- environment:+ environment:name: pypipermissions:- id-token: write # IMPORTANT: mandatory for trusted publishing+ id-token: write # IMPORTANT: mandatory for trusted publishingcontents: writesteps:- uses: actions/checkout@v4@@ -31,19 +31,19 @@ jobs:python-version: "3.9"- name: Install dependenciesrun: python3 -m pip install --upgrade setuptools wheel twine build semver packaging- - name: Get correct version for TestPyPI release- id: check_version- run: |+ - name: Get correct version for TestPyPI release+ id: check_version+ run: |VERSION=${{ needs.extract-tag.outputs.version }}PACKAGE_NAME="dspy-ai-test"echo "Checking if $VERSION for $PACKAGE_NAME exists on TestPyPI"NEW_VERSION=$(python3 .github/workflows/build_utils/test_version.py $PACKAGE_NAME $VERSION)echo "Version to be used for TestPyPI release: $NEW_VERSION"- echo "::set-output name=version::$NEW_VERSION"+ echo "::set-output name=version::$NEW_VERSION"- name: Update version in pyproject.toml- run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ steps.check_version.outputs.version }}"/;}' pyproject.toml+ run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ steps.check_version.outputs.version }}"/;}' pyproject.toml- name: Update package name in pyproject.toml- run: sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy-ai-test"/;}' pyproject.toml+ run: sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy-ai-test"/;}' pyproject.toml- name: Build a binary wheelrun: python3 -m build# Test the locally built wheel@@ -59,7 +59,7 @@ jobs:# Publish to test-PyPI- name: Publish distribution 📦 to test-PyPIuses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi/testpypi- with:+ with:repository-url: https://test.pypi.org/legacy/# TODO: Add tests using dspy-ai-test@@ -69,10 +69,10 @@ jobs:# Only publish to PyPI if the repository owner is stanfordnlpif: github.repository_owner == 'stanfordnlp'runs-on: ubuntu-latest- environment:+ environment:name: pypipermissions:- id-token: write # IMPORTANT: mandatory for trusted publishing+ id-token: write # IMPORTANT: mandatory for trusted publishingcontents: writesteps:- uses: actions/checkout@v4@@ -106,21 +106,21 @@ jobs:rm -r test_before_pypi- name: Publish distribution 📦 to PyPI (dspy)uses: pypa/gh-action-pypi-publish@release/v1- with:+ with:attestations: false# Publish to dspy-ai- name: Update package name in pyproject.tomlrun: sed -i '/#replace_package_name_marker/{n;s/name *= *"[^"]*"/name="dspy-ai"/;}' ./dspy/.internal_dspyai/pyproject.toml- name: Update version for dspy-ai releaserun: sed -i '/#replace_package_version_marker/{n;s/version *= *"[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/.internal_dspyai/pyproject.toml- - name: Update dspy dependency for dspy-ai release+ - name: Update dspy dependency for dspy-ai releaserun: |sed -i '/#replace_dspy_version_marker/{n;s/dspy *>= *"[^"]*/dspy>=${{ needs.extract-tag.outputs.version }}/;}' ./dspy/.internal_dspyai/pyproject.toml- name: Build a binary wheel (dspy-ai)run: python3 -m build ./dspy/.internal_dspyai/- name: Publish distribution 📦 to PyPI (dspy-ai)uses: pypa/gh-action-pypi-publish@release/v1- with:+ with:attestations: falsepackages-dir: ./dspy/.internal_dspyai/dist/- uses: stefanzweifel/git-auto-commit-action@v5 # auto commit changes to main@@ -128,17 +128,17 @@ jobs:commit_message: Update versionscreate_branch: truebranch: release-${{ needs.extract-tag.outputs.version }}- - name: Checkout main branch- run: |- git fetch origin- git checkout main+ - name: Checkout main branch+ run: |+ git fetch origin+ git checkout main- name: Configure git user- run: |+ run: |git config --global user.email "[email protected]"git config --global user.name "Github Actions"- - name: Merge release branch into main- run: |- git merge --no-ff release-${{ needs.extract-tag.outputs.version }}+ - name: Merge release branch into main+ run: |+ git merge --no-ff release-${{ needs.extract-tag.outputs.version }}- name: Push changes to main- run: |- git push origin main\ No newline at end of file+ run: |+ git push origin maindiff --git a/.github/workflows/docs-push.yml b/.github/workflows/docs-push.ymlindex 75cee32b1..f8ae67ae6 100644--- a/.github/workflows/docs-push.yml+++ b/.github/workflows/docs-push.yml@@ -5,10 +5,10 @@ on:branches:- mainpaths:- - 'docs/**'+ - "docs/**"pull_request:paths:- - 'docs/**'+ - "docs/**"jobs:build-test:@@ -20,7 +20,7 @@ jobs:- name: Set up Node.jsuses: actions/setup-node@v3with:- node-version: '18'+ node-version: "18"- name: Install dependencies and buildrun: |cd docs@@ -39,8 +39,8 @@ jobs:env:API_TOKEN_GITHUB: ${{ secrets.GH_PAT }}with:- source-directory: 'docs'- destination-github-username: 'krypticmouse'- destination-repository-name: 'dspy-docs'+ source-directory: "docs"+ destination-github-username: "krypticmouse"+ destination-repository-name: "dspy-docs"user-email: [email protected]- target-branch: master\ No newline at end of file+ target-branch: master