Upgrade packaging to pyproject.toml and hatchling

In order to upgrade the packaging of Tryton, I created a hatchling plugin to set dynamic requirements based on the tryton.cfg file: Tryton / hatch-tryton · GitLab
I also started a merge request to upgrade all the packages: Draft: Upgrade to pyproject using hatchling as build-system (!3137) · Merge requests · Tryton / Tryton · GitLab

For now I have identify only one drawback compare to the former setuptools. It is the editable installation. With hatchling it can only use editable with some type of path rewrite which does not contain the rewrite needed for standard module.
But I do not think it is a big deal because non-standard module could be installed in a different path (than trytond.modules) and register the proper entrypoint to be loaded from their python module name.

Also for tryton and trytond, we had custom command to compile mo and rng files. I solved it by using a hatch_build.py custom hook which compile the files on building. The hook file can also be run as python script to compile the same files.

There are still some work to do to upgrade the cx_Freeze build to use the cxfreeze command and pyproject.toml

1 Like

The cookiecutter template has been updated and show how editable mode could work.