kapji / homeassistant-stubs Goto Github PK
View Code? Open in Web Editor NEWTyping stubs for Home Assistant Core
License: MIT License
Typing stubs for Home Assistant Core
License: MIT License
Details: python/mypy#16864
Hi there,
I've noticed this problem in recent versions:
/nix/store/cm7xda19nh3bb326y5qv56750ni3dz49-python3.10-homeassistant-stubs-2022.10.4/lib/python3.10/site-packages/homeassistant-stubs/components/bluetooth/models.pyi:27: error: invalid syntax
Found 1 error in 1 file (errors prevented further checking)
This appears to be due to python/mypy#12441, so not really a bug in this project (hence feel free to just close the issue), but I thought I should note it.
I managed to work around it with the following hacky sed commands on the installed .pyi
files:
find $out -name "*.pyi" -print0 | xargs -0 sed -i 's/, \*,/, *args,/g'
find $out -name "*.pyi" -print0 | xargs -0 sed -i 's/, \*\*)/, **kwargs)/g'
Generic[_T]
got lost.
I suppose this is why for something like https://github.com/scop/home-assistant-jatekukko/blob/66ceb35160f20026d3f638e7696513a585a5436f/custom_components/jatekukko/coordinator.py#L42, mypy gives:
custom_components/jatekukko/coordinator.py:42: error: "DataUpdateCoordinator" expects no type arguments, but 1 given [type-arg]
Similarly for BaseCoordinatorEntity
.
This is with homeassistant-stubs 2023.2.4.
FYI, when I try to use the current packages on a windows Python 3.11 installation, I run into the issue that aiohttp==3.8.1 requires compilation that does "fails".
I can install 3.7.4,3.8.2,3.8.3 but not 3.8.0 or 3.8.1
Perhaps the same issue as #290, but thought I'd report it anyway:
total=False
got lost.
I suppose this is why for something like https://github.com/scop/home-assistant-jatekukko/blob/66ceb35160f20026d3f638e7696513a585a5436f/custom_components/jatekukko/coordinator.py#L30, mypy gives:
custom_components/jatekukko/coordinator.py:30: error: Missing keys ("connections", "default_name", "manufacturer", "model", "suggested_area", "sw_version", "hw_version", "via_device") for TypedDict "DeviceInfo" [typeddict-item]
This is with homeassistant-stubs 2023.2.4.
Thanks for creating these stubs.
I'm seeing the following error when running mypy
on my custom_component:
Skipping analyzing "homeassistant.components.text": module is installed, but missing library stubs or py.typed marker\
It seems that stubs aren't being generated for some reason for this module, any ideas why?
FYI. For example https://github.com/KapJI/homeassistant-stubs/blob/2022.4.4/pyproject.toml#L27, and also in poetry.lock
. Thanks!
I use homeassistant-stubs in the https://github.com/custom-components/feedparser repository.
I have bumped into an issue with the latest version of stubs.
https://github.com/custom-components/feedparser/actions/runs/5876164929/job/15933776158?pr=91#step:4:145
/home/runner/.cache/pre-commit/repoa5dodlk1/py_env-python3.11/lib/python3.11/site-packages/homeassistant-stubs/components/sensor/__init__.pyi:26: error: expected '(' [syntax]
The issue seems to be in stubs itself.
Note init.pyi
py311: commands[0]> mypy -p custom_components.hassmpris
.tox/py311/lib/python3.11/site-packages/homeassistant-stubs/components/media_player/__init__.pyi:77: error: expected '(' [syntax]
Found 1 error in 1 file (errors prevented further checking)
py311: exit 2 (0.30 seconds) /home/user/Projects/homeassistant-hassmpris> mypy -p custom_components.hassmpris pid=146189
py311: FAIL code 2 (5.18=setup[4.88]+cmd[0.30] seconds)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.