eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.13k stars 723 forks source link

Modernize build (to Hatch) #774

Closed akx closed 6 months ago

akx commented 6 months ago

This is a reimplementation of #712 and #719.


The packages generated are practically similar – this actually uncovered that tests/testsupport wasn't being correctly packaged into the sdist before, so tests probably couldn't run with that package.

$ python ~/build/pkgdiff/pkgdiff.py ./dist-orig/paho-mqtt-1.6.1.tar.gz ./dist/paho_mqtt-1.6.1.tar.gz --strip=1
# 9 files only in ./dist-orig/paho-mqtt-1.6.1.tar.gz
MANIFEST.in
setup.cfg
setup.py
src/paho_mqtt.egg-info/PKG-INFO
src/paho_mqtt.egg-info/SOURCES.txt
src/paho_mqtt.egg-info/dependency_links.txt
src/paho_mqtt.egg-info/not-zip-safe
src/paho_mqtt.egg-info/requires.txt
src/paho_mqtt.egg-info/top_level.txt
# 4 files only in ./dist/paho_mqtt-1.6.1.tar.gz
.gitignore
pyproject.toml
tests/testsupport/__init__.py
tests/testsupport/broker.py
# 46 common files
PKG-INFO {'size': (47507, 47514)}
README.rst {'size': (46461, 46454)}
$ python ~/build/pkgdiff/pkgdiff.py ./dist-orig/paho_mqtt-1.6.1-py3-none-any.whl ./dist/paho_mqtt-1.6.1-py3-none-any.whl
# 2 files only in ./dist-orig/paho_mqtt-1.6.1-py3-none-any.whl
paho_mqtt-1.6.1.dist-info/LICENSE.txt
paho_mqtt-1.6.1.dist-info/top_level.txt
# 1 files only in ./dist/paho_mqtt-1.6.1-py3-none-any.whl
paho_mqtt-1.6.1.dist-info/licenses/LICENSE.txt
# 13 common files
paho_mqtt-1.6.1.dist-info/METADATA {'size': (47508, 47514)}
paho_mqtt-1.6.1.dist-info/RECORD {'size': (1186, 1102)}
paho_mqtt-1.6.1.dist-info/WHEEL {'size': (92, 87)}
akx commented 6 months ago

Hey @ofek, if you have time to take a peek – I think I'm getting something hopelessly wrong with the src layout stuff if python -m build . is complaining

* Creating venv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (hatchling)
* Getting build dependencies for wheel...
* Building wheel...
OSError: Error getting the version from source `regex`: file does not exist: src/paho/mqtt/__init__.py

I kinda understand that since the src/ directory isn't there in the sdist anymore, but I think I'm Doing It Wrong here 😁

akx commented 6 months ago

Thanks @ofek ❤️

ofek commented 6 months ago

Happy to help! Thanks for using your free time to update projects 😄

akx commented 6 months ago

@PierreF Rebased, ready for review.

PierreF commented 6 months ago

Thank for this work. Also thank @cclauss and @semuadmin for the other PR on the same subject.