Hi,
I’d like to share my experience developing multiple custom modules with the latest Tryton development version (8.3) and the new hatchling packaging.
I always develop my custom modules on Tryton dev and then graft the necessary changes onto the lower branches.
Until now (with setuptools), I created symlinks of my custom modules in trytond/modules (the same approach as for the standard Tryton modules), so I could import a custom module this way:
from trytond.modules.custom_module import ...
To use my modules in a lower branch, I simply ran:
pip install -e custom_module --use-pep517
which installed all the dependencies.
But now, with the new hatchling system, I’m running into problems when using several custom modules that depend on one another: the import paths of custom modules are no longer valid in some branches (8.2).
Here’s my solution:
- First, use the latest cookiecutter template to create your custom module with
hatchling(and the symlink if your module name is prefixed):
cookiecutter --output-dir tryton_custo cookiecutter-module - If you develop on Tryton dev, install your custom module in editable mode with the
--no-depsoption:
pip install -e custom_module --use-pep517 --no-deps - If you need to import a custom module inside another custom module, use:
from prefix_custom_module.module_file import model
Hope this helps. Feel free to share your own approach! ![]()