-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
mypy.ini parsing trailing comma causes duplicate module error #11171
Comments
can I work on this? |
No objections from me 🙂 |
Just hit this as well. I think the right solution would be to allow trailing commas. It's a bit more obvious with TOML and shouldn't really differ in ini, UX-wise. I haven't checked, but my hunch is that configparser might be reading this entire value as a giant string, like I have confirmed that passing that empty string as another file breaks in exactly the same way: $ MYPY_PATH=src/ mypy --explicit-package-bases myproject/package1 myproject/package2 myproject/module1.py myproject/module2.py '' Additionally, I've found that you can call it with a double empty string: $ MYPY_PATH=src/ mypy --explicit-package-bases '' '' and it would explode the same... Interestingly, a single empty string argument seems fine: $ MYPY_PATH=src/ mypy --explicit-package-bases '' So it seems to me that there are 2 bugs here:
@hauntsaninja could you please change the label from |
It just occurred to me that the config parsing bug may affect other settings that are being interpreted as lists. Perhaps, that's worth checking by whoever gets to work on this. |
Hi!, Can I take this up? |
@hauntsaninja thanks for the labels! Could you assign the issue to me and @x612skm? I'll help him navigate the process. |
@x612skm @webknjaz Feel free to work on this! (we generally don't assign issues) You can check out CONTRIBUTING.md and the Developer Guides for contributing guidelines and tips on where to start. Thanks! |
Just for the fyi - I've started brainstorming into this and soon will be hitting a PR after a discussion with @webknjaz . Thanks! |
@brianschubert I've got some feedback for you. We've found a weakness in the contributing docs. I asked Soubhik to write some tests and since it was a new module, the first idea was to start with something simple, like a test function. It took some time to notice that it wasn't being picked up by pytest. This was when I asked to push the change w/o a fix to the PR (#18472) to make sure it's failing, and it didn't. I was able to find the respective pytest config that disables the default test collection, but I don't believe that a less experienced person would know where to look. Still, it was quite frustrating to troubleshoot. I checked the contrib and other docs — there seems to be no mention of needing to use classes in test modules. So the action item is to document this somewhere, the closer to the section on invoking the tests the better. |
Documentation
I've opted for
documentation
but this could just as well have been a bug report or a feature request. The issue is with a trailing comma after the last file in a list of files inmypy.ini
. e.g.:This results in a duplicate module error as follows:
It appears to somehow read the first element in the list again. Both packages already have
__init__.py
files. The problem is that this error isn't very informative and it took me a while to realise this was the cause.Possible solutions:
mypy==0.910
The text was updated successfully, but these errors were encountered: