adafruit / circuitpython-build-tools

Build scripts for CircuitPython libraries and the bundle
MIT License
28 stars 18 forks source link

The version of a library uploaded to PyPi does not have it's __version__ set. #70

Closed lesamouraipourpre closed 3 years ago

lesamouraipourpre commented 3 years ago

The packaged library uploaded to PyPi does not get the __version__ variables auto-populated with the release version number.

To verify I picked a random recent release that I have never used and downloaded from PyPi and github for comparison:

--- ./Downloaded from github.com/adafruit_lis3dh.py  2021-03-03 00:01:10.000000000 +0000
+++ ./Downloaded from PyPi      /adafruit_lis3dh.py  2021-03-02 23:59:45.000000000 +0000
@@ -40,7 +40,7 @@

 from micropython import const

-__version__ = "5.1.9"
+__version__ = "0.0.0-auto.0"
 __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH.git"

 # Register addresses:

I only noticed because I was working on RaspberryPi and wanted to check if I was running the latest version of a library. I didn't want to use pip list because I have so many virtual environments and I wanted absolute confirmation at runtime but just got 0.0.0-auto.0

For the vast majority of users, including myself, this will be a low priority issue but it would be nice to have it correct.

The PKG-INFO included in the PyPi download does have the correct version number in it but I don't know if that is accessible at run time.

PS. I don't know if this is the repo responsible for the PyPi uploading but it seemed a reasonable place to start.

askpatrickw commented 3 years ago

Is the problem with the release action in library template folder within the cookiecutter repo?

lesamouraipourpre commented 3 years ago

After reading far too much documentation and github repos I think I've got it figured down as follows:

Currently in .github/workflows/release.yml (simplified):

The fix would be to move the version munging to it's own earlier step and do it in place. The files are going to be deleted from the (docker?) container anyway once the release is completed:

This is far above the knowledge level that I feel I have in relation to github/PyPi/CircuitPython and I don't know if this is a viable way to achieve this.

askpatrickw commented 3 years ago

This is excellent @lesamouraipourpre!

I moved the issue to the cookiecutter repo https://github.com/adafruit/cookiecutter-adafruit-circuitpython/issues/127