Skip to content

feat(LAB-4756)!: remove the asset filters deprecated in 2023 - #2086

Draft
baptiste-olivier wants to merge 5 commits into
mainfrom
feature/lab-4756-remove-sdk-asset-filters-deprecated-in-2023
Draft

baptiste-olivier wants to merge 5 commits into
mainfrom
feature/lab-4756-remove-sdk-asset-filters-deprecated-in-2023

Conversation

@baptiste-olivier

@baptiste-olivier baptiste-olivier commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

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 the AssetFilter used by kili.assets.list() / kili.assets.count(). Passing one of them now raises an error instead of a warning: TypeError on the legacy client, typeguard's TypeCheckError on the domain API.

⚠️ Breaking change — for the release notes

Removed Use instead
consensus_mark_gt / consensus_mark_lt consensus_mark_gte / consensus_mark_lte
honeypot_mark_gt / honeypot_mark_lt honeypot_mark_gte / honeypot_mark_lte
label_consensus_mark_gt / label_consensus_mark_lt label_consensus_mark_gte / label_consensus_mark_lte
label_created_at_gt / label_created_at_lt label_created_at_gte / label_created_at_lte
label_honeypot_mark_gt / label_honeypot_mark_lt label_honeypot_mark_gte / label_honeypot_mark_lte
external_id_contains (in kili.assets() / kili.count_assets()) external_id_strictly_in
external_id_contains (in kili.export_labels(asset_filter_kwargs=…) / kili.exports.*(filter=…)) external_id_strictly_in

Each replacement returns the same assets as the filter it replaces. The old _gt / _lt filters were already sent as _gte / _lte, and external_id_contains was already sent as external_id_strictly_in.

For the releaser

  • --generate-notes copies only this PR's title into the draft release. Paste the table above into the draft by hand.
  • Release type: the SDK's deprecation rule puts removals in the next major. Code pinned to kili<27 would get this TypeError from a 26.x release if it still uses these filters. A major dispatch avoids that; otherwise, state why a minor release is acceptable.

What changed

  • presentation/client/asset.py: the eleven parameters are removed from assets (both overloads and the implementation) and from count_assets. So are their docstring lines, the deprecation warnings and the old or new conversions.
  • domain_api/assets.py: the ten _gt / _lt keys are removed from AssetFilter.
  • services/export/tools.py: the export filters drop their silent external_id_contains fallback. 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 on kili.assets(), and ExportAssetFilter never had it. It now fails like any unknown filter: NameError: Unknown asset filter arguments.
  • Docs: the export tutorial and its notebook now use consensus_mark_gte, and the export docstring's examples call the real kili.exports.coco / kili.exports.kili.

Decided

  • There is no CHANGELOG file: the changelog is the release notes that pre_release.yml generates from PR titles. So the breaking-change flag is the ! in this title, plus the table above.
  • The error is Python's own "unexpected keyword argument". The ticket takes the parameters out of the signatures, which leaves nowhere to raise a custom message.

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() and kili.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 ✓: on main each of the eleven warned and filtered; on the branch each raises TypeError: … got an unexpected keyword argument on both methods. The replacements keep their meaning by the code (the old _gt/_lt were already sent as _gte/_lte) and by the pass-through tests; on the local backend, label_created_at_gte (2) and external_id_strictly_in (1) count what main counted — the mark filters cannot tell there, the project having no consensus or honeypot marks.

  • Acceptance: Remove the matching _gt/_lt keys from AssetFilter (kili.assets.list() / kili.assets.count()) — observed ✓: the ten keys are gone; kili.assets.count(filter={"consensus_mark_gt": …}) counted with a warning on main and 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_args and the external_id_contains warnings are gone from the assets methods.

  • Acceptance: Update the affected tests — observed ✓: 22 tests pin each remaining filter reaching the gateway's filters from assets and count_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 !, which pre_release.yml's --generate-notes copies 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_assets refuses external_id_contains with NameError: Unknown asset filter arguments, alone or together with external_id_strictly_in, before any query is sent — the check test_export_with_asset_filter_kwargs_unknown_arg covers.

  • 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 caught R0915 on fetch_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 real kili.exports.coco / kili.exports.kili with output_path and external_id_strictly_in.

  • CI: at b4c58a2d, 14 of 15 checks green. markdown-link-check fails as it does on main: public.roboflow.com answers 403 in the Vertex AI tutorial, which this PR does not touch.

🤖 Generated with Claude Code

baptiste-olivier and others added 2 commits September 30, 2026 19:13
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
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

baptiste-olivier and others added 3 commits September 30, 2026 19:36
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

No deployments
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.

1 participant