mirror of
https://github.com/home-assistant/developers.home-assistant.git
synced 2025-07-19 07:16:29 +00:00
Add details about typed ConfigEntry in runtime-data and strict-typing IQS rule (#2479)
This commit is contained in:
parent
295afdefbc
commit
fc93ad4978
@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: "Use ConfigEntry.runtime_data to store runtime data"
|
title: "Use ConfigEntry.runtime_data to store runtime data"
|
||||||
related_rules:
|
related_rules:
|
||||||
|
- strict-typing
|
||||||
- test-before-setup
|
- test-before-setup
|
||||||
---
|
---
|
||||||
import RelatedRules from './_includes/related_rules.jsx'
|
import RelatedRules from './_includes/related_rules.jsx'
|
||||||
@ -35,6 +36,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: MyIntegrationConfigEntry
|
|||||||
return True
|
return True
|
||||||
```
|
```
|
||||||
|
|
||||||
|
:::info
|
||||||
|
If the integration implements `strict-typing`, the use of a custom typed `MyIntegrationConfigEntry` is required and must be used throughout.
|
||||||
|
:::
|
||||||
|
|
||||||
## Additional resources
|
## Additional resources
|
||||||
|
|
||||||
More information about configuration entries and their lifecycle can be found in the [config entry documentation](/docs/config_entries_index).
|
More information about configuration entries and their lifecycle can be found in the [config entry documentation](/docs/config_entries_index).
|
||||||
@ -45,4 +50,4 @@ There are no exceptions to this rule.
|
|||||||
|
|
||||||
## Related rules
|
## Related rules
|
||||||
|
|
||||||
<RelatedRules relatedRules={frontMatter.related_rules}></RelatedRules>
|
<RelatedRules relatedRules={frontMatter.related_rules}></RelatedRules>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
title: "Strict typing"
|
title: "Strict typing"
|
||||||
|
related_rules:
|
||||||
|
- runtime-data
|
||||||
---
|
---
|
||||||
|
import RelatedRules from './_includes/related_rules.jsx'
|
||||||
|
|
||||||
## Reasoning
|
## Reasoning
|
||||||
|
|
||||||
@ -15,10 +18,18 @@ This file tells mypy that your library is fully typed, after which it can read t
|
|||||||
|
|
||||||
In the Home Assistant codebase, you can add your integration to the [`.strict-typing`](https://github.com/home-assistant/core/blob/dev/.strict-typing) file, which will enable strict type checks for your integration.
|
In the Home Assistant codebase, you can add your integration to the [`.strict-typing`](https://github.com/home-assistant/core/blob/dev/.strict-typing) file, which will enable strict type checks for your integration.
|
||||||
|
|
||||||
|
:::warning
|
||||||
|
If the integration implements `runtime-data`, the use of a custom typed `MyIntegrationConfigEntry` is required and must be used throughout.
|
||||||
|
:::
|
||||||
|
|
||||||
## Additional resources
|
## Additional resources
|
||||||
|
|
||||||
To read more about the `py.typed` file, see [PEP-561](https://peps.python.org/pep-0561/).
|
To read more about the `py.typed` file, see [PEP-561](https://peps.python.org/pep-0561/).
|
||||||
|
|
||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
There are no exceptions to this rule.
|
There are no exceptions to this rule.
|
||||||
|
|
||||||
|
## Related rules
|
||||||
|
|
||||||
|
<RelatedRules relatedRules={frontMatter.related_rules}></RelatedRules>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user