-
Notifications
You must be signed in to change notification settings - Fork 4
Development
Note, this applies to the Pydantic version of the codebase (https://github.com/BioimageAnalysisCoreWEHI/napari_lattice/pull/47)
The repo is divided into two python packages: core
(the core processing and CLI) and plugin
(the Napari GUI).
Within each directory is:
- The python package
-
pyproject.toml
, the package metadata, and -
tests/
, which contains the tests
From the repository root:
pip install -e core -e plugin
Used for defining the parameter sets, performing parameter validation and conversion. These models live in core/lls_core/models
.
Note, lls_core
uses Pydantic 1.X, which has a different API to Pydantic 2.X.
You can find relevant documentation here: https://docs.pydantic.dev/1.10/
Used for all image representations, where they are treated as multidimensional arrays with dimensional labels (X, Y, Z etc). Refer to: https://xarray.pydata.org/.
The CLI is defined using Typer: https://typer.tiangolo.com/.
These packages are used to define the GUI, which you can find in plugin/napari_lattice
.
magicclass
builds on magicgui
by providing the @magicclass
decorator which turns a Python class into a GUI.
Whenever a new parameter is added, the following components need to be updated:
- Add the parameter to the Pydantic models
- Add the parameter to the CLI (
core/lls_core/cmds/__main__.py
), and define mapping between CLI and Pydantic using theCLI_PARAM_MAP
- Add the field to the GUI in
plugin/napari_lattice/fields.py
- Define the new processing logic in
core/lls_core/models/lattice_data.py
An example of this can be found in this commit: https://github.com/BioimageAnalysisCoreWEHI/napari_lattice/pull/47/commits/16b28fec307f19e73b8d55e677621082037b2710.
The tests are run using pytest.
To install the testing dependencies, use pip install -e 'core[testing]' -e 'plugin[testing]'
Since there are two separate packages, you will have to specify the location of each test directory.
To run all the tests, use pytest core/tests/ plugin/tests
from the root directory.