Use ruff
to format the code, ideally by setting it up in your editor.
Formatting code with Blender RNA structures can be problematic as short lines
are typically better, so using \fmt: off , #fmt: on can disable the formatter
for a block of code.
You can install ruff, isort, pip... by first installing
uv, then run uv init
in this directory. Then
you can use for example ruff by running uv run ruff format
.
There is a configuration for pre-commit which is not
enabled by default. You can run this manually by (ensure that python -m pip install pre-commit
is installed) running pre-commit
. Note that it checks for
print statements. Print statements with "INFO" as first argument are skipped.
This runs on staged files.
Use predefined python logging module instead of print. If not imported yet, import it into your class:
from dmx.logging import DMX_LOG
Then use it. Choose appropriate level. Default level is Error
, which means Error
and Critical
messages will be displayed. Following logging levels are available:
DMX_LOG.log.critical("Logging critical message here, level 50")
DMX_LOG.log.error("Logging error message here, level 40")
DMX_LOG.log.warning("Logging warning message here, level 30")
DMX_LOG.log.info("Logging info message here, level 20")
DMX_LOG.log.debug("Logging debug message here, level 10")