-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
Add a py.typed
file to flake8
#1560
Comments
flake8's only public interface is being phased out and replaced -- it doesn't intend to expose any other part of its api so I'd rather hold off on adding a |
for example, both of these imports reach into implementation details that are not part of flake8's interface (your plugin will be broken): https://github.com/PyCQA/flake8-pyi/blob/02b101b67bb45812b2a4d5697aca1c36d4eb1551/pyi.py#L21-L22 |
Makes sense — thanks for the quick response, and all the work you do to maintain the project! |
@asottile would you be interested in having flake8 natively support linting pyi files? That way, the flake8-pyi plugin wouldn't need to reach into flake8 internals. |
flake8 really only supports python files, pyi is a bit of a different beast. that said -- the incompatibilities aren't with flake8 but with other plugins |
Yes, it's only really the pyflakes checks that cause us difficulties over at flake8-pyi. Would it be worth opening an issue over at pyflakes, do you think? |
there appear to be a few already: https://github.com/PyCQA/pyflakes/issues?q=is%3Aissue+pyi+is%3Aclosed |
What's the actual goal of flake8-pyi? |
@sigmavirus24 it provides linting for stub files, including a number of checks that only make sense in stubs (for example, it warns if a function body is anything other than |
Maybe it's controversial but should that just be pyilint? Or some better band that does this in a lightweight way? This reminds me of folks trying to hack in linting of cython or restructured text or other jupyter notebooks. I guess I'm wondering what's necessary about it being a plugin or what you see as the benefits to you developing it as a plugin and having to reach into things to make it sort of work for a brief period of time |
It took me a while there to realize you were not suggesting to use A completely standalone tool would also be an option, but by building on flake8 we get the benefits of leaning on flake8 for things like error reporting, |
Sorry, it was meant as a tongue in cheek joke |
So, pycodestyle and pyflakes independently do most of what you want from Flake8. I think most of what you'd want our of Flake8 is the noqa support and maybe config handling with CLI parsing on top? I don't know you're getting enough from being a flake8 plugin. Part of me still wants to generalize a bunch of the fundamentals of Flake8 that people want into a library for others but never had enough reason to do so. Given how much of it I wrote, I also wouldn't object to it being forked/copied personally if someone wanted to |
describe the request
Hi! I'm a (relatively new) maintainer of flake8-pyi, a flake8 plugin for linting
.pyi
stub files. Slightly embarrasingly, for a plugin that's so focussed on improving the Python-typing ecosystem, our codebase is not yet fully typed, and I'm trying to improve on that.One issue is that our imports from flake8 require
# type: ignore[import]
comments in order for mypy to be happy with them. However, it looks like flake8 is already fully typed, meaning all that flake8 needs in order to meet the standard outlined in PEP 561 is to add apy.typed
file to the repo. If flake8 adds thepy.typed
file, we can remove the# type: ignore
comments from our imports, and mypy will have a much greater ability to understand what's going on in our code.Would you be receptive to the idea of adding a
py.typed
file to flake8? I'd be happy to submit a PR, if so.The text was updated successfully, but these errors were encountered: