Skip to content

huge diff: refactor to include utilities container and more settings#35

Merged
TimMonko merged 11 commits intondev-kit:mainfrom
TimMonko:feat/utilities
Dec 3, 2025
Merged

huge diff: refactor to include utilities container and more settings#35
TimMonko merged 11 commits intondev-kit:mainfrom
TimMonko:feat/utilities

Conversation

@TimMonko
Copy link
Member

@TimMonko TimMonko commented Dec 3, 2025

xref: ndev-kit/napari-ndev#210

  1. Rip out Utilities Container from napari-ndev
  2. Move helpers from napari-ndev to here <- this needs refactored out completely later
  3. Update settings
  4. update some pyproject config / pre-commit to fix things
  5. lazy imports to improve import time (2.5s to 15ms, but nImage still pulls in BioImage which is ~2s)
  6. fix and add tests, but nothing is "broken" re: legacy code

Copilot explanation

This pull request introduces several improvements and updates across the codebase, focusing on standardizing configuration naming, expanding settings for export functionality, enhancing dependency management, and adding new utility functions. The changes also improve documentation and developer experience.

Configuration and Settings Standardization

  • Renamed all references of ndevio_Reader to ndevio_reader in settings, code, and documentation for consistency and clarity. This affects YAML files, code logic, and markdown documentation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

  • Added new export-related settings under ndevio_export to ndev_settings.yaml, enabling control over canvas scaling, size, and override behavior for exported figures and screenshots.

Dependency and Environment Updates

  • Updated dependencies in pyproject.toml: pinned ndev-settings to version >=0.4.0, added new packages (napari, nbatch, natsort, magicgui, magic-class), and included bioio-czi for development/testing. Also set a minimum coverage threshold for tests. [1] [2] [3]

  • Modified .pre-commit-config.yaml to exclude src/ndevio/ndev_settings.yaml from YAML syntax checks and updated the ndev-settings hook to use version 0.4.0. [1] [2]

Utilities and API Enhancements

  • Added a new helpers.py module with utility functions for file handling and image processing, such as directory scanning, channel name extraction, dimension order calculation, ID string creation, missing file checking, and string elision.

  • Updated __init__.py to support lazy loading of nImage and expose the new helpers module in the public API.

Documentation and Developer Experience

  • Improved documentation in AGENTS.md to reflect configuration changes and updated installation instructions to use the correct uv pip command for development dependencies. [1] [2] [3] [4] [5]

Plugin and Widget Contributions

  • Added a new "I/O Utilities" widget to napari.yaml for easier access to file and export utilities from the napari interface. [1] [2]

These changes collectively improve maintainability, usability, and extensibility of the codebase while introducing new features and ensuring consistency across settings and documentation.

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 86.21359% with 71 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ndevio/widgets/_utilities_container.py 84.61% 66 Missing ⚠️
src/ndevio/helpers.py 94.11% 4 Missing ⚠️
src/ndevio/__init__.py 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ndevio package to include a comprehensive utilities widget container and introduces new export settings. The main changes involve renaming settings keys from PascalCase to snake_case (ndevio_Reader → ndevio_reader), adding a new UtilitiesContainer widget for image I/O operations in napari, implementing lazy imports for performance, and introducing helper functions for common image processing tasks.

  • Renamed settings key ndevio_Reader to ndevio_reader for consistency
  • Added new UtilitiesContainer widget providing batch concatenation, scene extraction, layer export, and canvas screenshot functionality
  • Introduced helpers.py module with utility functions for file handling, channel names, and string manipulation

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
tests/test_nimage.py Updated test assertions to use new snake_case settings key ndevio_reader
tests/test_helpers.py Added comprehensive test coverage for new helper functions
src/ndevio/widgets/_utilities_container.py New widget providing I/O utilities including batch operations, scene extraction, and export functionality
src/ndevio/widgets/_scene_widget.py Updated to use new snake_case settings key ndevio_reader
src/ndevio/widgets/init.py Added UtilitiesContainer to exports
src/ndevio/nimage.py Updated settings references and moved imports for lazy loading optimization
src/ndevio/ndev_settings.yaml Renamed settings section to snake_case and added new ndevio_export settings
src/ndevio/napari.yaml Registered new UtilitiesContainer widget
src/ndevio/helpers.py New module with helper functions for file operations and image metadata
src/ndevio/_napari_reader.py Updated to use new snake_case settings key
src/ndevio/init.py Implemented lazy imports using getattr for performance optimization
pyproject.toml Added new dependencies: napari, nbatch, natsort, magicgui, magic-class
AGENTS.md Updated documentation to reflect new settings naming convention
.pre-commit-config.yaml Excluded ndev_settings.yaml from YAML checks and updated ndev-settings hook version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TimMonko TimMonko merged commit 6b347af into ndev-kit:main Dec 3, 2025
11 of 12 checks passed
@TimMonko TimMonko deleted the feat/utilities branch December 3, 2025 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants