Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Crypto requirement in manifest #33

Closed
frenck opened this issue May 11, 2020 · 5 comments
Closed

Missing Crypto requirement in manifest #33

frenck opened this issue May 11, 2020 · 5 comments

Comments

@frenck
Copy link

frenck commented May 11, 2020

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.

@nicole-ashley
Copy link
Owner

Thanks @frenck, I'll get this resolved ASAP.

@nicole-ashley
Copy link
Owner

nicole-ashley commented May 12, 2020

Looks like this has been fixed in pytuya#master but not yet released to PyPI: clach04/python-tuya#71

@nicole-ashley
Copy link
Owner

@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?

@frenck
Copy link
Author

frenck commented May 24, 2020

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.

@nicole-ashley
Copy link
Owner

@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?

@frenck frenck closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants