Skip to content

[CLI] Complete hf papers with search, info, read + ls filters#3952

Open
mishig25 wants to merge 7 commits intomainfrom
cli-papers-complete
Open

[CLI] Complete hf papers with search, info, read + ls filters#3952
mishig25 wants to merge 7 commits intomainfrom
cli-papers-complete

Conversation

@mishig25
Copy link
Contributor

@mishig25 mishig25 commented Mar 19, 2026

Summary

Builds on #3723 to add the remaining hf papers commands, covering all functionality described in huggingface/skills#87.

New commands:

  • hf papers search <query> — search papers via /api/papers/search
  • hf papers info <paper_id> — structured JSON metadata via /api/papers/{id}
  • hf papers read <paper_id> — full paper content as markdown via /papers/{id}.md

Extended hf papers ls:

  • --week — filter by ISO week (e.g. 2025-W09)
  • --month — filter by month (e.g. 2025-02)
  • --submitter — filter by submitter username

New HfApi method:

  • paper_read(id) — fetches {endpoint}/papers/{id}.md and returns markdown as a string

Test plan

  • 14 unit tests added to TestPapersCommand in tests/test_cli.py
  • All 14 tests pass
  • ruff check and ruff format clean

🤖 Generated with Claude Code


Note

Medium Risk
Adds new CLI subcommands and a new HfApi.read_paper HTTP call; moderate risk due to new network paths and error handling, but changes are scoped to the papers feature set.

Overview
Extends hf papers beyond daily listing by adding search, info (JSON metadata), and read (markdown content) commands, with consistent table/json/quiet output behavior.

Enhances hf papers ls with additional server-side filters (--week, --month, --submitter) and wires these through to HfApi.list_daily_papers; introduces HfApi.read_paper and exports it at the package level.

Updates CLI docs/reference and adds a dedicated TestPapersCommand suite covering the new commands, options, and 404-to-CLIError handling.

Written by Cursor Bugbot for commit 9819f6c. This will update automatically on new commits. Configure here.

mishig25 and others added 2 commits March 19, 2026 13:36
Builds on #3723 to add the remaining paper commands:
- `hf papers search <query>` — search papers via `/api/papers/search`
- `hf papers info <paper_id>` — structured JSON metadata via `/api/papers/{id}`
- `hf papers read <paper_id>` — full paper content as markdown via `/papers/{id}.md`
- `hf papers ls` gains `--week`, `--month`, `--submitter` options

Adds `HfApi.paper_read()` method and 14 unit tests covering all commands.

Closes #3723. Refs huggingface/skills#87.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@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.

Highlight PR — Description Clarity Suggestion

This PR is a meaningful feature addition that deserves a clear user-facing summary at the top of the description. The current description jumps into implementation-oriented bullet points without first explaining the user-visible impact in prose. Consider replacing the Summary section with something like:


Summary

The hf papers CLI now supports the full spectrum of paper interactions on the Hugging Face Hub. You can search for papers by keyword, retrieve structured JSON metadata for any paper, and read an entire paper as markdown directly in your terminal. The hf papers ls command also gains new server-side filters for week, month, and submitter, making it easier to navigate the daily papers feed. On the Python side, a new HfApi.paper_read() method lets you programmatically fetch any paper's content as markdown.

# Search papers by keyword
hf papers search "vision language"

# Get structured metadata about a paper
hf papers info 2502.08025

# Read a paper as markdown in your terminal
hf papers read 2502.08025

# List papers filtered by week or submitter
hf papers ls --week 2025-W09
hf papers ls --submitter someuser
from huggingface_hub import HfApi
api = HfApi()
content = api.paper_read("2502.08025")

New commands:

  • hf papers search <query> — search papers via /api/papers/search
  • hf papers info <paper_id> — structured JSON metadata via /api/papers/{id}
  • hf papers read <paper_id> — full paper content as markdown via /papers/{id}.md

Extended hf papers ls filters:

  • --week — filter by ISO week (e.g. 2025-W09)
  • --month — filter by month (e.g. 2025-02)
  • --submitter — filter by submitter username

The bullet lists are fine (4+ sub-features), but leading with a prose summary makes the user-visible impact immediately clear.

Open in Web View Automation 

Sent by Cursor Automation: PR Description

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bot-ci-comment
Copy link

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.

Add paper_read to the three required locations in __init__.py
(_SUBMOD_ATTRS, __all__, lazy import block) and add the module-level
alias in hf_api.py, consistent with paper_info, list_papers, and
list_daily_papers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@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.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
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.

Very nice! completing the hf papers CLI will allow us to stop maintaining a separate skill for this (this one I think) and use the hf CLI skill instead, which is always up-to-date



@papers_cli.command(
"read",
Copy link
Contributor

Choose a reason for hiding this comment

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

personal preference for hf papers view here instead of read. view gives us room if we ever want to add the possibility to open the paper in a browser with something like hf papers view 2601.15621 --web. also view might be more discoverable than read?

any preference @julien-c @Wauplin @gary149 ?

Copy link
Member

Choose a reason for hiding this comment

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

i kinda like read better here, but no strong opinion at all!

Copy link
Member

Choose a reason for hiding this comment

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

for me view would actually be more like info

mishig25 and others added 2 commits March 20, 2026 10:47
…ple IDs

- Rename HfApi.paper_read -> HfApi.read_paper to follow {action}_{resource} pattern
- Update public API exports accordingly in __init__.py
- Use real paper IDs (2601.15621) in examples instead of non-existent ones
- Use real submitter username (akhaliq) in examples

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

3 participants