Support multiple upstreams (make `upstream` a list)

Open
#850 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #861 by @sayakpaul — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, rust

Research direction

Start in kernels/rust/lib.rs and trace Metadata.upstream through the Python binding and _rust.pyi, then inspect docs/source/cli-info.md, the CARD.md templates, and kernel-port. Done means multiple upstream URLs are supported, a single string remains accepted as one item, and CLI and CARD output render every upstream; add the cv-utils attribution separately if needed.

Written by the indexing model from the issue text.

Description

Motivation

Some kernels are put together from more than one upstream repository. For example, the cv-utils kernel appears to combine code from two sources:

Right now upstream in the kernel metadata is a single Option<String> (see kernels/rust/lib.rs, where Metadata.upstream is exposed to Python as Optional[str]). Because of that, we can't properly credit kernels that have more than one upstream. We'll probably have more kernels like this in the future.

Proposal

  • Make upstream a list of URLs.
  • Backwards compatibility: keep accepting a single string and convert it to a one-element list.
  • Update the places that consume the field:
    • Python bindings: Metadata.upstream / _rust.pyi, or add a new accessor if we don't want to break the existing API
    • kernels info CLI output (docs/source/cli-info.md)
    • CARD.md templates (kernel-builder/src/init/templates/CARD.md and examples/kernels/*/CARD.md) so the ## Upstream section renders every upstream
    • kernel-port, if it records upstream info

Short-term

Until this lands, add the attribution for cv-utils to its card by hand.


Requested by Sayak Paul - Slack thread - Agent trace

Dominant language
Python
Stars
781
Forks
141
Avg merge
1d 10h
Merged PRs (30d)
57

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/kernels

All issues in huggingface/kernels

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.