`2023-06-17 12:44:37.961 ERROR (MainThread) [homeassistant.setup] Setup failed for switchbot: Unable to import component: cannot import name DEFAULT_CIPHERS from urllib3.util.ssl_ (/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py)` is not very helpful as it does not show which module tried to import.
adding a traceback makes it more obvious, and since ImportError is usually not something
the user can easily solve, it makes issue reports much more helpful
```
DEFAULT_CIPHERS from urllib3.util.ssl_ (/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py)
Traceback (most recent call last):
File "/Users/bdraco/home-assistant/homeassistant/setup.py", line 213, in _async_setup_component
component = integration.get_component()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bdraco/home-assistant/homeassistant/loader.py", line 813, in get_component
ComponentProtocol, importlib.import_module(self.pkg_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/bdraco/home-assistant/homeassistant/components/switchbot/__init__.py", line 5, in <module>
import switchbot
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/switchbot/__init__.py", line 22, in <module>
from .devices.lock import SwitchbotLock
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/switchbot/devices/lock.py", line 12, in <module>
import boto3
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/boto3/session.py", line 17, in <module>
import botocore.session
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/session.py", line 29, in <module>
import botocore.credentials
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/credentials.py", line 34, in <module>
from botocore.config import Config
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/config.py", line 16, in <module>
from botocore.endpoint import DEFAULT_TIMEOUT, MAX_POOL_CONNECTIONS
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/endpoint.py", line 22, in <module>
from botocore.awsrequest import create_request_object
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/awsrequest.py", line 24, in <module>
import botocore.utils
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/utils.py", line 32, in <module>
import botocore.httpsession
File "/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/botocore/httpsession.py", line 10, in <module>
from urllib3.util.ssl_ import (
ImportError: cannot import name DEFAULT_CIPHERS from urllib3.util.ssl_ (/Users/bdraco/home-assistant/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py)
```
* Do not wait
* Correct tests
* Manage after dependencies stage 1
* test bootstrap dependencies
* Assert log the dependenciy is waited for
* Improve docstrings
* Assert outside callback
* Patch async_get_integrations
* Revert changes made to snips integration
* Undo changes to mqtt_statestream
* Only wait for import flows to initialize at setup
* Update hassio tests
* Update hassio tests
* Apply suggestions from code review
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
after_dependencies were checking hass.config.components
to see if something was already setup. We did not do
the same for dependencies which resulted in trying
to set them up more then once.
Noticed when `homeassistant.setup` was set to debug
logging and many integrations were announcing
waiting on http when it was already setup.
* Periodicly log when intergrations are taking a while to setup
When one or more intergrations are taking a while to setup
it is hard to determine which one is the cause. We can
help narrow this down for the user with a periodic log
message about which domains are still waiting to be setup
every 30s.
* 30 -> 60 per discussion
* only log when the integration is actually doing setup
* reduce, fix race in test
* Proceed with startup if an integration setup blocks for more than 30m
* Fix test location
* Fix log call
* naming
* revert
* do not shield from cancelation
* Adjust test since we now cancel when we hit the timeout
* Allow async_setup changes to config entry data be taken into account
* Fix tests
* Limit scope try…finally
* Update tests/test_config_entries.py
Co-Authored-By: Martin Hjelmare <marhje52@gmail.com>
* Fix import
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
* Store last working HTTP settings
* Add safe mode
* Fix tests
* Add cloud to safe mode
* Update logging text
* Fix camera tests leaving files behind
* Make emulated_hue tests not leave files behind
* Make logbook tests not leave files behind
* Make tts tests not leave files behind
* Make image_processing tests not leave files behind
* Make manual_mqtt tests not leave files behind
* Factor out code getting requirements for integration
* Have process requirements raise an exception
* One more lint fix
* Blackify
* Catch new exception
* Let RequirementsNotFound be a HomeAssistantError
* Correct another test
* Split catching of exceptions and avoid complete log
* load cleanups
* Remove unused methods
* Allow importing requirements at the top of a file
* Fix test
* Lint
* Install reqs ASAP when loading platforms
* Load dependencies from manifests. Fallback to current DEPENDENCIES
* Fix typing
* Ignore typing correctly
* Split out dependency processing to a new method
* Fix tests
* Only pull from manifest if dependencies is non empty
* Inline temporary function
* Fix light tests [skip ci]
* Fix tests/common
* Fix some mqtt tests [skip ci]
* Fix tests and component manifests which have only one platform
* Fix rflink tests
* Fix more tests and manifests
* Readability over shorthand format
* Fix demo/notify tests
* Load dependencies from manifests. Fallback to current DEPENDENCIES
* Load requirements from manifests. Fallback to current REQUIREMENTS
* Fix typing
* Ignore typing correctly
* Split out dependency processing to a new method
* Only pull from manifest if dependencies is non empty
* Inline temporary function
* Fix tests and component manifests which have only one platform
* Fix rflink tests
* Readability over shorthand format
* Clean up requirements
* Use integration to resolve deps/reqs
* Lint
* Lint
* revert a change
* Revert a test change
* Fix types
* Fix types
* Add back cache for load component
* Fix test_component_not_found
* Move light.test and device_tracker.test into test package instead with manifest to fix tests
* Fix broken device_tracker tests
* Add docstrings to __init__
* Fix all of the light tests that I broke earlier
* Embed the test.switch platform to fix other tests
* Embed and fix the test.imagimage_processing platform
* Fix tests for nx584
* Add dependencies from platform file's DEPENDENCIES
* Try to setup component when entity_platform is setting up
Fix tests in helpers folder
* Rewrite test_setup
* Simplify
* Lint
* Disable demo component if running in test
Temp workaround to unblock CI tests
* Skip demo tests
* Fix config entry test
* Fix repeat test
* Clarify doc
* One extra guard
* Fix import
* Lint
* Workaround google tts
## Description:
More typing improvements.
Switch to using `mypy.ini` for flexibility
Add `warn_return_any` check except in `homeassistant.util.yaml` that does typing hacks. Fix some type annotations as resulting from this check and ignore others were fixing is hard.
## Checklist:
- [x] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**
## Description:
Make typing checks more strict: add `--strict-optional` flag that forbids implicit None return type. This flag will become default in the next version of mypy (0.600)
Add `homeassistant/util/` to checked dirs.
## Checklist:
- [x] The code change is tested and works locally.
- [x] Local tests pass with `tox`. **Your PR cannot be merged unless tests pass**