Skip to content

Stop using the deprecated argparse.FileType in the CLI - #125

Merged
stefankoegl merged 1 commit into
claude/cli-sigint-exit-statusfrom
claude/cli-drop-filetype
Nov 11, 2026
Merged

stefankoegl merged 1 commit into
claude/cli-sigint-exit-statusfrom
claude/cli-drop-filetype

Conversation

@stefankoegl

Copy link
Copy Markdown
Owner

Stacked on the Ctrl-C exit status PR (claude/cli-sigint-exit-status).

argparse.FileType is deprecated since Python 3.14. The pointer file (-f) and the JSON inputs are now opened with a small open_input() helper that keeps the existing behaviour:

  • - still means stdin, and stdin is never closed.
  • Files are read as UTF-8.
  • A file that can't be opened is a usage error (exit status 2) with the same can't open '…': … message.

The -f file is now opened after argument parsing instead of during it. --help output is unchanged.

All existing tests pass unchanged, including the file-closing and stdin tests. One test was added for a missing -f file. I also checked by hand that -f - and a - input still work.


Generated by Claude Code

argparse.FileType is deprecated since Python 3.14. Open the pointer
file and the JSON inputs with a small helper instead, which keeps the
existing behaviour:

- "-" still means standard input, which is never closed
- files are read as UTF-8
- a file that cannot be opened is a usage error (exit status 2) with
  the same "can't open" message

The pointer file is now opened after argument parsing rather than
during it, so the help output is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01PewzpjhRBV84QNbKy9H564
@stefankoegl
stefankoegl merged commit 90d9737 into claude/cli-sigint-exit-status Nov 11, 2026
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