-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Migration to argparse from optparse #5392
Comments
I think To do this I think it makes the most sense to do some initial preparation, namely convert all options to a new class (we could use the one I proposed in #5152) and move them all to |
Even though
|
I like click, but my concern is it adds a new dependency. Also argparse is compatible with confuse which would be very nice to help with consistency between options and configuration file enforced in a simple way. |
In my humble opinion, adding a dependency is not that of a problem. In the end it's all matter of "buy what you won't implement", using a library instead of developing something out of your domain. I think that As to |
I have started work on migration to One of the things that I think we should change (and I'm changing in my proposal) is that options are no longer registered to each individual checker class but to the |
@Pierre-Sassoulas I want to ask for input before committing to this: [tool.pylint]
missing-member-hint = true
[tool.pylint."TYPECHECK"]
missing-member-hint = true
[tool.pylint."I-ORDER-MY-SECTIONS-THE-WAY-I-WANT-TO"]
missing-member-hint = true I do not immediately see what having these sections internally offers to us. |
Only upside would be to have the same option within two checkers with a different value in each checkers ? Imo not an upside and more like a nightmare. Otherwise I don't know. I think we expose our internals checker name to users so it makes it more complex for us to change anything in the checkers and more complex for users to understand what they need to add in the configuration. See #3181, with currentely 37 upvotes from confused configuration writers. One of the top upvoted issues we have. Imo, the only reason it stays this way is the enormous amount of existing config and doc about config in the wild. I agree with you that we should support all three possibilities, maybe not take the sections into account at all. This is the kind of thing a migration tool would fix / clean up / normalize to:
|
I'll go ahead with that implementation then! 😄 |
To give a little status update: Thus, this project should slow down during the second half of this week and mostly continue next week. After making sure we are using Edit: |
With #6278 almost merged we're nearing the process of completion on this particular issue. After that there are still many more issues on the project that should be merged before releasing What's left to do:
|
I'm running into a problem with the migration. Currently we still have Internally we only use the That's why in the post above I talk about replacing However, this requires on change which might be backwards incompatible: removing all calls to methods that depend on As I see it there are two options:
I'd be in favour of option 2 but I would like input from others! |
I think we should rename namespace to config as you said or we'll still be impacted by optparse in 2030. Ideally we would want a solution that do not need to have two branch depending on the pylint version in libraries depending on pylint's code but if it's not possible, well... We could raise an error explaining what needs to be done to lib mainteners instead of simply removing the function, I think it's better than outright getting a no-member without explanation (then we really remove it in 3.0). |
Do you want to go as far as changing |
I think we should at least try to make it work the old function but if it's too much work then a deprecation warning is misleading as it's not a deprecation: it does not work anymore. We'd need to crash instead of silently not doing what the code is supposed to do. But then we need to release 3.0 as we're breaking compatibility... |
With #6319 this will be done. Two last tasks remain for this to be closed and a pre-release to be releasable:
|
I'm going to leave the lower coverage in Updating the TODO above. |
One final TODO list and we're done with this issue:
|
Going to close this as there is nothing left to do here 😄 |
A lot of useful changes came from this project, but I just wonder if @DanielNoord has any insight into the proposal to undeprecate |
Yeah I saw that: they should definitely undeprecate it! I think the main benefit we got out of this that it forced me to redo most of our configuration handling which 1) gave me a lot of insight into the codebase and ideas to improve it and 2) forced us to refactor and standardize some undefined behaviour. I'm glad that they deprecated it as it gave us a reason to have a good look at this code, but as to |
Current problem
optparse
is deprecated since python 3.2 and is not developed anymore. Also, the parsing are handled in a strange way with callback that created stupid bug that could probably be avoided by refactoring the code (#3581) We need to migrate to another CLI parser, the most logical beingargparse
orclick
, butconfuse
is also a possibility because it permits to have default option in a configuration file that could be one of the configuration we already handle and make option / configuration consistent. I'm open to other libraries too.Desired solution
No more optparse used in the code, small and modular handling of CLI argument parsing, no more special case, or minimal.
Additional context
#5152 (comment)
#5259 (comment)
The text was updated successfully, but these errors were encountered: