[python] fix compatibility with Python 3.14
argparse.ArgumentParser.__init__ added a new keyword argument color in Python 3.14 ^1. This caused latexminted to break with the following error:
Traceback (most recent call last):
File "/opt/homebrew/bin/latexminted", line 372, in <module>
main()
~~~~^^
File "/opt/homebrew/Cellar/texlive/20250308_1/share/texmf-dist/scripts/minted/latexminted-0.5.0-py3-none-any.whl/latexminted/cmdline.py", line 148, in main
parser.add_command('batch', help='Batch process highlight, styledef, and clean', func=batch)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/texlive/20250308_1/share/texmf-dist/scripts/minted/latexminted-0.5.0-py3-none-any.whl/latexminted/cmdline.py", line 41, in add_command
parser = self._command_subparsers.add_parser(name, help=help)
File "/opt/homebrew/Cellar/[email protected]/3.14.0/Frameworks/Python.framework/Versions/3.14/lib/python3.14/argparse.py", line 1271, in add_parser
parser = self._parser_class(**kwargs)
TypeError: ArgParser.__init__() got an unexpected keyword argument 'color'
system returned with code 256
! Package minted Error: minted v3+ executable is not installed, is not added to
PATH, or is not permitted with restricted shell escape; or MiKTeX is being use
d with -aux-directory or -output-directory without setting a TEXMF_OUTPUT_DIREC
TORY environment variable.
Fix by allowing ArgParser.__init__ to accept unknown keyword arguments and pass them to the superclass.
Fixes https://github.com/gpoore/minted/issues/463.
See also: https://github.com/gpoore/minted/issues/463#issuecomment-3393580569
Added attribution to @muzimuzhi who came up with a similar fix before me.
It seems the convention in this repo is to update version and changelog files along with the fixing. See for example a4439ac.
I'll defer to @gpoore as I can't decide which version number (minor or patch) I should bump.
Confirming, this fix worked for me, thank you very much! Please merge and release a fix version.
Have there been new reviews or findings or can this be merged?
I’ve been manually applying this patch for several weeks and it works well for me.
wow, I wasn't sure that me approving the PR would do anything but it's a straightforward fix, so IMO this looks good. I added a comment for an optional addition.