Update package metadata and dev experience
Background
Hello there! As discussed in Discord, this is a PoC showing what a switch to Hatch would look like. Some new users include Black, Pydantic, MkDocs, and FastAPI.
The only thing lost is the lock file, since the format is not yet standardized. This can be thought of as an improvement though since Textual is a library for actual apps to use. (examples: https://github.com/ics-py/ics-py/pull/354, https://github.com/P403n1x87/austin-python/pull/9, https://github.com/delb-xml/delb-py/commit/010f5f056572712ce965c33a0a325358347d395a)
Build backend
The Python packaging ecosystem has standardized on the format for metadata declaration (PEP 621/PEP 631). The build backend hatchling (of which I am a maintainer in the PyPA) is now used as that is the default in the official Python packaging tutorial.
Hatchling is available on all the major distribution channels such as Debian, Fedora, Arch Linux, conda-forge, Nixpkgs, Alpine Linux, FreeBSD/OpenBSD, Gentoo Linux, MacPorts, OpenEmbedded, Spack, MSYS2, etc.
PyPI landing page
As you can see on https://pypi.org/project/textual/0.2.0b8/, the links to code samples and images are broken. This PR fixes that by using @hynek's awesome hatch-fancy-pypi-readme plugin.
Dev experience
The dependencies for testing, linting, and documentation are now separated into 3 different environments. This speeds up install/syncing operations and reduces the chance of conflicts or runtime side effects.
default- the dependencies for testing are installed here along with the project and thedevoptional dependency group. thedefaultenvironment is special in that Hatch will use it always in lieu of a selection e.g.hatch run testvshatch run docs:servedocs- the dependencies for documentation are installed here. the project and thedevoptional dependency group are also required formkdocstringsauto-generation of docslint- only the dependencies for linting are installed here
This now works on Windows! (Makefiles do not without great effort)
Python version cap
I removed the Python upper bound constraint as upper bounds for libraries are heavily discouraged by the community and that was just a thing that Poetry recommended.
Future
- Move config for Mypy out of
mypy.iniand intopyproject.toml - Hatch has a large ecosystem of plugins, so for example you could use Git for versioning or ship optional wheels compiled with Mypyc, as Black recently did
- If you want I can do this for Rich too
Thanks! Will look at this after the pending release. Need to understand a bit more about Hatch.
Happy to help! I'm interested in hearing your thoughts.
I rebased, would you mind triggering the CI with that button below?
Passing 🙂
Thanks @ofek . We're just about to release a new version. But I reckon we should go all in with Hatch after that.
Cool, rebased again
Thanks. Next release will be "hatched"!