Skip to content

[Kernels] Minimal kernel repo type support (create/delete, download files, list refs/files/tree)#4068

Merged
Wauplin merged 9 commits intomainfrom
add-kernel-repo-download-support
Apr 9, 2026
Merged

[Kernels] Minimal kernel repo type support (create/delete, download files, list refs/files/tree)#4068
Wauplin merged 9 commits intomainfrom
add-kernel-repo-download-support

Conversation

@drbh
Copy link
Copy Markdown
Contributor

@drbh drbh commented Apr 8, 2026

(PR description by @Wauplin)

This PR adds support for the kernel repo type to:

  • create_repo / delete_repo
  • hf_hub_download
  • snapshot_download
  • list_repo_refs
  • list_repo_files
  • list_repo_tree

It also introduces kernel_info and KernelInfo.

In theory since kernel repo type is "just" an additional repo_type we could just update REPO_TYPES and "it should work out of the box". In practice let's slowly add support when needed and be explicit on what methods are actually supported and tested. I'm pretty sure we'll spot discrepancies in the API along the way.

Note that only a few users/orgs can create kernel repos on the Hub. Meaning it is perfectly ok to make "kernels" a shadow feature in huggingface_hub for now. Most -if not all- of the usage is expected to be happening from the kernels Python package (see https://github.com/huggingface/kernels).

>>> from huggingface_hub import kernel_info
>>> kernel_info("kernels-community/yoso")
KernelInfo(id='kernels-community/yoso', author='kernels-community', downloads=0, gated=False, last_modified=datetime.datetime(2026, 4, 3, 22, 27, 25, tzinfo=datetime.timezone.utc), likes=0, private=False)

Note

Medium Risk
Touches core repo-type validation and download/listing paths, so regressions could affect existing repo types if constants or routing assumptions are wrong, though changes are mostly additive and gated behind repo_type="kernel".

Overview
Adds first-class (but explicitly limited) support for the Hub’s new kernel repository type.

This introduces KernelInfo plus a new kernel_info API call, expands repo-type validation/URL prefixing to include kernel, and enables hf_hub_download/snapshot_download/list_repo_*/create_repo/delete_repo to accept repo_type="kernel" (with snapshot_download falling back to list_repo_tree since kernel repo info does not expose siblings). Documentation is updated to call out the supported surface area, and a new tests/test_kernels.py exercises the end-to-end kernel flows against staging/production endpoints.

Reviewed by Cursor Bugbot for commit ef1dd9a. Bugbot is set up for automated code reviews on this repo. Configure here.

@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented Apr 8, 2026

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.

Comment thread src/huggingface_hub/hf_api.py Outdated
Comment thread src/huggingface_hub/hf_api.py Outdated
@Wauplin Wauplin added the highlight PR will be highlighted in the release notes. label Apr 8, 2026
Comment thread src/huggingface_hub/constants.py
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit addae5e. Configure here.

Comment thread src/huggingface_hub/hf_api.py
Copy link
Copy Markdown
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.

(let's wait for a second approval)

@Wauplin Wauplin changed the title feat: support downloading kernel repos [Kernels] Minimal kernel repo type support (create/delete, download files, list refs/files/tree) Apr 9, 2026
Copy link
Copy Markdown
Contributor

@hanouticelina hanouticelina 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! thank you

@Wauplin Wauplin merged commit 035acb3 into main Apr 9, 2026
13 of 21 checks passed
@Wauplin Wauplin deleted the add-kernel-repo-download-support branch April 9, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

highlight PR will be highlighted in the release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants