kcleal / pywfa

Python wrapper for wavefront alignment using WFA2-lib
MIT License
35 stars 2 forks source link

pypi install-ability #9

Closed ACEnglish closed 1 year ago

ACEnglish commented 1 year ago

Hello,

Turns out there was more to be done. The tl;dr; is that we still need a shim setup.py, and a few other things changed.

When I tried to install pywfa for a package feature I'm testing, the github action that tests my package wasn't able to successfully install pywfa==0.4.2. I was getting an error that pywfa was named "UNKNOWN-0.0.0"

full error ``` WARNING: Generating metadata for package pywfa produced metadata for project name unknown. Fix your #egg=pywfa fragments. Discarding https://files.pythonhosted.org/packages/5d/92/366a9f0a0a4b34e2650199861a377eddf7e9f24ecc5298efb81352dc7cee/pywfa-0.4.2.tar.gz#sha256=065c782aa917da52c947a7ea1ed9d0e0153325153f7fcc32cca588f08e58136b (from https://pypi.org/simple/pywfa/) (requires-python:>=3.7): Requested unknown from https://files.pythonhosted.org/packages/5d/92/366a9f0a0a4b34e2650199861a377eddf7e9f24ecc5298efb81352dc7cee/pywfa-0.4.2.tar.gz#sha256=065c782aa917da52c947a7ea1ed9d0e0153325153f7fcc32cca588f08e58136b has inconsistent name: filename has 'pywfa', but metadata has 'unknown' ```

I also needed to fix the MANIFEST.in to include the _custom_build.py and Makefile in pywfa/WFA2_lib/*. Also, the new _custom_build.py has a check to ensure that the make command works. However, the make command never exited non-zero due to only returning the status of the final command (was cd pywfa/WFA2_lib; make .. ; cd ../).

I believe these changes should work better because I was able to get python3 setup.py sdist to create a valid, usable python3 -m pip install dist/pywfa-0.5.0.dev1.tar.gz. And by having the shim, things like pip install -e seem to work. Furthermore, I successfully tested by editing my github action to pull directly via: python3 -m pip install 'pywfa @ git+https://github.com/ACEnglish/pywfa'. Which is great, but I don't know if this is a great emulation of what pypi will make.

Finally, I bumped the version to 0.5.0-dev. At least once trying to install 0.4.2 failed and pip slyly installed 0.4.1 instead (which had caused the old undefined symbol: wavefront_align). I'm guessing that bumping the minor version instead of the patch may prevent this.

I don't know your workflow for distributing to pypi, but if possible, could you try a test.pypi.org upload before pushing to regular pypi? If there's more problems, we'll at least not be filling it up with my mistakes lol.

Have a great day, ~/Adam English

kcleal commented 1 year ago

Thanks again, it seems there are so many traps to fall in to. I tested this PR on testPypi and it seemed to work fine. Happy to merge and put on pypi

ACEnglish commented 1 year ago

Looks like it works! Thanks for putting this out there.