-
Notifications
You must be signed in to change notification settings - Fork 174
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
Remove dependency to setoptconf #681
base: master
Are you sure you want to change the base?
Conversation
3651581
to
cbb558e
Compare
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.
Removing deps is always nice.
Not sure if adding pydantic to the deps tree is advisable as we already have a lot of dependencies to consider (and there's also the user depencency in prod) but ultimately you choose :)
69f0834
to
cf82c0a
Compare
Pydentic is a very popular library to add types on configuration, it's true that it can interfere with user dependency, I will use a wider version range to avoid that, If you are against that, I can also use TypedDict, but this will not check the input this is only for type checking. |
ddcc442
to
d495b9d
Compare
Currently, this is not working, but what do you think about using pydentic for data validation, if we use it, I plane to also use it to validate the profiles. @carlio ? |
614c09d
to
e56465c
Compare
3dc8e4b
to
b8a5bf1
Compare
@sbrunner I just discovered tyro and minterface which might help replacing setoptconf. Just ideas for you. Also clipstick and others linked from the tyro README |
b8a5bf1
to
5fea080
Compare
With clipstick I didn't succeed to create command like |
5fea080
to
fef672f
Compare
With tyro I will get help like that
This is nice, but the boolean and list are not threaded as expected :-/ |
Shouldn't I continue to improve the couple Pydentic + argparse? |
df8356e
to
19a7460
Compare
aa63d6e
to
95538e0
Compare
Use whichever works best, I don't mind :) I just saw those and thought they might help, but I guess not. |
Tyro uses pydantic anyway though you might be able to patch the help formatter if that's the only concern |
95538e0
to
4481479
Compare
The issue with tyro is not the help it that he expected that we use, e.g.: |
4481479
to
2977c81
Compare
For me, the current solution is the best I tested :-) |
Do You think that I can merge this pull request, from now I don't see any better solution |
I've been thinking about this a lot and I think that adding Pydantic would be a bad idea. Prospector is installed on top of existing environments and has to be careful to make sure that any dependencies of prospector have a wide range so that it can be compatible with whatever constraints users have. This adds lots of legacy code and compatability code. Adding more stuff to prospector, especially something as popular as pydantic, will add more surface area for version conflicts for users. That leads to bug reports and so on and so on. setoptconf is really good at what it does. The desire to remove it was because it's not maintained. However, similarly to the poetry-semver use in requirements-detector, attempts to replace it with other things were a pain and actually, vendoring it was a good solution. Therefore I'd suggest that instead of rewriting or replacing setoptconf, instead, simply copying the code from the temporary replacement into the main prospector repository/package. It works already. Trying to replace it might mean breaking changes. @Pierre-Sassoulas @sbrunner what do you think? I find it to be an easy and practical solution which would minimise conflicts for users. |
I agree, this is especially important for a linter that need to be installed alongside the code depencencies (because of pylint that always will). Vendoring seems reasonable but I would look at reducing deps to the bare minimum too. (The dependency lock with pylint-django / requirements-detector / pylint / prospector was complicated to navigate for python 3.12 support). |
For me, the problem of the current code is that he isn't typed, it's the real more value of adding Pydentic.
I understand this, and it's a relay important point, but I think It will not be difficult to support a wide range of Pydentic versions. But if you are not convinced, we can keep it like it and not be typed. |
I've removed the ability for brand new accounts or non-contributors to review changes as the @Bjackson4837 account appears to be a bot - recently joined, no other contributions except reviewing this PR 3 times |
@sbrunner The headache of having Django as a dependency of pylint-django or not makes me want to avoid adding extra things to prospector. It just leads to massive amounts of discussion and issues. I don't think the value added from typing will make up from the hassle that would come from maintaining the fallout and issues raised by conflicting with user's own environments. |
It's possible to have typing without pydantic, and pylint already depends on typing_extensions so we can have "fancy" typing even if we must support python 3.9 still. (I never used pydantic, so I don't know, maybe it's so much better that it would be worth the trouble) |
@carlio OK, I understand that you don't want to renew a bad experience! @Pierre-Sassoulas I don't understand what you have in mind? For some other projects, I created two projects
to be able from a JSON schema to generate types and docs by using pre-commit.
Do you think that's a good solution to typed and validate the profile? For the config we can try to use a typed dict be at first look it don't look to be evident. |
I was thinking about typed dict yes. Not sure if I have the whole context though. |
Description
Prototype to remove setuptconf, do you like it, should I go ahead with that?
Related Issue
fix #442