[CLI] Complete hf papers with search, info, read + ls filters#3952
[CLI] Complete hf papers with search, info, read + ls filters#3952
hf papers with search, info, read + ls filters#3952Conversation
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>
There was a problem hiding this comment.
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 someuserfrom huggingface_hub import HfApi
api = HfApi()
content = api.paper_read("2502.08025")New commands:
hf papers search <query>— search papers via/api/papers/searchhf 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.
Sent by Cursor Automation: PR Description
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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>
hanouticelina
left a comment
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
There was a problem hiding this comment.
i kinda like read better here, but no strong opinion at all!
There was a problem hiding this comment.
for me view would actually be more like info
…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>



Summary
Builds on #3723 to add the remaining
hf paperscommands, covering all functionality described in huggingface/skills#87.New commands:
hf papers search <query>— search papers via/api/papers/searchhf papers info <paper_id>— structured JSON metadata via/api/papers/{id}hf papers read <paper_id>— full paper content as markdown via/papers/{id}.mdExtended
hf papers ls:--week— filter by ISO week (e.g.2025-W09)--month— filter by month (e.g.2025-02)--submitter— filter by submitter usernameNew
HfApimethod:paper_read(id)— fetches{endpoint}/papers/{id}.mdand returns markdown as a stringTest plan
TestPapersCommandintests/test_cli.pyruff checkandruff formatclean🤖 Generated with Claude Code
Note
Medium Risk
Adds new CLI subcommands and a new
HfApi.read_paperHTTP call; moderate risk due to new network paths and error handling, but changes are scoped to the papers feature set.Overview
Extends
hf papersbeyond daily listing by addingsearch,info(JSON metadata), andread(markdown content) commands, with consistent table/json/quiet output behavior.Enhances
hf papers lswith additional server-side filters (--week,--month,--submitter) and wires these through toHfApi.list_daily_papers; introducesHfApi.read_paperand exports it at the package level.Updates CLI docs/reference and adds a dedicated
TestPapersCommandsuite covering the new commands, options, and 404-to-CLIErrorhandling.Written by Cursor Bugbot for commit 9819f6c. This will update automatically on new commits. Configure here.