Skip to content

Deprecate positional conversion options in add_to_nwbfile and interface init#1663

Merged
h-mayorquin merged 3 commits intomainfrom
deprecate_postional_only_on_nwbfile
Feb 13, 2026
Merged

Deprecate positional conversion options in add_to_nwbfile and interface init#1663
h-mayorquin merged 3 commits intomainfrom
deprecate_postional_only_on_nwbfile

Conversation

@h-mayorquin
Copy link
Collaborator

Allows only nwbfile and metadata for add_to_nwbfile
Allows file_path, file_paths and folder_path for __init__

@h-mayorquin h-mayorquin marked this pull request as ready for review February 13, 2026 17:05
Copy link
Contributor

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 pull request enforces keyword-only arguments for conversion options across all data interfaces in NeuroConv. The changes ensure that __init__ methods only accept file_path, folder_path, or file_paths as positional arguments, while add_to_nwbfile methods only accept nwbfile and metadata positionally. All other parameters must be passed as keyword arguments.

Changes:

  • Added deprecation handling using *args pattern in __init__ and add_to_nwbfile methods across ~100 data interfaces
  • Replaced existing * keyword-only markers with *args temporarily to maintain backward compatibility during deprecation period
  • Updated super() calls to use keyword arguments where necessary to avoid passing positional arguments to parent methods

Reviewed changes

Copilot reviewed 70 out of 70 changed files in this pull request and generated 10 comments.

File Description
src/neuroconv/datainterfaces/**/*.py Added *args deprecation pattern with FutureWarning for positional conversion options in init and add_to_nwbfile methods across all interface files
docs/developer_guide/style_guide.rst Documented the new convention requiring keyword-only arguments for conversion options with code examples
CHANGELOG.md Added entry documenting the keyword-only argument enforcement and deprecation timeline
Comments suppressed due to low confidence (2)

src/neuroconv/datainterfaces/ophys/femtonics/femtonicsdatainterface.py:161

class CellExplorerRecordingInterface(BaseRecordingExtractorInterface):

# v0.9.2 (Upcoming)

## Removals, Deprecations and Changes
* Enforced keyword-only arguments across all data interfaces: `__init__` methods now only accept `file_path`/`folder_path`/`file_paths` as positional arguments, and `add_to_nwbfile` methods only accept `nwbfile` and `metadata` as positional arguments. Existing positional usage in `add_to_nwbfile` will emit a `FutureWarning` and will be removed on or after August 2026. [PR #1663](https://github.com/catalystneuro/neuroconv/pull/1663)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The CHANGELOG entry should mention that both __init__ and add_to_nwbfile methods will emit FutureWarning for positional argument usage. Currently, it only mentions add_to_nwbfile. Consider updating to: "Existing positional usage in both __init__ and add_to_nwbfile will emit a FutureWarning and will be removed on or after August 2026."

Suggested change
* Enforced keyword-only arguments across all data interfaces: `__init__` methods now only accept `file_path`/`folder_path`/`file_paths` as positional arguments, and `add_to_nwbfile` methods only accept `nwbfile` and `metadata` as positional arguments. Existing positional usage in `add_to_nwbfile` will emit a `FutureWarning` and will be removed on or after August 2026. [PR #1663](https://github.com/catalystneuro/neuroconv/pull/1663)
* Enforced keyword-only arguments across all data interfaces: `__init__` methods now only accept `file_path`/`folder_path`/`file_paths` as positional arguments, and `add_to_nwbfile` methods only accept `nwbfile` and `metadata` as positional arguments. Existing positional usage in both `__init__` and `add_to_nwbfile` will emit a `FutureWarning` and will be removed on or after August 2026. [PR #1663](https://github.com/catalystneuro/neuroconv/pull/1663)

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,5 @@
import json
import warnings
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Module 'warnings' is imported with both 'import' and 'import from'.

Copilot uses AI. Check for mistakes.
@@ -1,3 +1,4 @@
import warnings
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Module 'warnings' is imported with both 'import' and 'import from'.

Suggested change
import warnings

Copilot uses AI. Check for mistakes.
@@ -1,3 +1,4 @@
import warnings
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Module 'warnings' is imported with both 'import' and 'import from'.

Copilot uses AI. Check for mistakes.
FutureWarning,
stacklevel=2,
)
icephys_experiment_type = positional_values.get("icephys_experiment_type", icephys_experiment_type)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable icephys_experiment_type is not used.

Copilot uses AI. Check for mistakes.
)
gain = positional_values.get("gain", gain)
xml_file_path = positional_values.get("xml_file_path", xml_file_path)
verbose = positional_values.get("verbose", verbose)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable verbose is not used.

Copilot uses AI. Check for mistakes.
gain = positional_values.get("gain", gain)
xml_file_path = positional_values.get("xml_file_path", xml_file_path)
verbose = positional_values.get("verbose", verbose)
es_key = positional_values.get("es_key", es_key)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable es_key is not used.

Copilot uses AI. Check for mistakes.
)
stream_name = positional_values.get("stream_name", stream_name)
block_index = positional_values.get("block_index", block_index)
stub_test = positional_values.get("stub_test", stub_test)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable stub_test is not used.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it is. can you double check this? @copilot

include_roi_centroids = positional_values.get("include_roi_centroids", include_roi_centroids)
include_roi_acceptance = positional_values.get("include_roi_acceptance", include_roi_acceptance)
mask_type = positional_values.get("mask_type", mask_type)
plane_segmentation_name = positional_values.get("plane_segmentation_name", plane_segmentation_name)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Variable plane_segmentation_name is not used.

Copilot uses AI. Check for mistakes.
)
noise_std = positional_values.get("noise_std", noise_std)

super().__init__(filename=file_path, noise_std=noise_std)
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Keyword argument 'filename' is not a supported parameter name of method AxonaRecordingInterface.init.
Keyword argument 'noise_std' is not a supported parameter name of method AxonaRecordingInterface.init.

Suggested change
super().__init__(filename=file_path, noise_std=noise_std)
super().__init__(file_path=file_path)

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Feb 13, 2026

@h-mayorquin I've opened a new pull request, #1665, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Member

@pauladkisson pauladkisson left a comment

Choose a reason for hiding this comment

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

It was a lot of files, so I wanted to try out Copilot review to see if it would catch anything that I missed. As far as I can tell, the changes look good. Copilot's review seems to have caught a bunch of off-target stuff. Some of which may be legitimate and others that are really not. So I'll let you decide what to do with all that.

@h-mayorquin
Copy link
Collaborator Author

It was a lot of files, so I wanted to try out Copilot review to see if it would catch anything that I missed. As far as I can tell, the changes look good. Copilot's review seems to have caught a bunch of off-target stuff. Some of which may be legitimate and others that are really not. So I'll let you decide what to do with all that.

Thanks, this makes sense. That's partly why I shared with you #1664 as an entry point (which included these changes.

Yes, I checked some of the github copilot review and I think it went off the rails.

Thanks for the review.

@h-mayorquin h-mayorquin enabled auto-merge (squash) February 13, 2026 18:37
@h-mayorquin h-mayorquin merged commit c05185a into main Feb 13, 2026
24 checks passed
@h-mayorquin h-mayorquin deleted the deprecate_postional_only_on_nwbfile branch February 13, 2026 19:13
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 14.68468% with 947 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.18%. Comparing base (9f2c0e6) to head (80ba461).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
.../ecephys/cellexplorer/cellexplorerdatainterface.py 10.00% 45 Missing ⚠️
...tainterfaces/ecephys/plexon/plexondatainterface.py 15.90% 37 Missing ⚠️
...aces/ecephys/neuroscope/neuroscopedatainterface.py 10.81% 33 Missing ⚠️
...s/ophys/miniscope/miniscopeimagingdatainterface.py 12.50% 28 Missing ⚠️
...datainterfaces/ophys/minian/miniandatainterface.py 10.71% 25 Missing ⚠️
...tainterfaces/ophys/suite2p/suite2pdatainterface.py 10.71% 25 Missing ⚠️
...terfaces/ecephys/spikeglx/spikeglxnidqinterface.py 7.69% 24 Missing ⚠️
...aces/ophys/scanimage/scanimageimaginginterfaces.py 7.69% 24 Missing ⚠️
...cephys/openephys/openephybinarysanaloginterface.py 8.00% 23 Missing ⚠️
...v/datainterfaces/ecephys/edf/edfanaloginterface.py 8.33% 22 Missing ⚠️
... and 53 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1663      +/-   ##
==========================================
- Coverage   86.52%   80.18%   -6.34%     
==========================================
  Files         159      159              
  Lines       11539    12624    +1085     
==========================================
+ Hits         9984    10123     +139     
- Misses       1555     2501     +946     
Flag Coverage Δ
unittests 80.18% <14.68%> (-6.34%) ⬇️

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

Files with missing lines Coverage Δ
...s/behavior/lightningpose/lightningposeconverter.py 80.24% <ø> (ø)
...ainterfaces/ecephys/maxwell/maxonedatainterface.py 100.00% <100.00%> (ø)
...onv/datainterfaces/ecephys/tdt/tdtdatainterface.py 69.76% <ø> (ø)
...ainterfaces/ophys/baseimagingextractorinterface.py 77.01% <ø> (ø)
...rfaces/ophys/basesegmentationextractorinterface.py 79.31% <ø> (ø)
...faces/behavior/miniscope/miniscopedatainterface.py 84.61% <27.27%> (-15.39%) ⬇️
...datainterfaces/ophys/caiman/caimandatainterface.py 71.42% <27.27%> (-28.58%) ⬇️
...v/datainterfaces/ophys/cnmfe/cnmfedatainterface.py 65.21% <27.27%> (-34.79%) ⬇️
...phys/inscopix/inscopixsegmentationdatainterface.py 83.82% <20.00%> (-5.07%) ⬇️
.../micromanagertiff/micromanagertiffdatainterface.py 80.95% <27.27%> (-19.05%) ⬇️
... and 58 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants