Visitar URL original
apply centralized deprecation version markers in DeprecatedSince · DeepLabCut/DeepLabCut@a029005 · GitHub
Skip to content

Commit a029005

Browse files
committed
apply centralized deprecation version markers in DeprecatedSince
Every @deprecated and @renamed_parameter marker spelled its version inline, so a round of deprecations could only be retargeted by grepping for version strings across the codebase. That is how the 3.1 -> 3.0.1 sweep in #3422 missed analyze_time_lapse_frames, and it makes it easy to move an unrelated API while retargeting one round. DeprecatedSince now holds one constant per round, named after the migration rather than its version so a retargeted round keeps its name, and annotated with the PR that introduced it. All 67 markers reference it.
1 parent dd51be6 commit a029005

32 files changed

Lines changed: 102 additions & 99 deletions

‎deeplabcut/api/create_project.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from collections.abc import Sequence
1818

1919
from deeplabcut.api._tf_routing import with_tensorflow_fallback
20-
from deeplabcut.core.deprecation import renamed_parameter
20+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
2121
from deeplabcut.core.engine import Engine
2222

2323

@@ -26,7 +26,7 @@
2626
tensorflow_module="deeplabcut.tensorflow_compat.create_project",
2727
tensorflow_name="_tf_create_pretrained_project",
2828
)
29-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
29+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
3030
def create_pretrained_project(
3131
project: str,
3232
experimenter: str,

‎deeplabcut/api/modelzoo_inference.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pathlib import Path
1515

1616
from deeplabcut.api._tf_routing import with_tensorflow_fallback
17-
from deeplabcut.core.deprecation import renamed_parameter
17+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
1818
from deeplabcut.utils.auxiliaryfunctions import get_deeplabcut_path
1919

2020
with (get_deeplabcut_path() / "modelzoo" / "models_to_framework.json").open() as _f:
@@ -28,7 +28,7 @@
2828
tensorflow_module="deeplabcut.tensorflow_compat.superanimal_inference",
2929
tensorflow_name="video_inference_superanimal_tf",
3030
)
31-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
31+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
3232
def video_inference_superanimal(
3333
videos: str | list,
3434
superanimal_name: str,

‎deeplabcut/api/pose_estimation.py‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
from deeplabcut.api._tf_routing import with_tensorflow_fallback
31-
from deeplabcut.core.deprecation import deprecated, renamed_parameter
31+
from deeplabcut.core.deprecation import DeprecatedSince, deprecated, renamed_parameter
3232

3333

3434
@with_tensorflow_fallback(
@@ -43,7 +43,7 @@
4343
],
4444
renamed_params={"keepdeconvweights": "load_head_weights"},
4545
)
46-
@renamed_parameter(old="displayiters", new="display_iters", since="3.0.0")
46+
@renamed_parameter(old="displayiters", new="display_iters", since=DeprecatedSince.PARAMETER_CONSISTENCY)
4747
def train_network(
4848
config: ProjectConfig | dict | Path | str,
4949
shuffle: int = 1,
@@ -167,8 +167,8 @@ def return_train_network_path(
167167

168168

169169
@with_tensorflow_fallback(normalize_gputouse=True, dropped_params=["rescale"])
170-
@renamed_parameter(old="Shuffles", new="shuffles", since="3.0.0")
171-
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since="3.0.0")
170+
@renamed_parameter(old="Shuffles", new="shuffles", since=DeprecatedSince.PARAMETER_CONSISTENCY)
171+
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since=DeprecatedSince.PARAMETER_CONSISTENCY)
172172
def evaluate_network(
173173
config: ProjectConfig | dict | Path | str,
174174
shuffles: Iterable[int] = (1,),
@@ -269,8 +269,8 @@ def evaluate_network(
269269

270270

271271
@with_tensorflow_fallback
272-
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since="3.0.0")
273-
@renamed_parameter(old="Snapindex", new="snapshotindex", since="3.0.0")
272+
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since=DeprecatedSince.PARAMETER_CONSISTENCY)
273+
@renamed_parameter(old="Snapindex", new="snapshotindex", since=DeprecatedSince.PARAMETER_CONSISTENCY)
274274
def return_evaluate_network_data(
275275
config: ProjectConfig | dict | Path | str,
276276
shuffle: int = 0,
@@ -295,8 +295,8 @@ def return_evaluate_network_data(
295295
"use_openvino",
296296
],
297297
)
298-
@renamed_parameter(old="batchsize", new="batch_size", since="3.0.0")
299-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
298+
@renamed_parameter(old="batchsize", new="batch_size", since=DeprecatedSince.PARAMETER_CONSISTENCY)
299+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
300300
def analyze_videos(
301301
config: ProjectConfig | dict | Path | str,
302302
videos: str | list[str],
@@ -448,8 +448,8 @@ def analyze_videos(
448448

449449

450450
@with_tensorflow_fallback(normalize_gputouse=True, dropped_params=["TFGPUinference"])
451-
@renamed_parameter(old="batchsize", new="batch_size", since="3.0.0")
452-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
451+
@renamed_parameter(old="batchsize", new="batch_size", since=DeprecatedSince.PARAMETER_CONSISTENCY)
452+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
453453
def create_tracking_dataset(
454454
config: ProjectConfig | dict | Path | str,
455455
videos: list[str] | list[Path],
@@ -600,7 +600,7 @@ def analyze_images(
600600
)
601601

602602

603-
@deprecated(replacement="deeplabcut.analyze_images", since="3.1")
603+
@deprecated(replacement="deeplabcut.analyze_images", since=DeprecatedSince.IMAGE_ANALYSIS_MIGRATION)
604604
@with_tensorflow_fallback(normalize_gputouse=True, dropped_params=["frametype"])
605605
def analyze_time_lapse_frames(
606606
config: ProjectConfig | dict | Path | str,
@@ -638,7 +638,7 @@ def analyze_time_lapse_frames(
638638

639639

640640
@with_tensorflow_fallback(normalize_gputouse=True)
641-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
641+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
642642
def convert_detections2tracklets(
643643
config: ProjectConfig | dict | Path | str,
644644
videos: str | list[str],
@@ -843,7 +843,7 @@ def visualize_paf(
843843

844844

845845
@with_tensorflow_fallback(normalize_gputouse=True, renamed_params={"Indices": "indices"})
846-
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since="3.0.0")
846+
@renamed_parameter(old="comparisonbodyparts", new="comparison_bodyparts", since=DeprecatedSince.PARAMETER_CONSISTENCY)
847847
def extract_save_all_maps(
848848
config: ProjectConfig | dict | Path | str,
849849
shuffle: int = 1,

‎deeplabcut/api/post_processing.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from collections.abc import Sequence
1616
from pathlib import Path
1717

18-
from deeplabcut.core.deprecation import renamed_parameter
18+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
1919

2020

21-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
21+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
2222
def analyzeskeleton(
2323
config: str | Path,
2424
videos: list[str | Path],
@@ -100,7 +100,7 @@ def analyzeskeleton(
100100
)
101101

102102

103-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
103+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
104104
def filterpredictions(
105105
config: str | Path,
106106
video: str | Path,

‎deeplabcut/api/refine_training.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from collections.abc import Sequence
1616
from pathlib import Path
1717

18-
from deeplabcut.core.deprecation import renamed_parameter
18+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
1919

2020

2121
def find_outliers_in_raw_data(
@@ -66,7 +66,7 @@ def find_outliers_in_raw_data(
6666
)
6767

6868

69-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
69+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
7070
def extract_outlier_frames(
7171
config: str | Path,
7272
videos: list[str | Path],
@@ -288,7 +288,7 @@ def merge_datasets(config: str | Path, forceiterate=None):
288288
return _merge_datasets(config=config, forceiterate=forceiterate)
289289

290290

291-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
291+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
292292
def stitch_tracklets(
293293
config_path: str | Path,
294294
videos: list[str | Path],

‎deeplabcut/core/config/utils.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from pydantic import ValidationError
2929
from ruamel.yaml import YAML
3030

31-
from deeplabcut.core.deprecation import deprecated
31+
from deeplabcut.core.deprecation import DeprecatedSince, deprecated
3232

3333
logger = logging.getLogger(__name__)
3434

@@ -238,7 +238,7 @@ def wrapper(*args, **kwargs):
238238
# -----------------------------------------------------------------------------
239239

240240

241-
@deprecated(replacement="deeplabcut.core.config.ProjectConfig", since="3.0.1")
241+
@deprecated(replacement="deeplabcut.core.config.ProjectConfig", since=DeprecatedSince.CONFIG_MODEL_MIGRATION)
242242
def create_config_template(multianimal: bool = False) -> tuple:
243243
"""
244244
Creates a template for config.yaml file. This specific order is preserved while saving as yaml file.

‎deeplabcut/create_project/modelzoo.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import deeplabcut
2424
from deeplabcut.core.config import ProjectConfig
25-
from deeplabcut.core.deprecation import deprecated, renamed_parameter
25+
from deeplabcut.core.deprecation import DeprecatedSince, deprecated, renamed_parameter
2626
from deeplabcut.core.engine import Engine
2727
from deeplabcut.generate_training_dataset.metadata import (
2828
DataSplit,
@@ -44,8 +44,11 @@
4444
Modeloptions = MODELOPTIONS
4545

4646

47-
@deprecated(replacement="deeplabcut.create_pretrained_project(..., model='full_human')", since="3.0.0")
48-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
47+
@deprecated(
48+
replacement="deeplabcut.create_pretrained_project(..., model='full_human')",
49+
since=DeprecatedSince.PRETRAINED_PROJECT_MIGRATION,
50+
)
51+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
4952
def create_pretrained_human_project(
5053
project,
5154
experimenter,
@@ -74,7 +77,7 @@ def create_pretrained_human_project(
7477
)
7578

7679

77-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
80+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
7881
def create_pretrained_project(
7982
project: str,
8083
experimenter: str,

‎deeplabcut/create_project/new.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
from typing import Literal
1919

2020
from deeplabcut import DEBUG
21-
from deeplabcut.core.deprecation import renamed_parameter
21+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
2222
from deeplabcut.core.engine import Engine
2323
from deeplabcut.utils.auxfun_videos import VideoReader, collect_video_paths
2424

2525

26-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
26+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
2727
def create_new_project(
2828
project: str,
2929
experimenter: str,

‎deeplabcut/modelzoo/video_inference.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import torch
2020

21-
from deeplabcut.core.deprecation import deprecated, renamed_parameter
21+
from deeplabcut.core.deprecation import DeprecatedSince, deprecated, renamed_parameter
2222
from deeplabcut.modelzoo.utils import get_super_animal_scorer
2323
from deeplabcut.pose_estimation_pytorch.config import PoseConfig
2424
from deeplabcut.pose_estimation_pytorch.modelzoo.train_from_coco import adaptation_train
@@ -50,7 +50,7 @@ def get_checkpoint_epoch(checkpoint_path):
5050
return 0
5151

5252

53-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
53+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
5454
def _video_inference_superanimal_pytorch(
5555
videos: str | list,
5656
superanimal_name: str,

‎deeplabcut/pose_estimation_pytorch/apis/tracking_dataset.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import deeplabcut.pose_estimation_pytorch.runners as runners
2323
import deeplabcut.pose_estimation_pytorch.runners.shelving as shelving
2424
from deeplabcut.core.config import read_config_as_dict
25-
from deeplabcut.core.deprecation import renamed_parameter
25+
from deeplabcut.core.deprecation import DeprecatedSince, renamed_parameter
2626
from deeplabcut.pose_estimation_pytorch.apis.videos import VideoIterator
2727
from deeplabcut.pose_estimation_pytorch.task import Task
2828
from deeplabcut.pose_tracking_pytorch import create_triplets_dataset
@@ -128,7 +128,7 @@ def extract_features_for_video(
128128
shelf_writer.close()
129129

130130

131-
@renamed_parameter(old="videotype", new="video_extensions", since="3.0.0")
131+
@renamed_parameter(old="videotype", new="video_extensions", since=DeprecatedSince.PARAMETER_CONSISTENCY)
132132
def create_tracking_dataset(
133133
config: str | Path,
134134
videos: list[str] | list[Path],

0 commit comments

Comments
 (0)