Skip to content

Update function signatures - #3458

Draft
deruyter92 wants to merge 22 commits into
jaap/lazy-loadingfrom
jaap/update-function-signatures
Draft

deruyter92 wants to merge 22 commits into
jaap/lazy-loadingfrom
jaap/update-function-signatures

Conversation

@deruyter92

Copy link
Copy Markdown
Collaborator

Motivation
The DeepLabCut API was recently streamlined in #3332 and #3198, which introduced consistent paramteter names (e.g. snake case, lowercase internally consistent parameter names). However several function signatures currently still remain to be normalized.

This PR aims to further streamline all function signatures of all API to normalize

  • config_path: str, config: str --> config: ProjectConfig | str | Path | dict
  • Shuffles --> shuffles
  • TrainFraction --> train_fraction
    etcetera.

Note

This PR is a placeholder that currently has draft status. I am still considering a smaller scope and the specific renames remain to be discussed and tested properly.

@deruyter92
deruyter92 changed the base branch from jaap/prepare_tf_deprecation to jaap/lazy-loading August 21, 2026 08:58
@C-Achard C-Achard added enhancement New feature or request backwards compatibility issues concerning prior to current versions labels Aug 21, 2026
@deruyter92
deruyter92 force-pushed the jaap/update-function-signatures branch from ced1b85 to 16312b9 Compare August 26, 2026 11:34
@deruyter92 deruyter92 added the 3.1 label Aug 28, 2026
@deruyter92
deruyter92 force-pushed the jaap/update-function-signatures branch from 16312b9 to cd3c546 Compare September 3, 2026 08:58
deruyter92 and others added 20 commits September 4, 2026 14:15
Apply a new parameter-aliasing deprecation round (since 3.0.2) to the
public API, GUI, and internals: add @renamed_parameter markers and update
signatures, docstrings, and call sites for parameters that still used
legacy camelCase or concatenated names (e.g. outlieralgorithm ->
outlier_algorithm, filtertype -> filter_type, trainFraction ->
train_fraction). Update tests for the new names.
…ideos_converth5_to_nwb

Note that the default None is also expanded only ".mp4" types to all supported videos. This is a minor behavior change that alligns the current function with the rest of API.
@deruyter92
deruyter92 force-pushed the jaap/update-function-signatures branch from 4ea3a89 to 558e2e5 Compare September 4, 2026 12:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Cross-backend routing regressions, unsupported 3D config contracts, and failing legacy call sites remain unresolved.

Pull request overview

Standardizes DeepLabCut API parameters with snake_case names, deprecated aliases, and broader ProjectConfig support.

Changes:

  • Renames parameters while preserving legacy aliases.
  • Migrates project APIs toward typed configuration objects.
  • Updates internal callers, GUI code, examples, and routing tests.
File summaries
File Description
tests/api/test_pose_estimation.py Updates routing expectations.
tests/api/test_create_project.py Updates project API expectations.
examples/testscript_transreid.py Uses canonical body-part parameter.
examples/testscript_tensorflow_single_animal.py Uses canonical cropping parameter.
examples/testscript_tensorflow_multi_animal.py Uses canonical body-part parameter.
deeplabcut/utils/plotting.py Normalizes plotting parameters/config handling.
deeplabcut/utils/make_labeled_video.py Normalizes video-creation API.
deeplabcut/utils/conversioncode.py Normalizes conversion APIs.
deeplabcut/utils/auxfun_multianimal.py Adds typed config support.
deeplabcut/tensorflow_compat/pose_estimation.py Adds TensorFlow aliases.
deeplabcut/tensorflow_compat/create_project.py Normalizes project parameters.
deeplabcut/refine_training_dataset/stitch.py Normalizes stitching config input.
deeplabcut/refine_training_dataset/outlier_frames.py Normalizes outlier APIs.
deeplabcut/post_processing/filtering.py Normalizes filtering parameters.
deeplabcut/post_processing/analyze_skeleton.py Adds typed config support.
deeplabcut/pose_estimation_pytorch/data/dlcloader.py Validates object-based configs.
deeplabcut/pose_estimation_pytorch/apis/videos.py Broadens config input and batch aliasing.
deeplabcut/pose_estimation_pytorch/apis/utils.py Broadens config input.
deeplabcut/pose_estimation_pytorch/apis/tracklets.py Normalizes inference config naming.
deeplabcut/pose_estimation_pytorch/apis/tracking_dataset.py Adds batch-size alias.
deeplabcut/pose_estimation_pytorch/apis/export.py Renames snapshot parameter.
deeplabcut/pose_estimation_pytorch/apis/evaluation.py Normalizes evaluation API.
deeplabcut/pose_estimation_pytorch/apis/analyze_images.py Adds typed config support.
deeplabcut/pose_estimation_3d/triangulation.py Normalizes 3D API parameters.
deeplabcut/pose_estimation_3d/plotting3D.py Normalizes 3D plotting parameters.
deeplabcut/pose_estimation_3d/camera_calibration.py Broadens config annotations.
deeplabcut/gui/tabs/refine_tracklets.py Updates filtering and merging calls.
deeplabcut/gui/tabs/label_frames.py Updates label-check call.
deeplabcut/gui/tabs/extract_outlier_frames.py Updates outlier API calls.
deeplabcut/gui/tabs/extract_frames.py Uses typed config and canonical names.
deeplabcut/gui/tabs/evaluate_network.py Updates evaluation calls.
deeplabcut/gui/tabs/create_videos.py Updates video-creation calls.
deeplabcut/gui/tabs/create_training_dataset.py Updates shuffle naming.
deeplabcut/gui/tabs/analyze_videos.py Updates post-processing calls.
deeplabcut/generate_training_dataset/trainingsetmanipulation.py Normalizes dataset APIs.
deeplabcut/generate_training_dataset/multiple_individuals_trainingsetmanipulation.py Normalizes multi-animal dataset APIs.
deeplabcut/generate_training_dataset/frame_extraction.py Adds typed config handling.
deeplabcut/create_project/modelzoo.py Normalizes pretrained-project parameters.
deeplabcut/create_project/demo_data.py Renames training-set option.
deeplabcut/create_project/add.py Adds typed config handling.
deeplabcut/core/deprecation.py Defines the new deprecation round.
deeplabcut/api/refine_training.py Normalizes refinement facade.
deeplabcut/api/post_processing.py Normalizes post-processing facade.
deeplabcut/api/pose_estimation.py Normalizes pose-estimation facade.
deeplabcut/api/create_project.py Normalizes project-creation facade.
Review details

Suppressed comments (2)

deeplabcut/pose_estimation_3d/triangulation.py:278

  • This second analysis branch has the same TF regression: device is forwarded to tensorflow_compat.analyze_videos, whose signature only accepts gputouse. Since the keyword is supplied even for the default None, TensorFlow-backed triangulation fails on every execution of this branch; translate it in the shared router or conditionally pass the backend-specific keyword.
                        device=device,

deeplabcut/api/pose_estimation.py:939

  • The canonical name does not work on the TensorFlow fallback: the outer router forwards snapshot_index unchanged, while tensorflow_compat.export_model still requires snapshotindex. Thus deeplabcut.export_model(..., snapshot_index=...) fails specifically for TF projects even though the legacy spelling succeeds. Update the TF compatibility signature with its own deprecated alias or add backend-aware translation.
    snapshot_index: int | None = None,
  • Files reviewed: 45/45 changed files
  • Comments generated: 10
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

trainingsetindex: int = 0,
comparison_bodyparts: str | list[str] = "all",
snapshotindex: str | int | None = None,
snapshot_index: str | int | None = None,
destfolder: str | None = None,
ignore_bodyparts: list[str] | None = None,
inferencecfg: dict | None = None,
inference_cfg: dict | None = None,

def calibrate_cameras(
config: str | Path,
config: ProjectConfig | dict | Path | str,


def check_undistortion(config: str | Path, cbrow=8, cbcol=6, plot=True):
def check_undistortion(config: ProjectConfig | dict | Path | str, cbrow=8, cbcol=6, plot=True):
@renamed_parameter(old="videotype", new="video_extensions", deprecation_round=DeprecationRound.PARAMETER_ALIASING_302)
def create_labeled_video_3d(
config: str | Path,
config: ProjectConfig | dict | Path | str,
@renamed_parameter(old="gputouse", new="device", deprecation_round=DeprecationRound.PARAMETER_ALIASING_302)
def triangulate(
config: str | Path,
config: ProjectConfig | dict | Path | str,
filterpredictions=True,
filtertype="median",
gputouse=None,
video_extensions: str | Sequence[str] | None = "",
shuffle=shuffle,
trainingsetindex=trainingsetindex,
gputouse=gputouse,
device=device,
shuffle: int = 1,
trainingsetindex: int = 0,
snapshotindex: int | None = None,
snapshot_index: int | None = None,


def compute_deviations(Dataframe, dataname, p_bound, alpha, ARdegree, MAdegree, storeoutput=None):
def compute_deviations(Dataframe, dataname, p_bound, alpha, ar_degree, ma_degree, storeoutput=None):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.1 backwards compatibility issues concerning prior to current versions enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants