Skip to content

Commit

Permalink
Merge pull request #3 from chenmoneygithub/prerelease-test
Browse files Browse the repository at this point in the history
Add testing before pypi publish
  • Loading branch information
chenmoneygithub authored Mar 4, 2025
2 parents 2957c5f + 18978db commit e30d393
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ jobs:
run: python3 -m build
# Test the locally built wheel
- name: Create test environment
run: python -m venv test_env
run: python -m venv test_before_testpypi
- name: Test package installation and functionality
run: |
source test_env/bin/activate
source test_before_testpypi/bin/activate
# Install the locally built wheel and testing dependencies
pip install dist/*.whl pytest
python -c "import dspy; print(dspy.__version__)"
Expand Down Expand Up @@ -93,6 +93,16 @@ jobs:
run: sed -i '/#replace_package_name_marker/{n;s/__name__ *= *"[^"]*"/__name__="dspy"/;}' ./dspy/__metadata__.py
- name: Build a binary wheel
run: python3 -m build
# Test the locally built wheel before publishing to pypi
- name: Create test environment
run: python -m venv test_before_pypi
- name: Test package installation and functionality
run: |
source test_before_pypi/bin/activate
# Install the locally built wheel and testing dependencies
pip install dist/*.whl pytest
pytest tests/metadata/test_metadata.py tests/predict
deactivate
- name: Publish distribution 📦 to PyPI (dspy)
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
11 changes: 11 additions & 0 deletions tests/metadata/test_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import dspy
import re


def test_metadata():
assert dspy.__name__ == "dspy"
assert re.match(r"\d+\.\d+\.\d+", dspy.__version__)
assert dspy.__author__ == "Omar Khattab"
assert dspy.__author_email__ == "okhattab@stanford.edu"
assert dspy.__url__ == "https://github.com/stanfordnlp/dspy"
assert dspy.__description__ == "DSPy"

0 comments on commit e30d393

Please sign in to comment.