-
Notifications
You must be signed in to change notification settings - Fork 989
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
Provide pylint plugin to avoid warnings in IDE when working with conanfile.py #2706
Comments
Yes, this is a good idea, thanks! We will check this when we do that, and will try to make this plugin reusable, not only for conan, but for editors too. |
I've created a prototype of pylint plugin: ytimenkov/conan@dd1c20e |
Pycharm warns on I'm wondering if there could be a less dynamic alternative API that would be less confusing to IDEs. |
@sourcedelica You may try using There could be a way to help IDE to infer the type. E.g. VS Code's plugin understands |
That sounds just like what what I would like. I’ll give it a shot.
Thanks!
On Wed, May 16, 2018 at 3:03 PM Yuri Timenkov ***@***.***> wrote:
@sourcedelica <https://github.com/sourcedelica> ConanFile.settings
actually has type of conans.model.settings.Settings
You may try using get_safe method, for example
self.settings.get_safe("os.arch")
There could be a way to help IDE to infer the type. E.g. VS Code's plugin
understands assert isinstance(x, type). See microsoft/PTVS#82
<microsoft/PTVS#82>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2706 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEBjBIgPozbWX6wuVGgCq7lRq8P6HYj-ks5tzHf_gaJpZM4TEffg>
.
--
Sent from Gmail Mobile
|
@sourcedelica I can't even go that far, I have immediate error "[pylint] E0401:Unable to import 'conans'". How did you pass through that? :) (Note that I have conan installed with the stand-alone installer, not as python package, maybe this might be the problem?) |
@mmatrosov It works better if you install conan via pip. If you have standalone installer which provides python modules (not sure if the official one does, pyinstaller explicitly hides modules so they can't be imported) you can add it to
(the plugin is in PR yet) |
* Replaced linter message filtering with plugin. Fixes #2706 * More evident name for plugin.
Hi all! Many thanks to @ytimenkov for implementing it! It will be released in next 1.6, keep tuned for testing it! |
* Replaced linter message filtering with plugin. Fixes conan-io#2706 * More evident name for plugin.
Problem
When editing
conanfile.py
with editor which has linter support (VS Code with Python extension in my case) there are a bunch of errors related to dynamic fields (likeself.copy is not callable
orInstance of ConanFile doesn't have package_folder member
).Proposal
Conan has a built-in linting support for conanfile.py, but it deals with dynamic fields by post-processing json output.
It would be useful if this logic is moved to a pylint plugin which can be reused by editor/IDE or via command line options.
There are few tutorials on the Internet about how to do it.
The text was updated successfully, but these errors were encountered: