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

List organizations in get_user_overview #2404

Merged
merged 4 commits into from
Jul 19, 2024

Conversation

Wauplin
Copy link
Contributor

@Wauplin Wauplin commented Jul 19, 2024

Follow-up PR after server-side update (https://github.com/huggingface-internal/moon-landing/pull/10607, private link). See also discussion in slack (private link).

This PR handles orgs in get_user_overview. It is an Organization dataclass (newly defined) with avatar_url, name and fullname.

>>> from huggingface_hub import get_user_overview
>>> omar = get_user_overview("osanseviero")
>>> omar.orgs[0]
Organization(avatar_url='https://cdn-avatars.huggingface.co/v1/production/uploads/1583856921041-5dd96eb166059660ed1ee413.png', name='huggingface', fullname='Hugging Face')

I also realized we forgot to expose get_user_overview at the root of the package. This PR fixed this. Also exposing ModelInfo, DatasetInfo and SpaceInfo that I wanted to add since quite some time.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

self.user_type = kwargs.pop("type", None)
self.is_following = kwargs.pop("isFollowing", None)
self.details = kwargs.pop("details", None)
self.orgs = [Organization(**org) for org in kwargs.pop("orgs", [])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add to User class docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in fe04844

@Wauplin
Copy link
Contributor Author

Wauplin commented Jul 19, 2024

Thanks for the quick review :)

@Wauplin Wauplin merged commit ac400fe into main Jul 19, 2024
16 checks passed
@Wauplin Wauplin deleted the list-organizations-in-user-overview branch July 19, 2024 13:57
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.

4 participants