-
Notifications
You must be signed in to change notification settings - Fork 2
Shared Library
The Project/shared/ folder is a lightweight internal library for code that is used by more than one task or the inference app. It prevents duplication without creating tight coupling between tasks. Shared library is kept empty in the template for users to put things in them which are shared for their specific project.
Code lives in
shared/only when it has two or more active consumers — or when you are promoting it there from a task because a second consumer has just appeared.
If you write a utility in Project/TaskA/src/utils/ and later find TaskB needs the same thing, that's the right moment to promote it. Premature sharing creates invisible dependencies that make tasks harder to understand, test, and delete independently.
Good candidates:
| Category | Examples |
|---|---|
| DICOM utilities | Series selection, tag extraction, anonymisation helpers |
| Common metrics | AUC, Dice, sensitivity/specificity wrappers consistent across tasks |
| Evaluation tools | Calibration curves, confidence interval bootstrapping |
| Logging helpers | Standardised MLflow logging wrappers used by all train.py scripts |
| XNAT utilities | Project/subject/session querying shared across data pipelines |
Poor candidates (keep in the task):
| Category | Why |
|---|---|
| Model architectures | Task-specific; premature abstraction leads to over-engineered base classes |
| Dataset-specific transforms | Tightly coupled to one modality or task |
| Task config parsing | Each task owns its own config schema |
Shared code must have its own tests — it is used in multiple places, so a silent bug here affects every consumer. Tests for shared/ live in Project/tests/ (not inside a task's test folder):
Project/tests/
├── __init__.py
├── train_tests/ # Task-specific training tests
└── shared_tests/ # Tests for shared/ utilities
Run with:
cd Project
python -m pytest tests/shared_tests/ -vLast updated: April 2026 · Back to Home
GSTT Clinical Scientific Computing · Project Template Wiki · Last updated: April 2026 · Back to Home
Setup
Using the Template
Compliance
Reference