huggingface_hub: `conflicting_files` of `DiscussionWithDetails` is returned as a bool
Describe the bug
The conflicting_files
parameter of DiscussionWithDetails
object is returned as a bool when I call the get_discussion_details
method. It happens with model oliverguhr/fullstop-punctuation-multilang-large
in discussion number 6. The object (not full) is:
DiscussionWithDetails(title='Add multilingual to the language tag',
status='closed',
num=6, repo_id='oliverguhr/fullstop-punctuation-multilang-large',
repo_type='model',
author='lbourdois',
is_pull_request=True, created_at=datetime.datetime(2023, 1, 7, 17, 4, 9, tzinfo=datetime.timezone.utc),
endpoint='https://huggingface.co'
...
DiscussionStatusChange(id='63fca8e8b907d43a91d8a879',
type='status-change',
created_at=datetime.datetime(2023, 2, 27, 12, 58, 16, tzinfo=datetime.timezone.utc), author='oliverguhr',
_event={'id': '63fca8e8b907d43a91d8a879',
'author': {'avatarUrl': 'https://aeiljuispo.cloudimg.io/v7/https://cdn-uploads.huggingface.co/production/uploads/5ea841a70d1df220780f0433/rpEmnBmuIImkp2yo_pzfO.jpeg?w=200&h=200&f=face',
'fullname': 'Oliver Guhr',
'name': 'oliverguhr',
'type': 'user',
'isPro': False, 'isHf': False, 'isOwner': True, 'isOrgMember': False}, 'createdAt': '2023-02-27T12:58:16.000Z',
'type': 'status-change',
'data': {'status': 'closed'}}, new_status='closed')], conflicting_files=True, target_branch='refs/heads/main',
merge_commit_oid=None, diff=None)
Reproduction
repo_name = ‘oliverguhr/fullstop-punctuation-multilang-large’ details = api.get_discussion_details(repo_id=repo_name, discussion_num=6, repo_type='model, token=ACCESS_TOKEN)
Logs
Exception has occurred: TypeError
'bool' object is not iterable
...
TypeError: 'bool' object is not iterable
System info
- huggingface_hub version: 0.19.2
- Platform: Linux-6.2.16-4-pve-x86_64-with-glibc2.28
- Python version: 3.9.12
- Running in iPython ?: Yes
- iPython shell: ZMQInteractiveShell
- Running in notebook ?: Yes
- Running in Google Colab ?: No
- Token path ?: /root/.cache/huggingface/token
- Has saved token ?: False
- Configured git credential helpers:
- FastAI: N/A
- Tensorflow: N/A
- Torch: N/A
- Jinja2: 3.1.2
- Graphviz: N/A
- Pydot: N/A
- Pillow: N/A
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: N/A
- pydantic: N/A
- aiohttp: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /root/.cache/huggingface/hub
- HF_ASSETS_CACHE: /root/.cache/huggingface/assets
- HF_TOKEN_PATH: /root/.cache/huggingface/token
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 15 (15 by maintainers)
I’d say it’s preferable to open new issues when topics are different. It’s easier for me to keep track of them. Thanks in advance!
Thanks for the PR @ademait! Regarding the issue with building documentation locally, it is because the
hf-doc-builder
package is outdated. I’ve made a PR (https://github.com/huggingface/huggingface_hub/pull/1849) to install the package from source when doingpip install -e ".[docs]"
locally which should fixed the problem. FYI, I have been able to reproduce your error locally as well (and the PR fixed it) so definitely nothing related to your PR changes!Hmm, this is a bit hard to help with. I don’t see a reason why it would break the docs so could you try:
(nit) also about the change itself, it’d be nice to update the type in the docstring to
Thanks again for your help!
@ademait Yes let’s continue the chat on Discord if that’s easier for feedback (my username: wauplinhf). Otherwise I’ll be waiting for the new threads 😨 😄
Cool project!
Interesting! And yes, your feedback on the API in the last days is definitely much appreciated 🙏 🙏
Hi @Wauplin , I agree.
Yes, I’m researcher, and I’m interested in open source, community management among others. We also try to underline the importance of social aspects of open source development. We are currently working on HFCommunity, providing easy and direct access to the Hub so researchers and everyone can leverage on. So that’s way I’m digging into each library method 😄 I try to report everything I see.
Yep, maybe not best but not problematic enough to consider changing the API right now either 🙂 Let’s hope that if we type annotate it in the documentation and code, most issues will be avoided.
Btw, out of curiosity what is your use case for checking conflicting files in PRs? Are you building some projects around the Community Tab?
Yes, I’ll look at it over the next few days!
However, I think that returning a variable that can be either a bool or a list (i.e., not having a specific type) is not a good practice.
Thanks for the report @ademait. I’ve looked into the backend and we indeed have a comment
Meaning that yes, a value
True
is expected in some cases (I didn’t know about that 😄). Would you mind opening a PR to fix the typing and docstring inhuggingface_hub.DiscussionWithDetails
?