simpleflow
simpleflow copied to clipboard
Introduce "hatch" to build & release
Description
This PR introduces the "hatch" library to build eggs/wheels, publish, increment versions. It works a lot better (imho) than setuptools so we should use it 🚀
Details
I was polluted on my computer by weird behaviours (probably related to my PYTHONPATH pyenv setup, previously installed simpleflow, etc. etc.). So I tested on a docker containers, see below.
Installing from git (first commit)
Basically this is enough:
[build-system]
requires = ["hatchling>=1.5.0"]
build-backend = "hatchling.build"
[tool.hatch.version]
path = "simpleflow/__init__.py"
Test:
docker run -v $(pwd)/dist:/tmp/dist -it python bash -c 'pip install --verbose git+https://github.com/botify-labs/simpleflow@fix-git-install >/dev/null; python -c "import simpleflow; print(simpleflow.__version__); print(simpleflow);"; ls /usr/local/lib/python3.12/site-packages/; ls /usr/local/lib/python3.12/site-packages/simpleflow/'
=> we can import simpleflow => no extra directory (default config of hatchling is nice!) => we have the subdirectories
Building an egg or wheel (second commit)
We need to add this so the resulting tarball egg (tar.gz) or wheel (whl) only contain the "simpleflow" folder.
[tool.hatch.build]
include = ["/simpleflow"]
Test:
rm -rf dist/s*
hatch build -c
docker run -v $(pwd)/dist:/tmp/dist -it python bash -c 'pip install /tmp/dist/simpleflow-0.33.1rc1-py3-none-any.whl >/dev/null; python -c "import simpleflow; print(simpleflow.__version__); print(simpleflow);"; ls /usr/local/lib/python3.12/site-packages/'
=> we get simpleflow installed, with no extra directory.
Releasing (third commit)
I adapted the "script/release" script and tested the best I could, but didn't get to the "publish" step yet. I'm curious @ybastide if this could work for you: the version now doesn't preview an automated increment, but you can provide a specific version or rely on hatch goodies to update the number you want ("minor", "patch", etc.).
I think it will work. If you're OK with the rest I can test further of course.