Skip to content

Commit

Permalink
Revert "Fix/push versions (#1958)" (#1974)
Browse files Browse the repository at this point in the history
This reverts commit 1db5272.
  • Loading branch information
okhat authored Dec 22, 2024
1 parent 1db5272 commit 6ae9ed6
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 65 deletions.
37 changes: 8 additions & 29 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ jobs:
name: pypi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: python3 -m pip install --upgrade setuptools wheel twine semver packaging
run: python3 -m pip install setuptools wheel twine semver packaging
- name: Get correct version for TestPyPI release
id: check_version
run: |
Expand All @@ -42,11 +41,11 @@ jobs:
echo "Version to be used for TestPyPI release: $NEW_VERSION"
echo "::set-output name=version::$NEW_VERSION"
- name: Update version in setup.py
run: sed -i '/#replace_package_version_marker/{n;s/__version__="[^"]*"/__version__="${{ steps.check_version.outputs.version }}"/;}' ./dspy/__metadata__.py
run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ steps.check_version.outputs.version }}"/;}' setup.py
- name: Update version in 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 setup.py
run: sed -i '/#replace_package_name_marker/{n;s/__name__="[^"]*"/__name__="dspy-ai-test"/;}' ./dspy/__metadata__.py
run: sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy-ai-test"/;}' setup.py
- 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
Expand All @@ -63,23 +62,22 @@ jobs:
name: pypi
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: python3 -m pip install --upgrade setuptools wheel twine
run: python3 -m pip install setuptools wheel twine
- name: Update version in setup.py (dspy)
run: sed -i '/#replace_package_version_marker/{n;s/__version__="[^"]*"/__version__="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/__metadata__.py
run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' setup.py
- name: Update version in pyproject.toml
run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' pyproject.toml
# Publish to dspy
- name: Update package name in setup.py
run: |
sed -i '/#replace_package_name_marker/{n;s/__name__="[^"]*"/__name__="dspy"/;}' ./dspy/__metadata__.py
sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy"/;}' setup.py
- name: Update package name in pyproject.toml
run: sed -i '/#replace_package_name_marker/{n;s/name="[^"]*"/name="dspy"/;}' pyproject.toml
- name: Build a binary wheel
Expand All @@ -88,7 +86,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi
with:
attestations: false
# Publish to dspy-ai
# Publish to dspy-ai
- name: Update version in setup.py (dspy-ai)
run: sed -i '/#replace_package_version_marker/{n;s/version="[^"]*"/version="${{ needs.extract-tag.outputs.version }}"/;}' ./dspy/.internal_dspyai/setup.py
- name: Update package name in setup.py
Expand All @@ -101,23 +99,4 @@ jobs:
- name: Publish distribution 📦 to PyPI (dspy-ai)
uses: pypa/gh-action-pypi-publish@release/v1 # This requires a trusted publisher to be setup in pypi
with:
attestations: false
- uses: stefanzweifel/git-auto-commit-action@v5 # auto commit changes to main
with:
commit_message: Update versions
create_branch: true
branch: release-${{ needs.extract-tag.outputs.version }}
- name: Checkout main branch
run: |
git fetch origin
git checkout main
- name: Configure git user
run: |
git config --global user.email "actions@github.com"
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: Push changes to main
run: |
git push origin main
attestations: false
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

8 changes: 0 additions & 8 deletions dspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@
configure = settings.configure
context = settings.context

from .__metadata__ import (
__name__,
__version__,
__description__,
__url__,
__author__,
__author_email__
)

import dspy.teleprompt

Expand Down
8 changes: 0 additions & 8 deletions dspy/__metadata__.py

This file was deleted.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ requires = ["setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
# Do not add spaces around the '=' sign for any of the fields
# preceeded by a marker comment as it affects the publish workflow.
#replace_package_name_marker
name="dspy"
name = "dspy"
#replace_package_version_marker
version="2.5.43"
version = "2.5.43"
description = "DSPy"
readme = "README.md"
authors = [{ name = "Omar Khattab", email = "okhattab@stanford.edu" }]
Expand Down
24 changes: 9 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from setuptools import find_packages, setup
import os

# Read the content of the README file
with open("README.md", encoding="utf-8") as f:
Expand All @@ -9,25 +8,20 @@
with open("requirements.txt", encoding="utf-8") as f:
requirements = f.read().splitlines()

metadata = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "dspy", "__metadata__.py"), "r", encoding="utf-8") as f:
exec(f.read(), metadata)
f.close()


setup(
name=metadata["__name__"],
version=metadata["__version__"],
description=metadata["__description__"],
url=metadata["__url__"],
author=metadata["__author__"],
author_email=metadata["__author_email__"],
#replace_package_name_marker
name="dspy",
#replace_package_version_marker
version="2.5.43",
description="DSPy",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/stanfordnlp/dspy",
author="Omar Khattab",
author_email="okhattab@stanford.edu",
license="MIT License",
packages=find_packages(include=["dspy.*", "dspy"]),
python_requires=">=3.9",
python_requires=">=3.9",
install_requires=requirements,

extras_require={
Expand Down

0 comments on commit 6ae9ed6

Please sign in to comment.