Skip to content

[CLI] migrate hf jobs to out singleton#4254

Merged
hanouticelina merged 13 commits into
mainfrom
cli-migrate-jobs-out-singleton
May 27, 2026
Merged

[CLI] migrate hf jobs to out singleton#4254
hanouticelina merged 13 commits into
mainfrom
cli-migrate-jobs-out-singleton

Conversation

@hanouticelina

@hanouticelina hanouticelina commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Last piece of #3979.
This PR migrates hf jobs to the out framework.

breaking changes introduced in hf jobs ps and hf jobs scheduled ps (I think it's fine, the alternative would be special casing _output.py justfor these two list commands) :

1. --format table is removed. Use --format auto|human|agent|quiet|json.
2. json output shape changed for hf jobs ps:
- command is now a string (e.g. "python script.py"), was a list (e.g.
["python", "script.py"]).
- status is now a string (e.g. "RUNNING"), was a dict (e.g. {"stage": "RUNNING").


Note

Medium Risk
User-visible CLI breaking changes on hf jobs ps and hf jobs scheduled ps (format flags and JSON field shapes); behavior is otherwise presentation-layer only for jobs commands.

Overview
Migrates the hf jobs command group to the shared out CLI output layer (out.result, out.table, out.dict, out.text, out.warning, out.hint) instead of ad-hoc print / json.dumps / print_list_output.

hf jobs ps and hf jobs scheduled ps now use --format auto|human|agent|json|quiet (default auto) with optional Go-style templates ({{.id}}). --format table and -q / --quiet are removed; quiet IDs come from --format quiet. For hf jobs ps, JSON output flattens command to a string and status to a stage string (not a list or nested object). Inspect/labels and lifecycle commands get consistent structured output; docs for the list commands are regenerated to match.

_output.Output.set_mode accepts string mode names (e.g. 'agent') in addition to the enum.

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

Comment thread src/huggingface_hub/cli/_output.py Outdated
Comment thread src/huggingface_hub/cli/jobs.py Outdated
@hanouticelina hanouticelina marked this pull request as ready for review May 22, 2026 17:21
@hanouticelina hanouticelina requested a review from Wauplin May 22, 2026 17:21
@bot-ci-comment

Copy link
Copy Markdown

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.

@hanouticelina hanouticelina changed the title [CLI] migrate hf jobs to `out singleton [CLI] migrate hf jobs to out singleton May 22, 2026

@Wauplin Wauplin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for migrating this! Most comments are related to templating, which I think we should drop for the sake of simplicity

Comment thread src/huggingface_hub/cli/jobs.py Outdated
Comment thread src/huggingface_hub/cli/_output.py Outdated

out.result("Job started", id=job.id, url=job.url)
if detach:
out.hint(f"Use `hf jobs logs {job.id}` to fetch the logs.")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙌

Comment thread src/huggingface_hub/cli/jobs.py
Comment thread src/huggingface_hub/cli/jobs.py
Comment thread src/huggingface_hub/cli/jobs.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using default effort and found 2 potential issues.

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 56dfd66. Configure here.

Comment thread src/huggingface_hub/cli/jobs.py Outdated
Comment thread src/huggingface_hub/cli/jobs.py
Wauplin and others added 2 commits May 26, 2026 16:10
* Update src/huggingface_hub/cli/jobs.py

* Update src/huggingface_hub/cli/jobs.py

* Apply suggestion from @Wauplin

* Apply suggestion from @Wauplin

* Update src/huggingface_hub/cli/jobs.py

* Update src/huggingface_hub/cli/jobs.py

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@Wauplin

Wauplin commented May 26, 2026

Copy link
Copy Markdown
Collaborator

Merged #4265 to use out singleton in labels commands as well (related to #4252 (review))

@hanouticelina hanouticelina requested a review from Wauplin May 26, 2026 14:28
@hanouticelina

Copy link
Copy Markdown
Collaborator Author

@Wauplin thanks for the review! addressed your comments in c12a350

Comment thread src/huggingface_hub/cli/jobs.py Outdated
Comment thread src/huggingface_hub/cli/jobs.py
Comment thread src/huggingface_hub/cli/jobs.py
Comment thread src/huggingface_hub/cli/jobs.py
Comment thread src/huggingface_hub/cli/jobs.py Outdated
Comment thread src/huggingface_hub/cli/jobs.py Outdated
Comment thread src/huggingface_hub/cli/jobs.py Outdated

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pinact found unpinned actions in this repo.

Auto-fixable, but outside this PR's diff (run pinact run locally and commit):

  • .github/workflows/model_card_consistency_reminder.yml:15actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-prerelease.yml:34actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:23- actions/checkout@v6- actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:25actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:57actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:174actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:293- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:348- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:435- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:555- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:690- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:1018actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/style-bot-action.yml:184actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:17actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:20actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:46actions/create-github-app-token@v3actions/create-github-app-token@bcd2ba4921… # v3.2.0
  • .github/workflows/sync-hf-cli-skill.yml:53actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:60astral-sh/setup-uv@v7astral-sh/setup-uv@37802adc94… # v7.6.0
  • .github/workflows/sync-hf-cli-skill.yml:86peter-evans/create-pull-request@v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1
  • .github/workflows/build_repocard_examples.yaml:18actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:37- actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6- actions/setup-node@48b55a011b… # v6.4.0
  • .github/workflows/update-inference-types.yaml:71peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pinact found unpinned actions in this repo.

Auto-fixable, but outside this PR's diff (run pinact run locally and commit):

  • .github/workflows/model_card_consistency_reminder.yml:15actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-prerelease.yml:34actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:23- actions/checkout@v6- actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:25actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:57actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:174actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:293- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:348- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:435- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:555- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:690- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:1018actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/style-bot-action.yml:184actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:17actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:20actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:46actions/create-github-app-token@v3actions/create-github-app-token@bcd2ba4921… # v3.2.0
  • .github/workflows/sync-hf-cli-skill.yml:53actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:60astral-sh/setup-uv@v7astral-sh/setup-uv@37802adc94… # v7.6.0
  • .github/workflows/sync-hf-cli-skill.yml:86peter-evans/create-pull-request@v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1
  • .github/workflows/build_repocard_examples.yaml:18actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:37- actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6- actions/setup-node@48b55a011b… # v6.4.0
  • .github/workflows/update-inference-types.yaml:71peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pinact found unpinned actions in this repo.

Auto-fixable, but outside this PR's diff (run pinact run locally and commit):

  • .github/workflows/model_card_consistency_reminder.yml:15actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-prerelease.yml:34actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:23- actions/checkout@v6- actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/python-quality.yml:25actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:57actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/python-tests.yml:174actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:293- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:348- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:435- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:555- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:690- actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6- actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/release.yml:1018actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/style-bot-action.yml:184actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:17actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:20actions/setup-python@v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/sync-hf-cli-skill.yml:46actions/create-github-app-token@v3actions/create-github-app-token@bcd2ba4921… # v3.2.0
  • .github/workflows/sync-hf-cli-skill.yml:53actions/checkout@v6actions/checkout@de0fac2e45… # v6.0.2
  • .github/workflows/sync-hf-cli-skill.yml:60astral-sh/setup-uv@v7astral-sh/setup-uv@37802adc94… # v7.6.0
  • .github/workflows/sync-hf-cli-skill.yml:86peter-evans/create-pull-request@v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1
  • .github/workflows/build_repocard_examples.yaml:18actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:22actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6actions/setup-python@a309ff8b42… # v6.2.0
  • .github/workflows/update-inference-types.yaml:37- actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6- actions/setup-node@48b55a011b… # v6.4.0
  • .github/workflows/update-inference-types.yaml:71peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8peter-evans/create-pull-request@5f6978faf0… # v8.1.1

@hanouticelina hanouticelina requested a review from Wauplin May 26, 2026 17:35

@Wauplin Wauplin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@hanouticelina hanouticelina merged commit c67501c into main May 27, 2026
24 of 25 checks passed
@hanouticelina hanouticelina deleted the cli-migrate-jobs-out-singleton branch May 27, 2026 08:54
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.17.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants