bendavid / aiopylgtv

Library to control webOS based LG Tv devices
MIT License
145 stars 47 forks source link

Adding CI and ensure a consistent style and make simplifications #2

Closed basnijholt closed 4 years ago

basnijholt commented 4 years ago

Thanks a lot for picking up this project!

Just some small style changes and adding a CI that tests for the consistent style.

I can help you to enable it (or you can give me write access 😄)

I also made some simplifications of the code that was repeated.

I have also change the Python requirement back to Python >= 3.6, because it is needed to work with Home Assistant. Also, I didn't see any 3.8 only code.

basnijholt commented 4 years ago

@bendavid, please let me know what you think!

basnijholt commented 4 years ago

Do you plan on merging this?

If so, I will solve the merge conflicts (again) 😅😉

basnijholt commented 4 years ago

ping @bendavid

basnijholt commented 4 years ago

@bendavid, I rebased on top of master 👍

(again 😉)

bendavid commented 4 years ago

Since python 3.6 has already been deprecated in home assistant (and is being removed in 0.104 I believe) we should make the requirement python 3.7 rather (I guess the pyupgrade hook also needs to be modified accordingly.)

There are definitely some bits here which don't work in python 3.6 (asyncio.create_task for example was only introduced in 3.7, even if that would be trivial to work around if it were really needed.)

basnijholt commented 4 years ago

Good one, I thought that everything that was used was in Python >=3.6.

No need to depend on 3.6 though, however, it should support 3.7 because of Home Assistant.

I have updated and pushed the code accordingly.

bendavid commented 4 years ago

After installing the pre-commit hooks and trying to add a commit I get an error as below, so it looks like things are not quite working in a python 3.8 environment.

[INFO] Installing environment for https://github.com/ambv/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/home/bendavid/pylgdev/venv/bin/python3', '-mvirtualenv', '/home/bendavid/.cache/pre-commit/repo8oxyovvt/py_env-python3.7', '-p', 'python3.7')
return code: 3
expected return code: 0
stdout:
    The path python3.7 (from --python=python3.7) does not exist

stderr: (none)
Check the log at /home/bendavid/.cache/pre-commit/pre-commit.log
basnijholt commented 4 years ago

Great! Thanks for merging 👍