Skip to content

Expose public widget composition helpers - #1024

Open
faysou wants to merge 2 commits into
manzt:mainfrom
faysou:feat/public-widget-reference-api
Open

faysou wants to merge 2 commits into
manzt:mainfrom
faysou:feat/public-widget-reference-api

Conversation

@faysou

@faysou faysou commented Sep 13, 2026

Copy link
Copy Markdown

Summary

Downstream widget composition libraries need to recognize both classic AnyWidget instances and protocol-based widgets backed by MimeBundleDescriptor. The implementation already centralizes this behavior in _try_get_model_id, but it is private, so integrations duplicate incomplete checks.

This PR exposes two small public helpers:

  • anywidget.get_model_id(value) returns the composition model ID for classic and protocol widgets.
  • anywidget.is_widget(value) checks whether a value implements the composition protocol.

WidgetTrait and internal reference replacement now use the public resolver, while the private name remains as a compatibility alias. Tests cover protocol objects and plain values.

Validation

  • uv sync --group dev
  • uv run pytest (84 passed)
  • git diff --check

@changeset-bot

changeset-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3ee25f8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

faysou added a commit to faysou/anylumino that referenced this pull request Sep 16, 2026
…idget

- Point the uv source at the pushed fork commit so CI can sync
- Import the composition helpers from released anywidget private
  names until manzt/anywidget#1024 lands, so installed wheels work
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