Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,11 @@ in developing or debugging mypy internals.
This flag will invoke the Python debugger when mypy encounters
a fatal error.

.. option:: --extend-plugins, --ep {MODULE|PLUGIN_FILE} ...

This flag acts as a supplementary way to pass (a list of) plugins to customize
Mypy's type checking approach. See :ref:`extending-mypy` for more details.

.. option:: --show-traceback, --tb

If set, this flag will display a full traceback when mypy
Expand Down
13 changes: 13 additions & 0 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,14 @@ def add_invertible_flag(
title="Advanced options", description="Debug and customize mypy internals."
)
internals_group.add_argument("--pdb", action="store_true", help="Invoke pdb on fatal error")
internals_group.add_argument(
"--extend-plugins",
"--ep",
type=lambda s: [item.strip() for item in s.split(",")],
metavar="{MODULE|PLUGIN_FILE}",
dest="special-opts:cli_plugins",
help="Include user defined plugins during Mypy's type analysis",
)
internals_group.add_argument(
"--show-traceback", "--tb", action="store_true", help="Show traceback on fatal error"
)
Expand Down Expand Up @@ -1499,6 +1507,11 @@ def set_strict_flags() -> None:
special_opts = argparse.Namespace()
parser.parse_args(args, SplitNamespace(options, special_opts, "special-opts:"))

# Parse extra plugins passed via cli args
if special_opts.cli_plugins:
options.plugins.extend(special_opts.cli_plugins)
Comment thread
dibrinsofor marked this conversation as resolved.
print(special_opts.cli_plugins)

# The python_version is either the default, which can be overridden via a config file,
# or stored in special_opts and is passed via the command line.
options.python_version = special_opts.python_version or options.python_version
Expand Down
Loading