Skip to content

Make CIMA imports lazy to remove hard dependency#1

Open
johnfmarkham wants to merge 1 commit into
FarabellaLab:mainfrom
johnfmarkham:fix/lazy-cima-imports
Open

Make CIMA imports lazy to remove hard dependency#1
johnfmarkham wants to merge 1 commit into
FarabellaLab:mainfrom
johnfmarkham:fix/lazy-cima-imports

Conversation

@johnfmarkham

Copy link
Copy Markdown

Summary

  • various.py imported five symbols from CIMA at module level, so installing or importing smlm_simulator unconditionally required CIMA — even for users who never call getClusterFeatures with 'volume' in selected_features.
  • Three of those imports (TransformBlurrer, MapFeatures, SegmentXYZ) are moved inside the if 'volume' in selected_features branch where they are actually used.
  • Two imports (clusters, DensityProprieties) were unused anywhere in the package and are simply removed.

Behaviour change

None. CIMA is still imported automatically whenever getClusterFeatures(..., selected_features=[..., 'volume', ...]) is called, exactly as before. All other call paths are unaffected.

Motivation

CIMA has its own heavyweight dependencies and is tied to a specific Python version, making it difficult to install smlm_simulator in environments that don't need the volume-computation feature. Lazy imports are the standard Python pattern for optional heavy dependencies.

🤖 Generated with Claude Code

CIMA is only needed when 'volume' is requested in getClusterFeatures.
Move the three used CIMA imports inside that branch so that importing
smlm_simulator does not require CIMA to be installed.

Also removes two unused top-level imports (clusters, DensityProprieties)
that were imported from CIMA but never referenced anywhere in the package.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Copilot AI review requested due to automatic review settings May 29, 2026 08:36
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.

1 participant