nickovs / unificontrol

A high-level Python interface to the Unifi controller software
Apache License 2.0
96 stars 41 forks source link

Install is broken due to missing requests #3

Closed wolph closed 4 years ago

wolph commented 4 years ago

The setup.py includes unificontrol which (after a few more imports) also imports requests.

I'm guessing this could be solved by specifying requests as setup_requirements instead of install_requirements but not entirely sure.

Obtaining unificontrol
    ERROR: Command errored out with exit status 1:
     command: unificontrol/.venv/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'unificontrol/setup.py'"'"'; __file__='"'"'unificontrol/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info
         cwd: unificontrol/
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "unificontrol/setup.py", line 4, in <module>
        import unificontrol
      File "unificontrol/unificontrol/__init__.py", line 30, in <module>
        from .unifi import UnifiClient, FETCH_CERT
      File "unificontrol/unificontrol/unifi.py", line 31, in <module>
        import requests
    ModuleNotFoundError: No module named 'requests'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

To reproduce:

git clone https://github.com/nickovs/unificontrol.git
cd unificontrol
pipenv install -e .
nickovs commented 4 years ago

That is indeed a problem. Thanks for catching that. The only reason that setup.py imports unificontrol is to get the version number, so rather than making the dependency management more complex I will just fix the way that it tracks the version number.

nickovs commented 4 years ago

Having some data classes for the various sorts of entities managed by Unifi would be helpful. My only concern with your proposal is that the dataclasses module was only added in Python 3.7 and I had been trying to keep the code compatible with 3.6. Perhaps we can find a way to have these classes show up if the dataclasses module module is present but be absent if running on an older version of Python. If you want to come up with a PR I'd be happy to take a look.

nickovs commented 4 years ago

All good ideas. I've opened a new issue #5 to discuss this further so that I can close this issue once I have committed the fix. Let's move the discussion to there.

wolph commented 4 years ago

I've moved the messages :)

nickovs commented 4 years ago

Fixed in version 0.2.6. New version committed to the master branch and pushed to PyPI.