[![CI](https://github.com/KapJI/homeassistant-stubs/actions/workflows/ci.yaml/badge.svg)](https://github.com/KapJI/homeassistant-stubs/actions/workflows/ci.yaml)
[![PyPI version](https://img.shields.io/pypi/v/homeassistant-stubs)](https://pypi.org/project/homeassistant-stubs/)
# PEP 484 stubs for Home Assistant Core
This is unofficial stub-only package generated from [Home Assistant Core](https://github.com/home-assistant/core) sources.
You can use it to enable type checks against Home Assistant code in your custom component or AppDaemon app.
## How to use
Add it to dev dependencies of your project.
I recommend to use [uv](https://docs.astral.sh/uv/) for managing dependencies:
```shell
uv add --dev homeassistant-stubs
```
Please note that only stubs from strictly typed modules are added in this package.
This includes all core modules and some components.
Generic components like `sensor`, `light` or `media_player` are already typed.
If your project imports not yet typed components, `mypy` will be unable to find that module.
The best thing you can do to fix this is to submit PR to HA Core which adds type hints for these components.
After that stubs for these components will become available in this package.
## Motivation
Home Assistant maintainers don't want to distribute typing information with `homeassistant` package
([[1]](https://github.com/home-assistant/core/pull/28866),
[[2]](https://github.com/home-assistant/core/pull/47796)).
The reason is that [PEP 561](https://www.python.org/dev/peps/pep-0561/#packaging-type-information)
says that `py.typed` marker is applied recursively and the whole package must support type checking.
But many of the Home Assistant components are currently not type checked.
## How it works
- `update_stubs.py` script extracts list of strictly typed modules from Home Assistant configs.
- Then it runs `stubgen` which is shipped with `mypy` to generate typing stubs.
- New versions are generated and published automatically every 12 hours.
Raw data
{
"_id": null,
"home_page": null,
"name": "homeassistant-stubs",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.12",
"maintainer_email": null,
"keywords": "homeassistant, pep484, typing",
"author": null,
"author_email": "Ruslan Sayfutdinov <ruslan@sayfutdinov.com>",
"download_url": "https://files.pythonhosted.org/packages/30/f9/574c21e49d9c78cb0f18a1e37ff21afce1ccd9dcaff35c99455a0bb8ad30/homeassistant_stubs-2024.12.5.tar.gz",
"platform": null,
"description": "[![CI](https://github.com/KapJI/homeassistant-stubs/actions/workflows/ci.yaml/badge.svg)](https://github.com/KapJI/homeassistant-stubs/actions/workflows/ci.yaml)\n[![PyPI version](https://img.shields.io/pypi/v/homeassistant-stubs)](https://pypi.org/project/homeassistant-stubs/)\n\n# PEP 484 stubs for Home Assistant Core\n\nThis is unofficial stub-only package generated from [Home Assistant Core](https://github.com/home-assistant/core) sources.\nYou can use it to enable type checks against Home Assistant code in your custom component or AppDaemon app.\n\n## How to use\n\nAdd it to dev dependencies of your project.\nI recommend to use [uv](https://docs.astral.sh/uv/) for managing dependencies:\n\n```shell\nuv add --dev homeassistant-stubs\n```\n\nPlease note that only stubs from strictly typed modules are added in this package.\nThis includes all core modules and some components.\nGeneric components like `sensor`, `light` or `media_player` are already typed.\n\nIf your project imports not yet typed components, `mypy` will be unable to find that module.\nThe best thing you can do to fix this is to submit PR to HA Core which adds type hints for these components.\nAfter that stubs for these components will become available in this package.\n\n## Motivation\n\nHome Assistant maintainers don't want to distribute typing information with `homeassistant` package\n([[1]](https://github.com/home-assistant/core/pull/28866),\n[[2]](https://github.com/home-assistant/core/pull/47796)).\nThe reason is that [PEP 561](https://www.python.org/dev/peps/pep-0561/#packaging-type-information)\nsays that `py.typed` marker is applied recursively and the whole package must support type checking.\nBut many of the Home Assistant components are currently not type checked.\n\n## How it works\n\n- `update_stubs.py` script extracts list of strictly typed modules from Home Assistant configs.\n- Then it runs `stubgen` which is shipped with `mypy` to generate typing stubs.\n- New versions are generated and published automatically every 12 hours.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "PEP 484 typing stubs for Home Assistant Core",
"version": "2024.12.5",
"project_urls": {
"Bug Tracker": "https://github.com/KapJI/homeassistant-stubs/issues",
"Homepage": "https://github.com/KapJI/homeassistant-stubs",
"Release Notes": "https://github.com/KapJI/homeassistant-stubs/releases"
},
"split_keywords": [
"homeassistant",
" pep484",
" typing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7d89d51da13a43e22bc880ad83dc86e3643cd2579e3129623392b4bed9511368",
"md5": "517a9cd4aaf966abeb79bb200b07fdfb",
"sha256": "48c10df8be8d758685ac131e8856c748e52096e53d07ae2811b8d11e2746a6ff"
},
"downloads": -1,
"filename": "homeassistant_stubs-2024.12.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "517a9cd4aaf966abeb79bb200b07fdfb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.12",
"size": 2857585,
"upload_time": "2024-12-20T12:53:28",
"upload_time_iso_8601": "2024-12-20T12:53:28.809441Z",
"url": "https://files.pythonhosted.org/packages/7d/89/d51da13a43e22bc880ad83dc86e3643cd2579e3129623392b4bed9511368/homeassistant_stubs-2024.12.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "30f9574c21e49d9c78cb0f18a1e37ff21afce1ccd9dcaff35c99455a0bb8ad30",
"md5": "5dba2f762d56417bc5ac712f57c0bc39",
"sha256": "37a47ecb85e97385c17efc26dc9172b9a8a4e3d25a19c283021b1fe1af5e4b72"
},
"downloads": -1,
"filename": "homeassistant_stubs-2024.12.5.tar.gz",
"has_sig": false,
"md5_digest": "5dba2f762d56417bc5ac712f57c0bc39",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.12",
"size": 1007274,
"upload_time": "2024-12-20T12:53:34",
"upload_time_iso_8601": "2024-12-20T12:53:34.790633Z",
"url": "https://files.pythonhosted.org/packages/30/f9/574c21e49d9c78cb0f18a1e37ff21afce1ccd9dcaff35c99455a0bb8ad30/homeassistant_stubs-2024.12.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-20 12:53:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "KapJI",
"github_project": "homeassistant-stubs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "homeassistant-stubs"
}