sanchit-gandhi / whisper-jax

JAX implementation of OpenAI's Whisper model for up to 70x speed-up on TPU.
Apache License 2.0
4.42k stars 383 forks source link

"Can't have direct dependency" when adding `whisper-jax` as a dependency in PyPI release #126

Open IbraheemTuffaha opened 1 year ago

IbraheemTuffaha commented 1 year ago

We are developing a python package that uses whisper and whisper-jax to generate transcripts of videos. https://github.com/ieasybooks/tafrigh/blob/4aece79a3c897416d16310b4f4e613ccd48b424e/pyproject.toml#L37

We are planning to release our package to PyPI, but we faced an issue with whisper-jax https://github.com/ieasybooks/tafrigh/actions/runs/5806087541/job/15738290629

The error states:

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         Invalid value for requires_dist. Error: Can't have direct dependency:  
         "whisper-jax @ git+https://github.com/sanchit-gandhi/whisper-jax.git ; 
         extra == 'whisper'"                                                    
IbraheemTuffaha commented 1 year ago

One way to fix this issue is to have a proper release pipeline into PyPI whenever a significant feature is added. The easiest way to do this is through GitHub Actions for PyPI release. It makes it easy, such that you only create a tag, then a release from the tag. and an automatic job from GitHub Actions will trigger the release and publish the newer version on PyPI.

IbraheemTuffaha commented 1 year ago

To do this, you just add an Action file like this named release.yml in .github/workflows/ folder: https://github.com/ieasybooks/tafrigh/blob/bd1aad168f50b63651b522ec1cecf16f9976f708/.github/workflows/release.yml

Then create a project on PyPI and follow these steps to add a trusted publisher for the workflow defined above: https://docs.pypi.org/trusted-publishers/adding-a-publisher/ Note: I left Environment name empty for my project because I don't use it.

After that, whenever you create a release on GitHub, it will trigger a job to take the code and builds a package and publishes it on PyPI. Remember to update the version of your package, in your case it's specified in setup.py