Skip to content

Drop pynwb < 3.1 compatibility code from pynwb_utils - #1939

Open
CodyCBakerPhD wants to merge 2 commits into
claude/validate-broken-symlink-pathfrom
claude/pynwb-utils-drop-legacy-pynwb
Open

CodyCBakerPhD wants to merge 2 commits into
claude/validate-broken-symlink-pathfrom
claude/pynwb-utils-drop-legacy-pynwb

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Yet another split out of #1933 to clean up some dead code

The declared floor in the pyproject.toml is pynwb >= 3.1.0 (and nwbinspector >= 0.7.0 requires pynwb >= 3.1 anyway), which makes several version guards unreachable:

  • validate(): only the pynwb.validate(path=...) branch (pynwb >= 3.0) can run; the paths=[...] tuple-returning form (2.2 to 2.x) and the io= fallback for even older releases are gone.
  • copy_nwb_file(): cache_spec has been accepted by export() since pynwb 2.8.2, so pass it unconditionally.
  • _get_external_images(): ExternalImage exists in every supported pynwb, so import it at module level instead of guarding an ImportError.

The now-unused packaging.version.Version import is removed as well. The NWB schema version checks (e.g. the < 2.1.0 error filter) are about the file being validated, not about pynwb, and are unchanged.

Claude-Session: https://claude.ai/code/session_01HFhMPs6vF5zyeHDvPTvRcA

The declared floor is pynwb >= 3.1.0 (and nwbinspector >= 0.7.0 requires
pynwb >= 3.1 anyway), which makes several version guards unreachable:

- validate(): only the `pynwb.validate(path=...)` branch (pynwb >= 3.0) can
  run; the `paths=[...]` tuple-returning form (2.2 to 2.x) and the
  `io=` fallback for even older releases are gone.
- copy_nwb_file(): `cache_spec` has been accepted by `export()` since
  pynwb 2.8.2, so pass it unconditionally.
- _get_external_images(): `ExternalImage` exists in every supported
  pynwb, so import it at module level instead of guarding an ImportError.

The now-unused `packaging.version.Version` import is removed as well.
The NWB *schema* version checks (e.g. the < 2.1.0 error filter) are about
the file being validated, not about pynwb, and are unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HFhMPs6vF5zyeHDvPTvRcA
@CodyCBakerPhD CodyCBakerPhD self-assigned this Sep 27, 2026
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.35%. Comparing base (4f316f7) to head (023745f).

Files with missing lines Patch % Lines
dandi/pynwb_utils.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@                           Coverage Diff                           @@
##           claude/validate-broken-symlink-path    #1939      +/-   ##
=======================================================================
+ Coverage                                78.33%   78.35%   +0.02%     
=======================================================================
  Files                                       92       92              
  Lines                                    14087    14075      -12     
=======================================================================
- Hits                                     11035    11029       -6     
+ Misses                                    3052     3046       -6     
Flag Coverage Δ
unittests 78.35% <50.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@CodyCBakerPhD
CodyCBakerPhD added this pull request to stack #1940 September 27, 2026 19:29
@CodyCBakerPhD CodyCBakerPhD added the internal Changes only affect the internal API label Sep 27, 2026
@CodyCBakerPhD

Copy link
Copy Markdown
Contributor Author

Note: code is technically covered by the py3-lowest tox environment test that doesn't upload to codecov (could fix that after this stack, seems minor)

@CodyCBakerPhD
CodyCBakerPhD removed this pull request from stack #1940 September 27, 2026 20:17
@CodyCBakerPhD
CodyCBakerPhD added this pull request to stack #1942 September 27, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Changes only affect the internal API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants