Files
Jirka Borovec 207a0bb87f refine(datasets): schedule aug_config removal (#1398)
- Gave the rfdetr.datasets.aug_config compatibility shim a concrete deadline. Its FutureWarning said only "will be removed in a future release"; it now reads "deprecated since v1.9.0 and will be removed in v1.12.0". The shim itself keeps working unchanged until then, re-exporting AUG_CONFIG, AUG_CONSERVATIVE, AUG_AGGRESSIVE, AUG_AERIAL and AUG_INDUSTRIAL from aug_configs.
- Documented the deprecation, which had shipped without any record of it. The module was renamed in 1.8.0 as a documented breaking change with no shim; the singular path reappeared in 1.9.0 with a warning but no CHANGELOG entry, no migration-guide section and no removal target. Added a CHANGELOG "Deprecated" entry under Unreleased and a "Deprecated in v1.9 -> Remove in v1.12" section under "Upgrade 1.8 -> 1.9" in docs/getting-started/migration.md, dated to the release the warning started firing in. The 1.7 -> 1.8 breaking-change block is left alone: that rename genuinely shipped shim-less.
- Explained in the module docstring why this uses warnings.warn rather than the project's usual pyDeprecate: pyDeprecate exposes function, class and instance decorators only, and none of them fire on a bare module import.
- Added tests/datasets/test_aug_config_shim.py, covering a path that had none. It asserts the warning fires, names v1.12.0, and points at the replacement module; that all five presets are identity-equal to their aug_configs originals rather than copies; and that __all__ lists every one of them so star imports keep working. Its fixture evicts the module from sys.modules first, because a module-level warning fires once per process and would otherwise be unobservable depending on collection order. Matching the version in the regex means moving the deadline in the docs without moving it in the code fails here.
- Consolidated AugmentationBackend._is_albu_available, _is_kornia_available and _is_tv_available into one _is_available method driven by a new _AUGMENTATION_BACKEND_PROBE_MODULES table keyed on the backend value, so the GPU alias for KORNIA needs no special case. TV has no table entry and reports available unconditionally, matching torchvision being a hard dependency. Probing stays inside from_str rather than moving to module-level constants, so importing rfdetr still never pulls in Albumentations or Kornia.
- Dropped _is_tv_available outright rather than folding it in: it had no callers anywhere in src or tests.
- Moved functools.lru_cache from the two per-backend classmethods onto _package_importable, caching by dotted module name instead of by method. Carried the caching and patching warning into the _is_available docstring, retargeted to say tests must patch _is_available itself and never _package_importable, since a real probe result now persists process-wide.
- Updated the six call sites in config.py, datasets/kornia_transforms.py and training/module_data.py to the member form, and rewrote the twelve patch sites across tests/datasets/test_coco.py, tests/datasets/test_kornia_transforms.py and tests/training/test_module_data.py to patch _is_available with a plain function so it binds and receives the member, preserving each site's per-backend intent that a single return_value could not express.

---------

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Codex <codex@openai.com>
2026-08-24 09:11:35 +02:00
..