Commit graph

57 commits

Author SHA1 Message Date
J. Nick Koston cef1d35e31
Make fetching integrations with requirements safer (#120481) 2024-06-26 08:51:57 +02:00
Sid 2cc916db6d
Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
J. Nick Koston ab2ea6100c
Speed up singleton decorator so it can be used more places (#116292) 2024-04-28 12:11:08 -05:00
J. Nick Koston 20adc5be70
Small fixes for processing integration requirements (#115973) 2024-04-22 16:52:04 +02:00
Marc Mueller 19ab3d6daf
Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
J. Nick Koston 17ba96ffdb
Avoid creating tasks to install dependent requirements (#111048) 2024-02-20 20:30:07 -06:00
J. Nick Koston 53944235d2
Improve performance of async_get_integration_with_requirements (#110770)
* Improve performance of async_get_integration_with_requirements

- Migrate to the future pattern instead of using asyncio.Event
- Use sets in a few places to avoid linear searching
- Check the cache when processing deps so we do not
  create tasks to process requirements for deps that
  have already been processed

* name

* add concurrency test

* Update homeassistant/requirements.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/requirements.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/requirements.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update homeassistant/requirements.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* reset_mock

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2024-02-17 19:26:41 +01:00
J. Nick Koston 69307374f4
Signficantly reduce executor contention during bootstrap (#107312)
* Signficantly reduce executor contention during bootstrap

At startup we have a thundering herd wanting to use the executor
to load manifiest.json. Since we know which integrations we are
about to load in each resolver step, group the manifest loads
into single executor jobs by calling async_get_integrations on
the deps of the integrations after they are resolved.

In practice this reduced the number of executor jobs
by 80% during bootstrap

* merge

* naming

* tweak

* tweak

* not enough contention to be worth it there

* refactor to avoid waiting

* refactor to avoid waiting

* tweaks

* tweaks

* tweak

* background is fine

* comment
2024-01-07 22:55:40 -05:00
Franck Nijhof 664e490cfa
Update base image to 2023.10.0 (#102126) 2023-10-18 19:11:41 +02:00
Marc Mueller 1daac46635
Replace deprecated pkg_resources with importlib.metadata (#97628) 2023-08-03 09:14:00 +02:00
Franck Nijhof 64c2340fab
Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck Nijhof b0cee0bc46
String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
puddly 8c8994352d
Allow only specific packages to be skipped during startup dependency installation (#82758) 2022-11-30 08:38:52 +01:00
J. Nick Koston 08b55939fb
Avoid creating executor job in requirements if another call satisfied the requirement (#73451) 2022-06-13 14:33:29 -07:00
J. Nick Koston 0ffeb6c304
Check if requirements are installed in the executor (#71611) 2022-06-13 13:10:05 -07:00
Marc Mueller 240c9979c7
Move disallow-any-generics to mypy.ini (#63917) 2022-01-11 13:33:25 -08:00
Ruslan Sayfutdinov 55f4962c06
Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Marc Mueller 238b488642
Use assignment expressions 03 (#57710) 2021-10-17 20:08:11 +02:00
J. Nick Koston 0fce9f39b3
Avoid checking if a package is installed if it already failed (#56698) 2021-09-26 22:32:25 -07:00
J. Nick Koston f268227d64
Implement retry and backoff strategy for requirements install (#56580)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-09-26 14:47:03 -05:00
J. Nick Koston 6d493a848c
Ensure PyPI packages can still be installed on high latency connections (#53365) 2021-07-24 14:07:10 +02:00
Ville Skyttä 470f2dd73f
Upgrade pyupgrade to 2.21.2, apply its changes (#52987) 2021-07-19 10:46:09 +02:00
Marc Mueller f1d48ddfe3
Update pylint to 2.8.0 (#49637) 2021-04-24 14:39:24 -10:00
J. Nick Koston d4329e01ef
Fix deadlock in async_get_integration_with_requirements after failed dep pip install (#49540) 2021-04-22 22:32:38 +02:00
Marc Mueller c07646db5d
Update typing syntax (#49480)
* Update typing syntax

* Replace typing imports with ones from collections where possible

* Changes after review
2021-04-20 17:40:41 +02:00
Alan Tse 125161df6b
Only raise integrationnotfound for dependencies (#48241)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-01 11:30:52 -07:00
Marc Mueller e55702d635
Update typing 01 (#48013) 2021-03-17 17:34:55 +01:00
Ville Skyttä 94dbcc9d2b
Generics and other type hint improvements (#45250) 2021-01-18 22:23:25 +01:00
J. Nick Koston da677f7d5a
Add support for discovery via DHCP (#45087)
* Add support for discovery via DHCP

* additional tesla ouis

* merge tests

* dhcp test

* merge requirements test

* dhcp test

* dhcp discovery

* dhcp discovery

* pylint

* pylint

* pylint

* fix

* Add matching tests

* 100% cover

* cleanup

* fix codespell

* Update exception handling

* remove unneeded comment

* fix options handling exception

* fix options handling exception
2021-01-14 09:09:08 +01:00
Ville Skyttä 317ed418dd
Use singleton enum for "not set" sentinels (#41990)
* Use singleton enum for "not set" sentinel

https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions

* Remove unused variable
2020-12-19 12:46:27 +01:00
Philip Allgaier 625bbe6238
Cleanup unused loggers (components A-M) (#41600) 2020-10-12 16:59:05 +02:00
Erik Montnemery 343e5d64b8
Add MQTT integration discovery (#41332)
* Add MQTT integration discovery

* Add script/hassfest/mqtt.py

* Unsubscribe if config entry exists

* Add homeassistant/generated/mqtt.py

* Fix bad loop

* Improve tests

* Improve tests

* Apply suggestions from code review

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>

* Prevent initiating multiple config flows

Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
2020-10-07 18:30:51 +02:00
Pascal Vizeli c291d4aa7d
Intelligent timeout handler for setup/bootstrap (#38329)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2020-08-05 14:58:19 +02:00
Bas Nijholt 588409c784
Fix isort problem in homeassistant/requirements.py (#33828) 2020-04-08 12:48:20 -07:00
Paulus Schoutsen 173c276c5c Lint 2020-04-08 12:03:56 -07:00
Jason Cheatham 3b246fb40a
Load integrations with requirements in device_automation (#33714)
* Load integrations with requirements in device_automation

- Split cached loader behavior out of async_get_integration
- Use cached loader for both async_get_integration and
  async_get_integration_with_requirements
- Use async_get_integration_with_requirements for device_automation

resolves #33104

* Duplicate caching logic in requirements, remove loader mods

* Update homeassistant/requirements.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2020-04-08 11:42:15 -07:00
Ville Skyttä 221d5205e4
Upgrade mypy to 0.770, tighten config a bit (#32715)
* Upgrade mypy to 0.770, related cleanups

https://mypy-lang.blogspot.com/2020/03/mypy-0770-released.html

* Clean up config and make it a notch stricter, address findings
2020-03-12 11:52:20 +01:00
Bas Nijholt 004af97699 Sort imports for requirements.py and its test using isort (#29836)
Unblocks https://github.com/home-assistant/home-assistant/pull/29739
2019-12-11 12:12:06 +01:00
Paulus Schoutsen 27244e29c4 Install discovery requirements if used (#29795)
* Install discovery requirements if used

* Update loader.py

* Fix types
2019-12-10 09:24:49 +01:00
Bas Nijholt 67c56c860d Sort imports according to PEP8 for 'homeassistant' folder (#29789)
Components are already done
2019-12-09 16:42:10 +01:00
Paulus Schoutsen ec8ea02273 Fix recursion 2019-12-05 10:40:05 -08:00
Paulus Schoutsen 50affdf953
Also install after_deps (#28453) 2019-11-01 17:21:50 -07:00
Paulus Schoutsen 631a819bd1
Fix check config (#28393) 2019-10-31 11:39:26 -07:00
Franck Nijhof decf13b948 Use literal string interpolation in core (f-strings) (#26166) 2019-08-23 09:53:33 -07:00
Joakim Plate d1b9ebc7b2 Integration requirement check refactor (#25626)
* 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
2019-08-07 15:35:50 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Pascal Vizeli bf52aa8ccc Create progress file for pip installs (#24297)
* Create progress file for pip installs

* fix dedlock

* unflacky test

* Address comments

* Lint

* Types
2019-06-04 11:04:20 -07:00
Paulus Schoutsen 276ab191b5 Do not use the cache dir for PIP installs (#24233) 2019-06-01 10:04:12 +02:00
Pascal Vizeli d9852bc75d Support Hass.io wheels / docker env (#24175)
* Support Hass.io wheels / docker env

* address comments

* fix lint
2019-05-29 15:30:09 -07:00
Paulus Schoutsen 179fb0f3b5
Use importlib metadata to check installed packages (#24114)
* Use importlib metadata

* Fix script

* Remove unused import

* Update requirements"
2019-05-26 11:58:42 -07:00