unixorn/ha-mqtt-discoverable

[BUG] import errors

unixorn opened this issue · 3 comments

Describe the bug

Merged #15 , was going to work on #28 and ran into an import error before I made any changes.

@mion00, what python version are you using? I'm ok with bumping the required python version if that's what it takes to fix this.

To Reproduce

poetry run python3
Python 3.9.16 (main, Dec  7 2022, 10:16:11)
[Clang 14.0.0 (clang-1400.0.29.202)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ha_mqtt_discoverable import __version__ as vers
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jpb/Dropbox/s/hass/ha-mqtt-discoverable/ha_mqtt_discoverable/__init__.py", line 457, in <module>
    class DeviceInfo(BaseModel):
  File "/Users/jpb/Dropbox/s/hass/ha-mqtt-discoverable/ha_mqtt_discoverable/__init__.py", line 467, in DeviceInfo
    identifiers: Optional[list[str] | str] = None
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'type'
>>>

I'll switch to 3.10 and document that in the readme.

I should have realized it needed 3.10 since the Dockerfile was updated to use python:3.10