stegm / pykoplenti

Python REST client API for Kostal Plenticore Inverters
Apache License 2.0
16 stars 5 forks source link

pykoplenti CLI tool not executable #19

Closed trsqr closed 5 hours ago

trsqr commented 2 weeks ago

I have an issue getting pykoplenti to run on my system. Python version is 3.8.10. Am I doing something wrong or is there incompatibility with certain Python versions?

I start by creating a venv:

olli@nucserver:~/src$ python -m venv ./venv-pykoplenti
olli@nucserver:~/src$ cd venv-pykoplenti/
olli@nucserver:~/src/venv-pykoplenti$ source ./bin/activate

Installation of pykoplenti is successful:

(venv-pykoplenti) olli@nucserver:~/src/venv-pykoplenti$ pip install pykoplenti[CLI]
Collecting pykoplenti[CLI]
  Using cached pykoplenti-1.2.2-py3-none-any.whl (20 kB)
Collecting pydantic~=1.10
  Using cached pydantic-1.10.18-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB)
Collecting pycryptodome~=3.19
  Using cached pycryptodome-3.21.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB)
Collecting aiohttp~=3.8
  Using cached aiohttp-3.10.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB)
Collecting prompt-toolkit>=3.0; extra == "cli"
  Using cached prompt_toolkit-3.0.48-py3-none-any.whl (386 kB)
Collecting click>=7.1; extra == "cli"
  Using cached click-8.1.7-py3-none-any.whl (97 kB)
Collecting typing-extensions>=4.2.0
  Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting aiohappyeyeballs>=2.3.0
  Using cached aiohappyeyeballs-2.4.3-py3-none-any.whl (14 kB)
Collecting yarl<2.0,>=1.12.0
  Using cached yarl-1.15.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (319 kB)
Collecting aiosignal>=1.1.2
  Downloading aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting attrs>=17.3.0
  Using cached attrs-24.2.0-py3-none-any.whl (63 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.5.0-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (243 kB)
Collecting async-timeout<5.0,>=4.0; python_version < "3.11"
  Using cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.13-py2.py3-none-any.whl (34 kB)
Collecting idna>=2.0
  Using cached idna-3.10-py3-none-any.whl (70 kB)
Collecting propcache>=0.2.0
  Using cached propcache-0.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (213 kB)
Installing collected packages: typing-extensions, pydantic, pycryptodome, aiohappyeyeballs, idna, propcache, multidict, yarl, frozenlist, aiosignal, attrs, async-timeout, aiohttp, wcwidth, prompt-toolkit, click, pykoplenti
Successfully installed aiohappyeyeballs-2.4.3 aiohttp-3.10.10 aiosignal-1.3.1 async-timeout-4.0.3 attrs-24.2.0 click-8.1.7 frozenlist-1.5.0 idna-3.10 multidict-6.1.0 prompt-toolkit-3.0.48 propcache-0.2.0 pycryptodome-3.21.0 pydantic-1.10.18 pykoplenti-1.2.2 typing-extensions-4.12.2 wcwidth-0.2.13 yarl-1.15.2

However, I cannot execute even the help functionality:

(venv-pykoplenti) olli@nucserver:~/src/venv-pykoplenti$ ./bin/pykoplenti -h
Traceback (most recent call last):
  File "./bin/pykoplenti", line 5, in <module>
    from pykoplenti.cli import cli
  File "/home/olli/src/venv-pykoplenti/lib/python3.8/site-packages/pykoplenti/__init__.py", line 1, in <module>
    from .api import (
  File "/home/olli/src/venv-pykoplenti/lib/python3.8/site-packages/pykoplenti/api.py", line 19, in <module>
    from .model import (
  File "/home/olli/src/venv-pykoplenti/lib/python3.8/site-packages/pykoplenti/model.py", line 7, in <module>
    class MeData(BaseModel):
  File "/home/olli/src/venv-pykoplenti/lib/python3.8/site-packages/pykoplenti/model.py", line 13, in MeData
    permissions: list[str] = Field()
TypeError: 'type' object is not subscriptable

(venv-pykoplenti) olli@nucserver:~/src/venv-pykoplenti$ python3 --version
Python 3.8.10
stegm commented 1 week ago

Yes, I have a bug which prevent it from running with 3.8. I have prepared a PR #18 (not integrated yet), which fixes it for 3.9. I dropped support for 3.8 because it is already end of life (https://devguide.python.org/versions/#versions).

So, please try with 3.9 or higher and take the branch from #18 until it is integrated.

trsqr commented 5 days ago

Tried with 3.9 and the version in that branch. Seems to work ok.