Registry / type-stubs / homeassistant-stubs

homeassistant-stubs

JSON →
library2026.6.3pypypi✓ verified 88d ago

PEP 484 typing stubs for Home Assistant Core. Provides type annotations for the homeassistant package to enable static type checking with mypy or pyright. Version 2026.4.4 tracks Home Assistant releases; updated frequently alongside HA releases.

pip install homeassistant-stubs
INSTALL
IMPORT
SIG · HOMEASSISTANT-STUB
H
homeassistant-stubs
type-stubspythonv2026.6.3
Install
32.2s avg
Import
—
Disk
370MB
Pass rate
7/ 10
Env Coverage7 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2023.7.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 21.3s
py 3.11
✓ 0.1s
✓ 71.9s
py 3.12
✓ 0.1s
✓ 76.3s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 23.6s
370MB installed
● package 370MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

homeassistant
✓ import homeassistant
Stubs are installed alongside the package; no special import needed.

Basic usage verifying stubs work with mypy: no additional imports required.

import homeassistant from homeassistant.core import HomeAssistant ha = HomeAssistant() print('Type stubs are active')
Debug
Known issues
gotchaStubs must match the exact installed homeassistant version. Mismatch may cause false positives or errors.
fix
Pin homeassistant-stubs to the same version as homeassistant, e.g., homeassistant-stubs==2026.4.4.
affects: all
deprecatedOlder versions may not include stubs for newer HA modules; always upgrade stubs after upgrading Home Assistant.
fix
Update both packages: pip install --upgrade homeassistant homeassistant-stubs
affects: <2026.4.0
Errors
Common errors & fixes
Cannot find reference 'HomeAssistant' in 'homeassistant.core'
homeassistant-stubs not installed or version mismatch.
fix
pip install homeassistant-stubs==<your ha version>
Module 'homeassistant' has no attribute 'config'
Stubs missing for certain submodules; HA core may expose it at runtime but stubs lag.
fix
Ignore with # type: ignore[attr-defined] or upgrade stubs.
Upgrade
Version history
2026.6.3latest on PyPI · released Jun 13, 2026
Audit
Dependencies
homeassistantoptionalThe stubs are generated for the corresponding homeassistant version; runtime dependency only if type checking.
Agent activity
32 hits · last 30 days
node
29
OpenAI (training)
1
Resources
homeassistant-stubs — pip install homeassistant-stubs · libregistry