Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(weave): Make ref-getting more pleasant #3362

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

andrewtruong
Copy link
Collaborator

@andrewtruong andrewtruong commented Jan 10, 2025

This PR:

  1. Adds a mechanism, @objectify.register, to register objects that can be converted from WeaveObject into their base python classes. This can be used both internally and by end-users.
  2. Adds a new classmethod from_uri to registered objects
  3. Improves ref(...).get() to return the actual python class instead of WeaveObject for registered objects

Now you can do:

ds = Dataset(rows=[...])
ref = weave.publish(ds)

ds2 = ref.get()  # returns a `Dataset` instead of `WeaveObject`
ds3 = Dataset.from_uri(ref.uri())  # returns a `Dataset`

@andrewtruong andrewtruong changed the title Make ref-get return actual object instead of WeaveObject where possible feat(weave): Make ref-get return actual object instead of WeaveObject where possible Jan 10, 2025
@circle-job-mirror
Copy link

circle-job-mirror bot commented Jan 10, 2025

@andrewtruong andrewtruong changed the title feat(weave): Make ref-get return actual object instead of WeaveObject where possible feat(weave): Make ref-getting more pleasant Jan 10, 2025
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