-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add config key to extend config files #19135
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?
Conversation
mypy/config_parser.py
Outdated
|
||
if "mypy" not in parser: | ||
if filename or os.path.basename(file_read) not in defaults.SHARED_CONFIG_NAMES: | ||
print(f"{file_read}: No [mypy] section in config file", file=stderr) | ||
else: | ||
section = parser["mypy"] | ||
|
||
extend = parser["mypy"].pop("extend", None) |
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.
[info] I thought about adding extend
to the toml
/ini
templates above, but I was not sure of the way they might be used elsewhere, so it felt like doing something ad-hoc would be more suitable here. Happy to change it if there's another preferred way.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Fixes #9620
First and foremost, thanks to everyone that's working on maintaining and extending this project! 🙇 This is my first contribution here, hopefully a useful one.
I have been working in a monorepo project for a while and we have been trying to consolidate some of our configurations. I was coming from doing this with
ruff
, but I couldn't find a way formypy
to combine config files, when I found this comment. Seeing there was already an open discussion for it and a pointer in that direction, I thought I'd give it a go at updating themypy
behaviour.I understand this might require a broader discussion regarding how this config extension/merge should happen, so I know this PR might not be the preferred option. Happy to contribute to the discussion however I can, but I thought it might be good to re-open the discussion with a (potential) solution in this PR.