Repository navigation
feat(LAB-4756)!: remove the asset filters deprecated in 2023 - #2086
Draft
baptiste-olivier wants to merge 5 commits into
Draft
baptiste-olivier wants to merge 5 commits into
baptiste-olivier wants to merge 5 commits into
Conversation
kili.assets() and kili.count_assets() no longer take the _gt/_lt filters nor external_id_contains, and AssetFilter drops the _gt/_lt keys. Passing one raises instead of warning. BREAKING CHANGE: consensus_mark_gt/lt, honeypot_mark_gt/lt, label_consensus_mark_gt/lt, label_created_at_gt/lt and label_honeypot_mark_gt/lt are removed; use their _gte/_lte form, which returns the same assets. external_id_contains is removed; use external_id_strictly_in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ViTPk8L5BgfD1t3GrJDHPe
The export's asset filter took external_id_contains silently; it now warns, and no longer fails when external_id_strictly_in is passed too. Also pins the replacements through assets(), and fixes the export docstring's examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ViTPk8L5BgfD1t3GrJDHPe
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
The external_id_contains deprecation moves to a helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ViTPk8L5BgfD1t3GrJDHPe
…ilters too The export path dropped it from its documented filters in the same 2023 change that deprecated it on kili.assets(), keeping only a silent fallback. It now fails like any unknown filter, in the same major as kili.assets(). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…rs are refused Python, typeguard and the export's unknown-key check already refuse them. The pass-through tests now list the filters themselves. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes LAB-4756.
This PR removes the asset filters deprecated in April 2023 (SDK 2.131 and 2.132) from
kili.assets(),kili.count_assets()and from theAssetFilterused bykili.assets.list()/kili.assets.count(). Passing one of them now raises an error instead of a warning:TypeErroron the legacy client, typeguard'sTypeCheckErroron the domain API.consensus_mark_gt/consensus_mark_ltconsensus_mark_gte/consensus_mark_ltehoneypot_mark_gt/honeypot_mark_lthoneypot_mark_gte/honeypot_mark_ltelabel_consensus_mark_gt/label_consensus_mark_ltlabel_consensus_mark_gte/label_consensus_mark_ltelabel_created_at_gt/label_created_at_ltlabel_created_at_gte/label_created_at_ltelabel_honeypot_mark_gt/label_honeypot_mark_ltlabel_honeypot_mark_gte/label_honeypot_mark_lteexternal_id_contains(inkili.assets()/kili.count_assets())external_id_strictly_inexternal_id_contains(inkili.export_labels(asset_filter_kwargs=…)/kili.exports.*(filter=…))external_id_strictly_inEach replacement returns the same assets as the filter it replaces. The old
_gt/_ltfilters were already sent as_gte/_lte, andexternal_id_containswas already sent asexternal_id_strictly_in.For the releaser
--generate-notescopies only this PR's title into the draft release. Paste the table above into the draft by hand.kili<27would get thisTypeErrorfrom a 26.x release if it still uses these filters. Amajordispatch avoids that; otherwise, state why a minor release is acceptable.What changed
presentation/client/asset.py: the eleven parameters are removed fromassets(both overloads and the implementation) and fromcount_assets. So are their docstring lines, the deprecation warnings and theold or newconversions.domain_api/assets.py: the ten_gt/_ltkeys are removed fromAssetFilter.services/export/tools.py: the export filters drop their silentexternal_id_containsfallback. The export path took it out of its documented filters in the same 2023 change (feat: add external_id_in argument to kili.assets #1190) that deprecated it onkili.assets(), andExportAssetFilternever had it. It now fails like any unknown filter:NameError: Unknown asset filter arguments.consensus_mark_gte, and the export docstring's examples call the realkili.exports.coco/kili.exports.kili.Decided
pre_release.ymlgenerates from PR titles. So the breaking-change flag is the!in this title, plus the table above.Screenshots: none. The observations are command outputs, listed in the Verification below and on the Linear ticket.
Verification
The SDK from this branch's worktree (its venv, Python 3.10), called against a local Kili backend on a project of three assets — two labelled, one not — before the change (
main) and after (sdk_check.py,before.json/after.json).Acceptance: Remove from
kili.assets()andkili.count_assets()(signatures, docstrings, conversion logic):consensus_mark_gt/lt,honeypot_mark_gt/lt,label_consensus_mark_gt/lt,label_created_at_gt/lt,label_honeypot_mark_gt/lt,external_id_contains— observed ✓: onmaineach of the eleven warned and filtered; on the branch each raisesTypeError: … got an unexpected keyword argumenton both methods. The replacements keep their meaning by the code (the old_gt/_ltwere already sent as_gte/_lte) and by the pass-through tests; on the local backend,label_created_at_gte(2) andexternal_id_strictly_in(1) count whatmaincounted — the mark filters cannot tell there, the project having no consensus or honeypot marks.Acceptance: Remove the matching
_gt/_ltkeys fromAssetFilter(kili.assets.list()/kili.assets.count()) — observed ✓: the ten keys are gone;kili.assets.count(filter={"consensus_mark_gt": …})counted with a warning onmainand is refused by typeguard on the branch.Acceptance: Remove the related deprecation warnings — observed ✓: none of the removed filters warns on the branch;
_warn_deprecated_gt_lt_argsand theexternal_id_containswarnings are gone from the assets methods.Acceptance: Update the affected tests — observed ✓: 22 tests pin each remaining filter reaching the gateway's filters from
assetsandcount_assets. Tests that only checked that a removed filter is refused are dropped, the two existing domain tests included: Python, typeguard and the export's unknown-key check already refuse them.Acceptance: Changelog entry flagged as a breaking change, listing each removed filter and its replacement — observed in part: not observed, the release notes themselves, drafted only at release. The PR title carries the
!, whichpre_release.yml's--generate-notescopies into the draft; the table of replacements is in the PR body, with a note to the releaser to paste it into the draft.Export:
fetch_assetsrefusesexternal_id_containswithNameError: Unknown asset filter arguments, alone or together withexternal_id_strictly_in, before any query is sent — the checktest_export_with_asset_filter_kwargs_unknown_argcovers.Tests: the three touched test files — 96 passed; the whole suite as CI runs it — 797 passed, 1 skipped, coverage 75.65 % (floor 75 %).
Gates: pre-commit on the changed files passed;
pylint --rcfile=.pylintrc src/kili— exit 0 (CI's first run caughtR0915onfetch_assets, fixed);pyright src/kili— 0 errors.Red: none of the new tests is red on
main's code — they pin the filters the PR keeps.Docs: the export tutorial and its notebook use
consensus_mark_gte=0.5("of at least 0.5", the result the old filter already gave); the export docstring's examples call the realkili.exports.coco/kili.exports.kiliwithoutput_pathandexternal_id_strictly_in.CI: at
b4c58a2d, 14 of 15 checks green.markdown-link-checkfails as it does onmain:public.roboflow.comanswers 403 in the Vertex AI tutorial, which this PR does not touch.🤖 Generated with Claude Code