Draft: Update Pipeline#253
Conversation
|
Nice that you already started on this, I thought I set this up haha. @ErikGro What we setup in https://github.com/Hendrik-code/TPTBox: This will automatically commit the fixes ruff can take, which I find neat. As .pre-commit-config.yaml, we utilize: so for every commit, it will automatically fix the things ruff can do before even comitting, and blocks the commit if ruff finds things it cannot automatically fix. These are the rules we set to ignore because too annoying or useless: Maybe this is a help to you, or you can just use this setup. |
There was a problem hiding this comment.
Pull request overview
This draft PR updates the repository’s code-quality pipeline by introducing Ruff + BasedPyright configuration, adding pre-commit hooks, and performing broad import/formatting cleanup across library code, tests, docs, and examples.
Changes:
- Add Ruff + BasedPyright to the dev dependency group and configure them in
pyproject.toml. - Replace the PR lint workflow with dedicated Ruff lint/format and BasedPyright typecheck jobs; add a Ruff pre-commit configuration.
- Apply widespread formatting/import-order cleanups across
panoptica/,unit_tests/,examples/, and docs.
Reviewed changes
Copilot reviewed 60 out of 61 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
unit_tests/test_voronoi_regions.py |
Import order / formatting cleanup. |
unit_tests/test_utils.py |
Import order cleanup. |
unit_tests/test_spatial_caching.py |
Minor whitespace/format cleanup. |
unit_tests/test_serialization.py |
Import ordering of serialization helpers. |
unit_tests/test_part_metrics.py |
Import order cleanup. |
unit_tests/test_panoptic_statistics.py |
Import order cleanup. |
unit_tests/test_panoptic_pipeline.py |
Import cleanup/reorder. |
unit_tests/test_panoptic_pipeline_region_wise.py |
Import reorder and formatting. |
unit_tests/test_panoptic_evaluator.py |
Import cleanup/reorder. |
unit_tests/test_panoptic_aggregator.py |
Import cleanup/reorder. |
unit_tests/test_metrics.py |
Import cleanup/reorder. |
unit_tests/test_matcher_variations.py |
Remove duplicate/unused imports and whitespace cleanup. |
unit_tests/test_labelgroup.py |
Import reorder + minor formatting. |
unit_tests/test_input_sanity_checker.py |
Import reordering and optional-import structure cleanup. |
unit_tests/test_edgecasehandler.py |
Import cleanup/reorder. |
unit_tests/test_datatype.py |
Import reorder and formatting. |
unit_tests/test_config.py |
Import reorder and formatting. |
unit_tests/test_cli.py |
Import reorder. |
unit_tests/test_autc.py |
Import spacing cleanup. |
unit_tests_visual/test_part_metrics.ipynb |
Notebook cell import order / minor cleanup. |
pyproject.toml |
Add Ruff/BasedPyright config; add ruff/basedpyright deps; bump pre-commit; remove flake8. |
poetry.lock |
Lockfile update reflecting new dev tooling and dependency resolution changes. |
panoptica/utils/segmentation_class.py |
Remove unused import / formatting. |
panoptica/utils/processing_pair.py |
Import order cleanup + line wrapping. |
panoptica/utils/parallel_processing.py |
Remove unused import (Pool). |
panoptica/utils/label_group.py |
Minor formatting simplification. |
panoptica/utils/input_check_and_conversion/sanity_checker.py |
Import order cleanup and minor exception handler tweak. |
panoptica/utils/input_check_and_conversion/input_data_type_checker.py |
Import ordering cleanup. |
panoptica/utils/input_check_and_conversion/check_torch_image.py |
Import order cleanup. |
panoptica/utils/input_check_and_conversion/check_sitk_image.py |
Import order cleanup. |
panoptica/utils/input_check_and_conversion/check_numpy_array.py |
Import order cleanup. |
panoptica/utils/input_check_and_conversion/check_nrrd_image.py |
Import order cleanup. |
panoptica/utils/input_check_and_conversion/check_nibabel_image.py |
Import order cleanup. |
panoptica/utils/edge_case_handling.py |
Import order cleanup. |
panoptica/utils/constants.py |
Import order cleanup. |
panoptica/utils/config.py |
Import reorder (notably abstractmethod). |
panoptica/utils/__init__.py |
Reorder and extend re-exports. |
panoptica/panoptica_statistics.py |
Consolidate/clean imports and minor formatting. |
panoptica/panoptica_result.py |
Import consolidation and minor formatting cleanup. |
panoptica/panoptica_pipeline.py |
Import cleanup; simplify TYPE_CHECKING block. |
panoptica/panoptica_evaluator.py |
Import consolidation + formatting improvements. |
panoptica/panoptica_aggregator.py |
Import consolidation/reorder. |
panoptica/metrics/normalized_surface_dice.py |
Split multi-import; import formatting. |
panoptica/metrics/metrics.py |
Import ordering and formatting tweaks. |
panoptica/metrics/hausdorff_distance.py |
Remove unused import. |
panoptica/metrics/__init__.py |
Reorder imports without changing exports. |
panoptica/instance_matcher.py |
Import reordering. |
panoptica/instance_evaluator.py |
Import reorder; remove unused multiprocessing import. |
panoptica/instance_approximator.py |
Import reorder and minor comment placement. |
panoptica/cli.py |
Import reorder; remove unused import. |
panoptica/_functionals.py |
Import reorder and cleanup. |
panoptica/__init__.py |
Import/re-export ordering cleanup. |
examples/example_spine_statistics.py |
Import reorder. |
examples/example_spine_semantic.py |
Minor whitespace/import reorder. |
examples/example_spine_instance.py |
Import reorder. |
examples/example_spine_instance_config.py |
Minor whitespace cleanup. |
examples/example_spine_autc.py |
Import reorder. |
docs/source/preprocess_readme.py |
Lambda formatting change for readability. |
.pre-commit-config.yaml |
Add Ruff lint + Ruff format pre-commit hooks. |
.github/workflows/pr-lint.yml |
Replace reusable workflow with Ruff lint/format + BasedPyright jobs. |
.github/workflows/autoformat.yml |
Remove old reusable autoformat workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from abc import abstractmethod | ||
| from pathlib import Path | ||
|
|
||
| from ruamel.yaml import YAML | ||
|
|
Draft: This is WIP
TODO: