Moved derive unit API to DLUnit

Derived units now use a DLUnit class similar to a DLPak to be easily
stored and loaded, the public API has been updated to either take a
DLUnit object or a Path where it reads the DLUnit from a *.dlunit file

The .dlunit file is a ZIP compressed archive containing two files, a
manifest.json which stores the units uuid, its input signals and its
output signal, and unit.py which is the python code for the unit, the
same rules apply (one python function with a specifically structured
signature) as when a string was passed in the old API

Errors have been added to have a DLUnitError similar to the DLPakError
as the DLUnit class is heavily inspired from the DLPak architecutre

Logging may still be primitive, this will be covered in the next AI
logging sweep to homogenize and clean up the logging aspect of things
This commit is contained in:
h3cx committed 2026-09-15 17:13:27 +02:00
1 parent 9407bfeb79
commit 207a91811e
10 files changed
+378 -44

No files matched your search

+4
View File
@@ -27,6 +27,10 @@ class DLPakError(DynaLabError):
"""A DLPak archive cannot be prepared, read, or written."""
class DLUnitError(DynaLabError):
"""A DLPak archive cannot be prepared, read, or written."""
class DeriveError(DynaLabError):
"""A derive unit cannot be created or used as requested."""