-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[question] Check typing of in memory string. #1199
Comments
There's probably nothing easier than creating a |
Ok, I'll continue to poke around when I have some free time then. Are you interested in feedback from this use case, or is it too early ? |
How many lines of code are we talking about here to implement a function
that does what you want? You can crib from the implementation of the "-c"
option in mypy/main.py. (You can even import mypy.main and use functions it
already defines.)
|
I'm not complaining about number of line of code, I'm just feeling the code has not been thought of that use case, and wether I'm missing something. For example I'm just trying to gently inquiring if this use case is something you think is worth considering, and if this kind of feedback (and potentially fix through PR) is welcomed, in which case, when get some time to makes such changes I'll send patches. Or if you do not think it is worth, indeed, I'll wrap that in my own utility to use. |
I don't think you're missing something -- we've been focusing on the use
case of type-checking large programs from the command line. I suggest that
you hold off on a big PR (if you had one in mind), but a small PR that adds
a more direct way of providing the API you're looking for (e.g. a function
that just takes a string and takes care of everything) might be useful.
I suppose you were planning to somehow intercept the error messages too?
|
I somehow don't see a big future for mypy as a library with an API. The internals are moving too fast and the use case is not sufficiently pronounced. Maybe eventually we'll get to it but in the mean time I don't think this issue needs to remain open. |
Hi there,
I would be interested in trying to check snippets of code that are not on a file,
I'm trying to figure out how to do that simply, but constructing
mypy.main.build.BuildSource
with emptypath
and manually settingbin_dir
. But that seem over-engineered.Am I missing something ?
I would prefer not to shell out to the
mypy
executable as in the end the goal would be to integrate in a REPL to get warnings, so most fonction class definition would not have files.Thanks.
The text was updated successfully, but these errors were encountered: