Discussions and Pull Requests

Interacting with Discussions and Pull Requests

Check the HfApiarrow-up-right documentation page for the reference of methods enabling interaction with Pull Requests and Discussions on the Hub.

Data structures

class huggingface_hub.Discussion

<source>arrow-up-right

( title: strstatus: typing.Literal['open', 'closed', 'merged', 'draft']num: intrepo_id: strrepo_type: strauthor: stris_pull_request: boolcreated_at: datetimeendpoint: str )

Parameters

  • title (str) β€” The title of the Discussion / Pull Request

  • status (str) β€” The status of the Discussion / Pull Request. It must be one of:

    • "open"

    • "closed"

    • "merged" (only for Pull Requests )

    • "draft" (only for Pull Requests )

  • num (int) β€” The number of the Discussion / Pull Request.

  • repo_id (str) β€” The id ("{namespace}/{repo_name}") of the repo on which the Discussion / Pull Request was open.

  • repo_type (str) β€” The type of the repo on which the Discussion / Pull Request was open. Possible values are: "model", "dataset", "space".

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • is_pull_request (bool) β€” Whether or not this is a Pull Request.

  • created_at (datetime) β€” The datetime of creation of the Discussion / Pull Request.

  • endpoint (str) β€” Endpoint of the Hub. Default is https://huggingface.coarrow-up-right.

  • git_reference (str, optional) β€” (property) Git reference to which changes can be pushed if this is a Pull Request, None otherwise.

  • url (str) β€” (property) URL of the discussion on the Hub.

A Discussion or Pull Request on the Hub.

This dataclass is not intended to be instantiated directly.

class huggingface_hub.DiscussionWithDetails

<source>arrow-up-right

( title: strstatus: typing.Literal['open', 'closed', 'merged', 'draft']num: intrepo_id: strrepo_type: strauthor: stris_pull_request: boolcreated_at: datetimeendpoint: strevents: typing.List[ForwardRef('DiscussionEvent')]conflicting_files: typing.Optional[typing.List[str]]target_branch: typing.Optional[str]merge_commit_oid: typing.Optional[str]diff: typing.Optional[str] )

Parameters

  • title (str) β€” The title of the Discussion / Pull Request

  • status (str) β€” The status of the Discussion / Pull Request. It can be one of:

    • "open"

    • "closed"

    • "merged" (only for Pull Requests )

    • "draft" (only for Pull Requests )

  • num (int) β€” The number of the Discussion / Pull Request.

  • repo_id (str) β€” The id ("{namespace}/{repo_name}") of the repo on which the Discussion / Pull Request was open.

  • repo_type (str) β€” The type of the repo on which the Discussion / Pull Request was open. Possible values are: "model", "dataset", "space".

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • is_pull_request (bool) β€” Whether or not this is a Pull Request.

  • created_at (datetime) β€” The datetime of creation of the Discussion / Pull Request.

  • events (list of DiscussionEventarrow-up-right) β€” The list of DiscussionEvents in this Discussion or Pull Request.

  • conflicting_files (list of str, optional) β€” A list of conflicting files if this is a Pull Request. None if self.is_pull_request is False.

  • target_branch (str, optional) β€” The branch into which changes are to be merged if this is a Pull Request . None if self.is_pull_request is False.

  • merge_commit_oid (str, optional) β€” If this is a merged Pull Request , this is set to the OID / SHA of the merge commit, None otherwise.

  • diff (str, optional) β€” The git diff if this is a Pull Request , None otherwise.

  • endpoint (str) β€” Endpoint of the Hub. Default is https://huggingface.coarrow-up-right.

  • git_reference (str, optional) β€” (property) Git reference to which changes can be pushed if this is a Pull Request, None otherwise.

  • url (str) β€” (property) URL of the discussion on the Hub.

Subclass of Discussionarrow-up-right.

class huggingface_hub.DiscussionEvent

<source>arrow-up-right

( id: strtype: strcreated_at: datetimeauthor: str_event: dict )

Parameters

  • id (str) β€” The ID of the event. An hexadecimal string.

  • type (str) β€” The type of the event.

  • created_at (datetime) β€” A datetimearrow-up-right object holding the creation timestamp for the event.

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

An event in a Discussion or Pull Request.

Use concrete classes:

class huggingface_hub.DiscussionComment

<source>arrow-up-right

( id: strtype: strcreated_at: datetimeauthor: str_event: dictcontent: stredited: boolhidden: bool )

Parameters

  • id (str) β€” The ID of the event. An hexadecimal string.

  • type (str) β€” The type of the event.

  • created_at (datetime) β€” A datetimearrow-up-right object holding the creation timestamp for the event.

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • content (str) β€” The raw markdown content of the comment. Mentions, links and images are not rendered.

  • edited (bool) β€” Whether or not this comment has been edited.

  • hidden (bool) β€” Whether or not this comment has been hidden.

A comment in a Discussion / Pull Request.

Subclass of DiscussionEventarrow-up-right.

class huggingface_hub.DiscussionStatusChange

<source>arrow-up-right

( id: strtype: strcreated_at: datetimeauthor: str_event: dictnew_status: str )

Parameters

  • id (str) β€” The ID of the event. An hexadecimal string.

  • type (str) β€” The type of the event.

  • created_at (datetime) β€” A datetimearrow-up-right object holding the creation timestamp for the event.

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • new_status (str) β€” The status of the Discussion / Pull Request after the change. It can be one of:

    • "open"

    • "closed"

    • "merged" (only for Pull Requests )

A change of status in a Discussion / Pull Request.

Subclass of DiscussionEventarrow-up-right.

class huggingface_hub.DiscussionCommit

<source>arrow-up-right

( id: strtype: strcreated_at: datetimeauthor: str_event: dictsummary: stroid: str )

Parameters

  • id (str) β€” The ID of the event. An hexadecimal string.

  • type (str) β€” The type of the event.

  • created_at (datetime) β€” A datetimearrow-up-right object holding the creation timestamp for the event.

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • summary (str) β€” The summary of the commit.

  • oid (str) β€” The OID / SHA of the commit, as a hexadecimal string.

A commit in a Pull Request.

Subclass of DiscussionEventarrow-up-right.

class huggingface_hub.DiscussionTitleChange

<source>arrow-up-right

( id: strtype: strcreated_at: datetimeauthor: str_event: dictold_title: strnew_title: str )

Parameters

  • id (str) β€” The ID of the event. An hexadecimal string.

  • type (str) β€” The type of the event.

  • created_at (datetime) β€” A datetimearrow-up-right object holding the creation timestamp for the event.

  • author (str) β€” The username of the Discussion / Pull Request author. Can be "deleted" if the user has been deleted since.

  • old_title (str) β€” The previous title for the Discussion / Pull Request.

  • new_title (str) β€” The new title.

A rename event in a Discussion / Pull Request.

Subclass of DiscussionEventarrow-up-right.

Last updated