Skip to content

DOC: Fix outdated CLI help in the docs and the Read the Docs build - #306

Merged
MartinThoma merged 3 commits into
mainfrom
docs/fix-help-texts
Nov 15, 2026
Merged

MartinThoma merged 3 commits into
mainfrom
docs/fix-help-texts

Conversation

@MartinThoma

@MartinThoma MartinThoma commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

This PR fixes documentation-related issues.

1. Fix the help texts of 2-up and uncompress (#289)

Both commands use their module docstring as --help text. Those docstrings described the Python module, not the command:

  • 2-up printed usage: python 2-up.py input_file output_file, left over from when it was a standalone script. It also called its output "booklet-style", which is confusing next to booklet.
  • uncompress said "Module for uncompressing PDF content streams."

The new docstrings say what each command does and give an example. The uncompress text says that only page content streams are uncompressed, not fonts or images.

Closes #289

2. Fix the PDF build on Read the Docs

The docs have not been built on Read the Docs since 2026-02-02. The myst_parser error was already fixed in ec0fb22. A second error was hidden behind it: formats: all also builds a PDF, and pdflatex fails on the box-drawing characters of the --help output and on the SVG badges. Read the Docs fails the whole build when the PDF fails.

  • Build the PDF with XeLaTeX (latex_engine = "xelatex")
  • Show the badges and the star history chart only in the HTML output

I built HTML, EPUB and PDF locally with the same commands as Read the Docs, and all three succeed.

3. Check the documented CLI help in CI and pre-commit

The --help output in the docs was copied by hand. 10 of the 16 blocks no longer matched the CLI. For example, extract-images did not show --output-dir or page ranges.

docs/check_cli_help.py runs every documented pdfly ... --help command and compares the output with the docs. It runs in the CI docs job and as a pre-commit hook. To update the docs after changing a command:

uv run --frozen python docs/check_cli_help.py --fix

The output depends on the typer and rich versions, so CI and the hook both run with uv run --frozen, which uses the versions in uv.lock. As a result:

  • Contributors need uv installed for the pre-commit hook.
  • If a Renovate update to typer or rich changes the help output, CI fails on that Renovate PR. Running the --fix command on that branch fixes it.

After merging

Read the Docs has turned off automatic builds after the repeated failures. I need to start a build by hand from the Read the Docs dashboard.

MartinThoma and others added 3 commits November 15, 2026 12:48
The help of both commands was the module docstring, which still described
the Python module instead of the command:

* 2-up showed "usage: python 2-up.py input_file output_file" from the
  time it was a standalone script, and called its output "booklet-style",
  which is confusing next to the booklet command.
* uncompress said "Module for uncompressing PDF content streams."

The docstrings now describe what the commands do, and give an example.
The help shown in the README and the docs is regenerated from the CLI.

Closes #289

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Read the Docs builds all formats, including the PDF, and fails the whole
build if the PDF cannot be built. pdflatex fails on the box-drawing
characters of the `--help` output and on the SVG badges.

* Build the PDF with XeLaTeX, which can render the box-drawing characters
* Show the badges and the star history only in the HTML output

The docs have not been built on Read the Docs since 2026-02-02. The
missing myst_parser was fixed by installing the docs dependency group in
ec0fb22, which was not built on Read the Docs yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `pdfly ... --help` output shown in the README and the docs was
written by hand and got outdated: 10 of the 16 blocks did not match the
CLI, e.g. extract-images did not show --output-dir and the page ranges.

docs/check_cli_help.py runs every documented `pdfly ... --help` command
and compares the output with the docs. With --fix, it updates them.

The output depends on the typer and rich versions, so CI and the
pre-commit hook run it with `uv run --frozen` to use those of uv.lock.

The outdated blocks are updated, and the description of extract-images
no longer says that it extracts text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@MartinThoma
MartinThoma merged commit 23f83e3 into main Nov 15, 2026
26 checks passed
@MartinThoma
MartinThoma deleted the docs/fix-help-texts branch November 15, 2026 11:54
@MartinThoma MartinThoma mentioned this pull request Nov 15, 2026
MartinThoma added a commit that referenced this pull request Nov 15, 2026
## What's new

### New Features (ENH)
- Show the permissions of encrypted PDFs in meta (#310, #311) by @MartinThoma
- Add --output-dir option to extract-images (#300) by @dbdefault

### Bug Fixes (BUG)
- Keep the order of the input pages in x2pdf (#307) by @MartinThoma

### Documentation (DOC)
- Check the help of all commands in the docs (#309) by @MartinThoma
- Add diagrams for 2-up, booklet, cat, rm and rotate (#308) by @MartinThoma
- Fix outdated CLI help in the docs and the Read the Docs build (#306) by @MartinThoma

### Developer Experience (DEV)
- Keep minimum Python in CI and widen uv_build range in Renovate (#303) by @MartinThoma
- Rework release process and switch build backend to uv_build (#301) by @MartinThoma

### Maintenance (MAINT)
- Update softprops/action-gh-release digest to 8a0cd65 (#286) by @renovate[bot]
- Update dependency uv_build to >=0.13.8,<0.14 (#302) by @renovate[bot]

[Full Changelog](0.6.0...0.7.0)
ijazabdullah127 added a commit to ijazabdullah127/pdfly that referenced this pull request Nov 15, 2026
Merge main and keep the command descriptions introduced in py-pdf#306.
Update the regression assertions to match those descriptions and record
the test coverage under Unreleased instead of claiming another fix.

Related to py-pdf#289.

Co-authored-by: Codex <[email protected]>
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-up and uncompress --help show leftover module text instead of a command description

1 participant