-
Notifications
You must be signed in to change notification settings - Fork 86
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
Make Env methods self-documenting #186
Comments
Thanks for the kind words
I suppose I opted to prioritize conciseness and ease of maintenance over static analyzability and self-documentation (related issue: #120). That said, I'd be willing to budge if your proposal can be done without too much maintenance overhead. So feel free to send a PR. A rough proof of concept should suffice. |
Env
methods self-documenting
Hey, chipping in since I did quite a lot of research on this in #120 😃
Getting the typings right might not be as easy as you initially think (without making any functional changes to the codebase). #120 describes the problem points quite extensively. Neglecting the Note that distributing inaccurate typings that neglect a certain use case is probably more annoying to users than typing everything as |
starting with 9.0.0 mypy complains about this example:
is there a suggestion for an elegant way to handle types in this case? |
Closing this for now as i don't think there's any immediate action to take. We can always reopen if people want to discuss further |
I would like to preface this issue by saying that I really love this library, and use it a lot in my projects 😀
I personally see great importance in self-documenting code, and a large part of self-documenting code is being able to view
a function's arguments and their types in an IDE when using an API, without looking at its docs.
As this library has no official API reference (which is totally fine!), I think its crucial that the function signatures are clear to the user.
I see 2 choices for achieving this:
.pyi
file. (this means that every change toEnv
's API means a change in the.pyi
file too)Env
's methods so that they have a clear signature that IDEs can parse.I personally think the 1st option is easier, but wanted to know your opinion before submitting a PR.
The text was updated successfully, but these errors were encountered: