Skip to content

Resolve inconsistent parameter names via aliasing + deprecationwarning.#3332

Open
deruyter92 wants to merge 8 commits into
mainfrom
jaap/rename_parameters
Open

Resolve inconsistent parameter names via aliasing + deprecationwarning.#3332
deruyter92 wants to merge 8 commits into
mainfrom
jaap/rename_parameters

Conversation

@deruyter92
Copy link
Copy Markdown
Collaborator

Standardize public API parameter names

This PR cleans up a series of inconsistent parameter names across the public DeepLabCut API. All renames are fully backward-compatible: the old names
are preserved as deprecated aliases via the existing @renamed_parameter decorator, which emits a
DLCDeprecationWarning.

Changes

  • Shuffles, shufflesshuffles
  • Snapindex, snapshotindexsnapshotindex
  • videotype, video_type, extensionsextensions
  • batchsize, batch_sizebatch_size
  • displayiters, display_itersdisplay_iters
  • saveiters, save_iterssave_iters
  • maxiters, max_itersmax_iters
  • comparisonbodyparts, comparison_bodypartscomparison_bodyparts

All docstrings and inline examples have been updated to use the new names.

@deruyter92 deruyter92 marked this pull request as ready for review May 15, 2026 10:48
@deruyter92 deruyter92 requested a review from C-Achard May 15, 2026 10:48
Comment thread deeplabcut/compat.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Definitely like this one, we have several inconsistencies throughout between snake/camel case and this makes the API easier imo.

Copy link
Copy Markdown
Collaborator

@C-Achard C-Achard left a comment

Choose a reason for hiding this comment

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

Really nice overall !

I just have a few broader questions to make sure this stays "healthy" on the longer term:

  • Can we handle non-keyword args safely with this ? Are there still risks of collisions/improper usage for users ?
  • I think we should disallow "chaining" renames if possible, ie. videotype -> video_type is fine, but videotype -> video_type -> extensions raises, if possible. Not 100% needed. docs could suffice
  • I would favor having super-clear rules on the decorator itself. e.g. : Always use the new version in code and never the old. Do not chain rename or stack, etc.
  • We could also systematically test these, but not crucial

I don't mean to keep this blocked though, I just think a bit of documentation would be perfect, no need to go much further yet (automation etc)

Base automatically changed from jaap/update_list_videos_in_folder to main May 15, 2026 12:03
@MMathisLab
Copy link
Copy Markdown
Member

merge conflicts need fixing @deruyter92

@deruyter92 deruyter92 force-pushed the jaap/rename_parameters branch from 81cfba6 to 6e6df5f Compare May 15, 2026 12:28
@deruyter92
Copy link
Copy Markdown
Collaborator Author

@MMathisLab I have resolved all conflicts and rebased on main now

@deruyter92 deruyter92 marked this pull request as draft May 15, 2026 12:33
@deruyter92
Copy link
Copy Markdown
Collaborator Author

@C-Achard, currently addressing your review, valid points thanks!

@deruyter92
Copy link
Copy Markdown
Collaborator Author

@C-Achard

  1. Can we handle non-keyword args safely with this ? Are there still risks of collisions/improper usage for users ?
  2. I think we should disallow "chaining" renames if possible, ie. videotype -> video_type is fine, but videotype -> video_type -> extensions raises, if possible. Not 100% needed. docs could suffice
  3. I would favor having super-clear rules on the decorator itself. e.g. : - - Always use the new version in code and never the old. Do not chain rename or stack, etc.
  4. We could also systematically test these, but not crucial
  1. Positional arguments currently bypass the decorator by design, which is the correct behavior. Changing the order of positional arguments still breaks the API as it would normally (now documented).
  2. I agree, this is potentially dangerous when misused. This case is easy to intercept and I've added a guard now. Also added an extra guard for typos in the name of the new parameter.
  3. Agreed. Added rules in the docstring now. Let me know if you agree.
  4. Added some tests!

@C-Achard
Copy link
Copy Markdown
Collaborator

Amazing thank you @deruyter92 !

@deruyter92 deruyter92 marked this pull request as ready for review May 15, 2026 13:53
@deruyter92 deruyter92 marked this pull request as draft May 15, 2026 14:12
@deruyter92 deruyter92 force-pushed the jaap/rename_parameters branch from b02268f to 128a390 Compare May 15, 2026 14:20
@deruyter92
Copy link
Copy Markdown
Collaborator Author

(rebased again, removing empty diffs)

@deruyter92 deruyter92 marked this pull request as ready for review May 15, 2026 14:22
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.

3 participants