Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.toml
run: sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy-ai-test"/;}' pyproject.toml
- name: Build a binary wheel
run: 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-PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi/testpypi
with:
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 stanfordnlp
if: github.repository_owner == 'stanfordnlp'
runs-on: ubuntu-latest
environment:
Expand All @@ -71,27 +84,34 @@ jobs:
run: python3 -m pip install --upgrade setuptools wheel twine build
- name: Update version in pyproject.toml
run: 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.toml
run: 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 wheel
run: python3 -m build
- name: Publish distribution 📦 to PyPI (dspy)
uses: pypa/gh-action-pypi-publish@release/v1
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/v1
with:
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 main
with:
commit_message: Update versions
Expand Down
22 changes: 22 additions & 0 deletions dspy/.internal_dspyai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "okhattab@stanford.edu" }
]
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"]
23 changes: 0 additions & 23 deletions dspy/.internal_dspyai/setup.py

This file was deleted.

Loading