craffel / mir_eval

Evaluation functions for music/audio information retrieval/signal processing algorithms.
MIT License
588 stars 109 forks source link

Add release workflow for GitHub Actions based PyPI package releases #361

Closed carlthome closed 10 months ago

carlthome commented 10 months ago

What?

Introduce a package release workflow for building and distributing mir_eval to PyPI.

Install workflow on PyPI

Login to https://pypi.org/manage/account/publishing/ and fill in GitHub.com repo details under the mir_eval package settings.

Usage of workflow on GitHub

  1. Update package version in Python code.
  2. Create a GitHub Releases release as repo owner here: https://github.com/craffel/mir_eval/releases
  3. Watch the GitHub Actions workflow run. Once ✅ the newly built package should be on PyPI here https://pypi.org/project/mir_eval
carlthome commented 10 months ago

It would be nice to get out a patched version that works with latest NumPy so we can pip install mir_eval instead of pip install git+https://github.com/craffel/mir_eval@d68afb0b37bfd0ff48a92fbe1ae1325a182cd471. Perhaps a v0.7.1 or something?

bmcfee commented 10 months ago

I think getting this to work will require @craffel to set up an auth token. See https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ (We did this a few years back for librosa and it works like a charm.)

It would be nice to get out a patched version that works with latest NumPy

Agreed - this should be a separate PR though.

craffel commented 10 months ago

Thanks @carlthome and @bmcfee . I added an PyPI API key under the key PYPI_API_TOKEN - let me know if that works.

carlthome commented 10 months ago

It's actually preferred to have shortlived tokens now instead, for PyPI with GitHub Actions (GHA) (as per this) so the key cannot leak through PR logs and be abused.

The installation of this GHA workflow would be that you (@craffel) go to https://pypi.org/manage/project/mir_eval/settings/publishing/ and submit that HTML form as per this screenshot:

image

Then we can merge this (at which nothing happens), and once comfortable with releasing a new PyPI package, create a GitHub Releases release which will start the workflow.

carlthome commented 10 months ago

Agreed - this should be a separate PR though.

👍

craffel commented 10 months ago

Cool, added the workflow.

image
carlthome commented 10 months ago

Great! Then this PR can also be merged so the workflow itself is on main.

After that, it would be a matter of bumping https://github.com/craffel/mir_eval/blob/main/setup.py#L8 and filling in https://github.com/craffel/mir_eval/releases/new with the same version number.

craffel commented 10 months ago

Thanks!