-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Added CLI support for Mypy Plugins #18104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
b2997fe
021cb65
79092dd
f57dcde
9ff5c41
9e305da
f4c6068
8c7db13
74da5c6
51ccf23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1008,6 +1008,12 @@ 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( | ||
| "--plugins", | ||
| nargs="*", | ||
|
||
| 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" | ||
| ) | ||
|
|
@@ -1291,6 +1297,10 @@ 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) | ||
dibrinsofor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider matching this with argument's
metavarso that the output ofmypy --helplooks the same.Also,
pluginsis listed beforepdbin the config file documentation, so it may be worth using the same order here for symmetry.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ordering seems to be consistent already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, maybe I'm looking at a different page. The page I'm looking at is this one: https://mypy.readthedocs.io/en/stable/config_file.html#confval-plugins, which has
pluginsbeforepdbUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@brianschubert you're right, shouldn't the ordering from command_line.rst be preserved?