-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
Migrate integrations to use top-level imports #27284
Closed
Labels
Comments
🆘 Marked as "Help wanted"If you want to help out on this, go ahead, it is really appreciated! |
This was referenced Oct 8, 2019
This was referenced Oct 8, 2019
Merged
This was referenced Oct 9, 2019
This was referenced Oct 9, 2019
7 tasks
7 tasks
This was referenced Dec 6, 2019
Btw @frenck could you please mark |
done. |
This was referenced Apr 4, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pylint 2.4 introduced a new check:
import-outside-toplevel
.This check warns when modules are imported from places other than a module top-level, e.g., inside a function or a class.
With the upcoming upgrade of Pylint in our codebase, we are going to disable this check. However, it would have been nice to be able to enable it, so we can prevent imports outside of the top-level in our builds.
Since we started using our manifests for integration requirements, these function-level imports are no longer required or needed, and thus, can now be removed or moved to the top-level.
This issue is a placeholder to keep track of the status of this migration. If you resolve this issue for one of the integrations listed below, please refer to this issue in the PR you are creating (so we can keep track).
What has to be done?
While this is a pretty small and simple change, it takes a bit of time to do right and neat.
isort
).pylint
,black
andmypy
are happy.More information can be found in the developer documentation:
https://developers.home-assistant.io
Integrations to adjust
I've generated a list of all integrations that still use import outside of the top-level imports using the following command:
pylint homeassistant/components | grep import-outside-toplevel | cut -d'/' -f 3 | sort | uniq
Migrated integrations
Round 2!
The text was updated successfully, but these errors were encountered: