Skip to content

Fix file-variable CLI flag and header ID setup - #723

Open
ryanchou1994 wants to merge 1 commit into
trentm:masterfrom
ryanchou1994:fix/use-file-vars-flag
Open

Fix file-variable CLI flag and header ID setup#723
ryanchou1994 wants to merge 1 commit into
trentm:masterfrom
ryanchou1994:fix/use-file-vars-flag

Conversation

@ryanchou1994

Copy link
Copy Markdown

--use-file-vars now works as a flag. Previously argparse expected a value, so placing it before an input filename consumed the filename; using it with stdin or after a filename failed with a missing-argument error.

This also fixes a crash when an Emacs-style file variable enables header-ids. Those options are loaded after construction, so they need the same normalization as constructor extras before heading rendering. The shared helper preserves initialization behavior and existing reset-count settings.

Related to #365 and #269. This addresses the CLI flag and header-id file variables, rather than every file-variable extra. The README includes a working command and modeline example.

Compatibility: the flag no longer accepts a value. A token after --use-file-vars is an input path; --use-file-vars=VALUE is rejected.

Validation:

  • Regression tests failed on the base: five CLI failures and one API error, with the no-flag control passing.
  • Mac Python 3.13.13: make testone passed 275 tests; the seven existing ReDoS regressions passed.
  • Linux Python 3.13.15: the same 275 functional tests, seven existing ReDoS tests, internal doctests, and 12 installed-wheel API/CLI checks passed. All 887 source file hashes matched before and after validation.
  • New CLI tests pass pycodestyle. The two existing changed Python files retain the same 475 pre-existing pycodestyle diagnostics, with none added.
  • Wheel and source distributions build; Twine passes with the existing missing long_description_content_type warning.

Copilot AI lite review requested due to automatic review settings September 9, 2026 05:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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