DSPy: The framework for programming—not prompting—language models
Python
Pr 7876 fixes (#7889)
Hanna Moazamb89c6059fd01
diff --git a/.github/workflows/build_and_release.yml b/.github/workflows/build_and_release.ymlindex 0cb8d7b35..7e3b29a24 100644--- a/.github/workflows/build_and_release.yml+++ b/.github/workflows/build_and_release.yml@@ -41,19 +41,32 @@ jobs:echo "Version to be used for TestPyPI release: $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.tomlrun: 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+ - name: Create test environment+ run: python -m venv test_env+ - name: Test package installation and functionality+ run: |+ source test_env/bin/activate+ # Install the locally built wheel and testing dependencies+ pip install dist/*.whl pytest+ python -c "import dspy; print(dspy.__version__)"+ deactivate+ # 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/testpypiwith:repository-url: https://test.pypi.org/legacy/+ # TODO: Add tests using dspy-ai-test+build-and-publish-pypi:needs: [extract-tag, build-and-publish-test-pypi]- # Only publish to PyPI if the repository owner is stanfordnlp, while the test-PyPI is open to all forks for testing+ # Only publish to PyPI if the repository owner is stanfordnlpif: github.repository_owner == 'stanfordnlp'runs-on: ubuntu-latestenvironment:@@ -71,9 +84,13 @@ jobs:run: python3 -m pip install --upgrade setuptools wheel twine build- 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+ run: sed -i '/#replace_package_version_marker/{n;s/__version__ *= *"[^"]*"/__version__="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/__metadata__.py# Publish to dspy- name: Update package name in pyproject.tomlrun: sed -i '/#replace_package_name_marker/{n;s/name *= *"[^"]*"/name="dspy"/;}' pyproject.toml+ - name: Update package name in metadata.py+ run: sed -i '/#replace_package_name_marker/{n;s/__name__ *= *"[^"]*"/name="dspy"/;}' ./dspy/__metadata__.py- name: Build a binary wheelrun: python3 -m build- name: Publish distribution 📦 to PyPI (dspy)@@ -81,17 +98,20 @@ jobs:with:attestations: false# Publish to dspy-ai- - name: Update package name for dspy-ai- run: sed -i '/#replace_package_name_marker/{n;s/name *= *"[^"]*"/name="dspy-ai"/;}' pyproject.toml+ - name: Update package name in pyproject.toml+ run: sed -i '/#replace_package_name_marker/{n;s/name *= *"[^"]*"/name="dspy-ai"/;}' ./dspy/.internal_dspyai/pyproject.toml+ - name: Update version for dspy-ai release+ run: 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+ run: |+ 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+ run: python3 -m build ./dspy/.internal_dspyai/- name: Publish distribution 📦 to PyPI (dspy-ai)uses: pypa/gh-action-pypi-publish@release/v1with:attestations: false- # Restore name to dspy for git commit- - name: Restore package name to dspy- run: sed -i '/#replace_package_name_marker/{n;s/name *= *"[^"]*"/name="dspy"/;}' pyproject.toml+ packages-dir: ./dspy/.internal_dspyai/dist/- uses: stefanzweifel/git-auto-commit-action@v5 # auto commit changes to mainwith:commit_message: Update versionsdiff --git a/dspy/.internal_dspyai/pyproject.toml b/dspy/.internal_dspyai/pyproject.tomlnew file mode 100644index 000000000..914a1813e--- /dev/null+++ b/dspy/.internal_dspyai/pyproject.toml@@ -0,0 +1,22 @@+[project]+#replace_package_name_marker+name = "dspy-ai"+#replace_package_version_marker+version = "2.6.5"+description = "DSPy"+readme = "README.md"+authors = [+ { name = "Omar Khattab", email = "[email protected]" }+]+license = { text = "MIT License" }+requires-python = ">=3.9"+#replace_dspy_version_marker+dependencies = ["dspy>=2.6.5"]+urls = { "Homepage" = "https://github.com/stanfordnlp/dsp" }++[build-system]+requires = ["setuptools>=40.8.0", "wheel"]+build-backend = "setuptools.build_meta"++[tool.setuptools.packages.find]+include = ["dsp.*", "dspy.*", "dsp", "dspy"]\ No newline at end of filediff --git a/dspy/.internal_dspyai/setup.py b/dspy/.internal_dspyai/setup.pydeleted file mode 100644index e1800cab7..000000000--- a/dspy/.internal_dspyai/setup.py+++ /dev/null@@ -1,23 +0,0 @@-from setuptools import find_packages, setup--# Read the content of the README file-with open("README.md", encoding="utf-8") as f:- long_description = f.read()--setup(- #replace_package_name_marker- name="dspy-ai",- #replace_package_version_marker- version="2.6.5",- description="DSPy",- long_description=long_description,- long_description_content_type="text/markdown",- url="https://github.com/stanfordnlp/dsp",- author="Omar Khattab",- author_email="[email protected]",- license="MIT License",- packages=find_packages(include=["dsp.*", "dspy.*", "dsp", "dspy"]),- python_requires=">=3.9",- #replace_dspy_version_marker- install_requires=["dspy>=2.6.5"]-)