Missing Crypto requirement in manifest
frenck opened this issue · 5 comments
This integration is missing a requirement in its manifest, hence the Home Assistant Custom Integration wheels failed to build the requirements.
Process package: pytuya>=7.0.5
Looking in links: https://wheels.home-assistant.io/alpine-3.10/amd64/
Collecting pytuya>=7.0.5
Downloading pytuya-7.0.5.zip (13 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-flebjpuj/pytuya/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-flebjpuj/pytuya/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-wheel-flebjpuj/pytuya/pip-egg-info
cwd: /tmp/pip-wheel-flebjpuj/pytuya/
Complete output (14 lines):
Traceback (most recent call last):
File "/tmp/pip-wheel-flebjpuj/pytuya/pytuya/__init__.py", line 24, in <module>
import Crypto
ModuleNotFoundError: No module named 'Crypto'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-wheel-flebjpuj/pytuya/setup.py", line 9, in <module>
import pytuya
File "/tmp/pip-wheel-flebjpuj/pytuya/pytuya/__init__.py", line 28, in <module>
import pyaes # https://github.com/ricmoo/pyaes
ModuleNotFoundError: No module named 'pyaes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
See: https://github.com/clach04/python-tuya#encryption-notes
I'm removing the inclusion of this integration from our wheels project for now.
Feel free to re-add it when this has been resolved.
Thanks @frenck, I'll get this resolved ASAP.
Looks like this has been fixed in pytuya#master
but not yet released to PyPI: clach04/python-tuya#71
@frenck There's an issue with the latest release of the pytuya module - it tries to access Crypto during its installation, but Crypto isn't there at the time, which requires a two-stage installation. For some reason this appears to work fine when installing via HACS (I suspect it's already installed by a sub-sub-dependency of HACS), but obviously that doesn't help your Wheels build environment.
This is already fixed in pytuya 'master' but there hasn't been a release yet. The suggestion made by the maintainer of pytuya, to avoid them creating a release before they're ready to, was to use a Github dependency reference instead.
As far as I understand, this would not be allowed by Home Assistant because it's not coming from PyPi. At least, it's not allowed when submitting a PR to Core ... would it be work and be acceptable for inclusion in Wheels?
It is already a dependency of HA itself, however, packages should define their own set of dependencies and not rely on the coincidence of having it already installed.
In this case, we are building Python wheels, which has nothing to do with Home Assistant itself directly.
@frenck Totally agree - as this is a peer dependency of pytuya
it's not explicitly declared and I should be declaring it myself.
The issue here though is that pytuya
7.0.5 is broken because setup.py
imports a dependency provided by Crypto, but Crypto is not available at that point because there is no specific install order. So you have to install Crypto first, and then pytuya
in a separate step - which is not correct.
The developer of pytuya
has fixed this in later commits but hasn't released an update to PyPi yet. When I asked them if they could, they were reluctant to do a new release and instead suggested that I use a GitHub reference instead of a version reference to get the latest code (see clach04/python-tuya#71). My question to you is if this would even work with HA, and if it did would it be allowed for the Wheels repository considering I don't think it's allowed for HA Core?