feat(sdk): public wrappers for updating image metadata (DATAMAN-337) - #511
Merged
Conversation
Add workspace.update_image_metadata / workspace.batch_update_image_metadata and a project.update_image_metadata alias, wrapping the existing rfapi functions so updating metadata on existing images no longer requires importing the internal adapter. Batch supports wait=True via the shared poll_until_terminal helper. Validation stays server-side; errors surface as RoboflowError with the API's message.
CodeQL flags printing response dicts derived from api_key-tainted calls as clear-text logging of sensitive data. Assert on the responses and print static status lines instead.
iurisilvio
approved these changes
Jul 22, 2026
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.
Description
Source: https://roboflow.slack.com/archives/C05HRBELWVB/p1784711279761049
Public SDK wrappers for updating metadata and tags on existing images. DATAMAN-337 shipped the endpoints and the low-level
rfapi.update_image_metadata/batch_update_image_metadatafunctions, and DATAMAN-345 added the CLI — but there was no public Python surface, so roboflow-product-docs PR 389 had to document the internalrfapiadapter directly.Fix: thin delegation wrappers following the existing
Workspace.get_async_taskpattern:workspace.update_image_metadata(image_id, *, metadata=, remove_metadata=, add_tags=, remove_tags=)— sync single imageworkspace.batch_update_image_metadata(updates, *, wait=False, poll_interval=4.0, timeout=1800.0)— async batch (up to 1,000 images);wait=Truepolls via the sharedpoll_until_terminalhelper (same as the CLI's--poll) and returns the final task status including per-imagefailedItemsproject.update_image_metadata(...)— convenience alias passing the project's workspace slug (the endpoint is workspace-scoped; verified against the backend that batch has no project/filter parameters, so batch stays on Workspace)No client-side validation: the server is the source of truth and its errors (invalid tag/key, mutual exclusions, 1,000 cap, duplicate ids) surface as
RoboflowErrorwith the API's own message and hint. Docstrings publish automatically via mkdocstrings.Also adds
tests/manual/demo_image_metadata.py, a self-cleaning manual smoke script for staging.Type of change
How has this change been tested?
ruff+mypycleanget_async_task, batchwait=Truewith a bogus id returningsucceeded: 2, failed: 1with the bogus id infailedItems, server validation errors surfacing asRoboflowError, and CLI regression (roboflow image metadatasingle/batch/error paths) — all green, test data cleaned upWill the change affect Universe?
No
Any specific deployment considerations
None — SDK-only, no new dependencies.
Docs
rfapiimports. CHANGELOG entry included here.