Address deferred review cleanup on staging#386
Conversation
There was a problem hiding this comment.
Pull request overview
This PR cleans up staging-related technical debt across the monorepo by tightening viscy-utils dependency metadata, exposing a shared provenance helper, improving xarray coordinate handling during annotation conversion, and removing a brittle pytest pythonpath leak in DynaCLR tests.
Changes:
- Refactor
viscy-utilsdependency/extras metadata (moveanndata/natsort/wandbto extras; addviscy-dataruntime dep) and exposecollect_data_provenanceas a public helper. - Tighten xarray coordinate extraction in AnnData conversion and update callbacks to use the shared provenance helper.
- Make DynaCLR tests self-contained by inlining shared helpers into
conftest.py, updating imports, and adding app-local pytestpythonpath; replace deprecatednn.functional.sigmoidusage.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Updates locked dependency/extras metadata for viscy-utils, including new viscy-data runtime dep and extras markers. |
pyproject.toml |
Removes root-level pytest pythonpath entry that leaked DynaCLR test paths globally. |
packages/viscy-utils/pyproject.toml |
Moves anndata to an extra, adds viscy-data runtime dep, and redefines extras/dev groups. |
packages/viscy-utils/src/viscy_utils/evaluation/annotation.py |
Uses .data for embedding coordinate stacking during xarray→AnnData conversion. |
packages/viscy-utils/src/viscy_utils/callbacks/embedding_writer.py |
Promotes data provenance extraction to a public helper and reuses it. |
packages/viscy-utils/src/viscy_utils/callbacks/embedding_snapshot.py |
Switches to the shared provenance helper. |
applications/dynaclr/tests/helpers.py |
Removes standalone helper module; functionality moved into conftest.py. |
applications/dynaclr/tests/conftest.py |
Inlines shared constants/helpers and keeps pytest config/fixtures in one place. |
applications/dynaclr/tests/test_*.py |
Updates imports to pull shared helpers/constants from conftest. |
applications/dynaclr/src/dynaclr/classification.py |
Replaces deprecated nn.functional.sigmoid with torch.sigmoid. |
applications/dynaclr/pyproject.toml |
Adds app-local pytest config (pythonpath = ["tests"]). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Sorry, we can remove the other two commits were to remove some miscellaneous folders and files that were left over. I did have to explicitly add the CI the test applictations/*. I had issues running |
…s into the app directory before running pytest.
…assifier deps Remove applications/*/tests from root testpaths — multiple app conftest.py files collide as the same plugin name when collected together. Apps are now tested per-directory via CI matrix (added in prior commit). Lazy-import wandb and anndata in linear_classifier.py (same pattern as annotation.py) so the module is importable without optional extras. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36e9af7 to
6bcf130
Compare
Remove pythonpath = ["tests"] from app configs and __init__.py from app test dirs — both caused conftest plugin collisions when root pytest collected multiple applications together. Replace all `from conftest import` / `from .conftest import` with either inlined constants or fixture factories so test files no longer need conftest on sys.path. Root testpaths now includes applications/*/tests, so `uv run pytest` runs all 836 tests (packages + applications) in a single invocation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace inlined SYNTH_C/D/H/W, IMG_H/W, N_T/Z/TRACKS, FCMAE_H/W, and MIXED_LOSS_H/W constants with synth_dims and hcs_dims fixtures returning dicts. Single source of truth in each app's conftest.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 34 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Hatchling requires the package directory referenced in [tool.hatch.build.targets.wheel] to exist. Without it, `uv build` fails and `import viscy` breaks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep empty src/viscy/__init__.py (required by hatchling wheel build). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Latest changes:
All tests pass:
|
|
@edyoshikun I fixed conftest issues and some other small inconsistencies, should be ready for review |
Addressing issues leftover from integration of
app-dynaclrandapp-cytolandin #379 (comment)Summary
anndataandwandbas core dependencies even though they are only needed for optional evaluation and embedding-export workflows; this forced every consumer to install heavier packages unnecessarily. This PR moves them behind optional extras, keepstensorstorecore because it is still on the CLI import path, and declaresviscy-dataexplicitly because the embedding callbacks importviscy_dataat runtime.EmbeddingWriter._collect_data_provenance()helper, andannotation.convert()both stacked xarray coords without explicit.dataextraction and imported optionalanndata/natsortat module import time. This PR exposescollect_data_provenance()as a public helper shared by both callbacks, makes the coordinate stacking explicit to avoid fragile xarray-to-numpy coercion, and lazy-imports the optional annotation dependencies with a clear runtime error only when conversion is invoked.nn.functional.sigmoid()in classification prediction. This PR replaces it withtorch.sigmoid().pythonpathhack sohelpers.pycould be imported as a top-level module, which leaked a test-only module into unrelated root test sessions. This PR folds the shared test helpers intoconftest.py, updates imports, adds app-local pytest config for dynaclr, and removes the root pythonpath override so test setup stays local to the app.