From e84d190864f406cf993a7df417a7332158dbee9f Mon Sep 17 00:00:00 2001 From: themattinthehatt Date: Fri, 3 Oct 2025 16:53:23 -0400 Subject: [PATCH 1/2] publish workflow --- .github/workflows/publish.yaml | 72 ++++++++++++++++++++++++++++++++++ README.md | 13 +++++- 2 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..813cb31 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,72 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + version: latest + virtualenvs-create: true + virtualenvs-in-project: true + + - name: Extract version from pyproject.toml + id: get_version + run: | + # Extract version from [project] section + VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + echo "project_version=$VERSION" >> $GITHUB_OUTPUT + echo "Project version: $VERSION" + + - name: Extract tag version + id: get_tag + run: | + # Remove 'refs/tags/' prefix and optional 'v' prefix + TAG_VERSION=${GITHUB_REF#refs/tags/} + TAG_VERSION=${TAG_VERSION#v} + echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT + echo "Tag version: $TAG_VERSION" + + - name: Verify version matches tag + run: | + if [ "${{ steps.get_version.outputs.project_version }}" != "${{ steps.get_tag.outputs.tag_version }}" ]; then + echo "ERROR: Tag version (${{ steps.get_tag.outputs.tag_version }}) doesn't match project version (${{ steps.get_version.outputs.project_version }})" + echo "Please ensure your git tag matches the version in pyproject.toml [project] section" + exit 1 + fi + echo "Version verification passed" + + - name: Install dependencies + run: poetry install --only-root + + - name: Build package + run: poetry build + + - name: Verify build contents + run: | + echo "Built packages:" + ls -la dist/ + echo "Checking wheel contents:" + python -m zipfile -l dist/*.whl | head -20 + + - name: Publish to PyPI + run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }} + + - name: Verify publication + run: | + echo "🎉 Successfully published beast v${{ steps.get_version.outputs.project_version }} to PyPI!" + echo "Package should be available at: https://pypi.org/project/beast-backbones/${{ steps.get_version.outputs.project_version }}/" \ No newline at end of file diff --git a/README.md b/README.md index 04771de..c7e06a7 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,10 @@ conda create --yes --name beast python=3.10 conda activate beast ``` -### Step 3: Download the repo from github and install -Move to your home directory (or wherever you would like to download the code) and install: +### Step 3: Download and install +Move to your home directory (or wherever you would like to download the code) and install via Github clone or through PyPI. + +For Github cloning: ```commandline cd ~ @@ -44,6 +46,13 @@ cd beast pip install -e . ``` +For installation through PyPI: + +```commandline +cd ~ +pip install beast-backbones +``` + ## Usage `beast` comes with a simple command line interface. To get more information, run From bf0a56439eda9390f39ee81aeba2596f32e85a3c Mon Sep 17 00:00:00 2001 From: themattinthehatt Date: Fri, 3 Oct 2025 16:59:39 -0400 Subject: [PATCH 2/2] clean up README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c7e06a7..1b09f4d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,6 @@ Move to your home directory (or wherever you would like to download the code) an For Github cloning: ```commandline -cd ~ git clone https://github.com/paninski-lab/beast cd beast pip install -e . @@ -49,7 +48,6 @@ pip install -e . For installation through PyPI: ```commandline -cd ~ pip install beast-backbones ```