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

make repocard content a property #1147

Merged
merged 3 commits into from
Nov 3, 2022
Merged

make repocard content a property #1147

merged 3 commits into from
Nov 3, 2022

Conversation

nateraw
Copy link
Contributor

@nateraw nateraw commented Nov 2, 2022

Resolves #1144 by turning RepoCard.content into a property with an accompanying setter fn. The setter handles setting .data and .text attributes accordingly.

This way, when you update the card text or data, the card's content will be updated as well. As an added bonus, if you update card.content, it will update the card data and text as well.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Nov 2, 2022

The documentation is not available anymore as the PR was closed or merged.

@nateraw nateraw marked this pull request as ready for review November 2, 2022 23:26
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks for fixing this @nateraw !
I left a comment for a attribute that I think could be removed, otherwise PR's good for me :)

EDIT: CI is broken so don't worry about the 2 failing tests. They are unrelated to this PR anyway. I'll make the CI skip them.

src/huggingface_hub/repocard.py Show resolved Hide resolved
Copy link
Member

@osanseviero osanseviero left a comment

Choose a reason for hiding this comment

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

Nice! 🔥

@codecov
Copy link

codecov bot commented Nov 3, 2022

Codecov Report

Base: 84.61% // Head: 84.64% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (cf9f658) compared to base (a02f2b9).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1147      +/-   ##
==========================================
+ Coverage   84.61%   84.64%   +0.02%     
==========================================
  Files          41       41              
  Lines        4096     4102       +6     
==========================================
+ Hits         3466     3472       +6     
  Misses        630      630              
Impacted Files Coverage Δ
src/huggingface_hub/repocard.py 93.98% <100.00%> (+0.20%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nateraw
Copy link
Contributor Author

nateraw commented Nov 3, 2022

btw @Wauplin I noticed another unrelated issue with test suite while working on this PR...will open issue + PR fixing it.

@nateraw nateraw merged commit cf56bf3 into main Nov 3, 2022
@nateraw nateraw deleted the repocard-content-update branch November 3, 2022 17:53
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.

Make it easier to modify the model card content
4 participants