Community Tab
Last updated
Last updated
The boincai_hub
library provides a Python interface to interact with Pull Requests and Discussions on the Hub. Visit for a deeper view of what Discussions and Pull Requests on the Hub are, and how they work under the hood.
The HfApi
class allows you to retrieve Discussions and Pull Requests on a given repo:
Copied
HfApi.get_repo_discussions
returns a that yields objects. To get all the Discussions in a single list, run:
Copied
Copied
In case of a Pull Request, you can retrieve the raw git diff with DiscussionWithDetails.diff
. All the commits of the Pull Request are listed in DiscussionWithDetails.events
.
Copied
Copied
Coming soon !
The object returned by contains high-level overview of the Discussion or Pull Request. You can also get more detailed information using :
returns a object, which is a subclass of with more detailed information about the Discussion or Pull Request. Information includes all the comments, status changes, and renames of the Discussion via DiscussionWithDetails.events
.
The class also offers ways to create and edit Discussions and Pull Requests. You will need an to create and edit Discussions or Pull Requests.
The simplest way to propose changes on a repo on the Hub is via the API: just set the create_pr
parameter to True
. This parameter is also available on other methods that wrap :
You can also use (respectively ) to create a Discussion (respectively a Pull Request) on a repo. Opening a Pull Request this way can be useful if you need to work on changes locally. Pull Requests opened this way will be in "draft"
mode.
Managing Pull Requests and Discussions can be done entirely with the class. For example:
to add comments
to edit comments
to rename a Discussion or Pull Request
to open or close a Discussion / Pull Request
to merge a Pull Request
Visit the documentation page for an exhaustive reference of all available methods.
For a more detailed reference, visit the and the documentation page.