-
Notifications
You must be signed in to change notification settings - Fork 48
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
Made numpy requirement optional. Fixes #4 #5
base: master
Are you sure you want to change the base?
Conversation
Hi! I'm using your new integration in Home assistant. But I can't find how to open the SETTING button in the file endpoints.py. Sorry that write here. I don't know where else to write =) |
I'm happy with this (but it needs to be rebased) |
I’ve reapplied the patch :) |
The assert for missing numpy should be consistently added to all the relevant functions. Also please fix the style checks (suggest to use pre-commit hooks as described in the documentation) |
I don't think the pre-commit stuff is working but I might be doing something wrong. The usage isn't really clear to me
I've also tried to look at the Azure pipelines output but it's not telling me anything useful either: https://dev.azure.com/joshbendavid/aiopylgtv/_build/results?buildId=9&view=logs&jobId=00b6a206-eb91-585b-3d14-cf1a4d7b1970&j=00b6a206-eb91-585b-3d14-cf1a4d7b1970&t=9a9400f1-b707-5d54-e2fd-4fe1d8bc6dda Feel free to add extra numpy checks to the other methods though. For the time being I've simply added a mock numpy which works fine for my case. |
bumping this as I've just got a new LG TV and would like to use this library but not install numpy. |
I've (re-) applied the patch 3 times, I'm just running the fork for now |
Make numpy optional
Thanks for the help @cdce8p :) |
I'll come back to this soon, but there are a few other items which are higher priority (and ideally I would like to add some unit tests to systematically make sure this isn't breaking the calibration functionality). Are there platforms where this is really breaking/preventing to use the library? |
With any OS/Python version combination that doesn't have a binary wheel you're in for a very long build time. In my case it is a FreeBSD machine that doesn't come bundled with numpy for the Python version I want. But most pyenv environments will give similar issues. |
How do we what do move forward with this PR? I'm using this lib together with Home Assistant on a Raspberry Pi, like a few others I would imagine. Since there is no binary wheel any install or update of numpy takes a really long time during which the whole system is unresponsive. @bendavid You mentioned that you would like some unit tests to make sure calibration still works as expected. I could contribute those, however since I'm not familiar which this feature I would only assert that numpy is being imported correctly. This however can also be seen just by looking at the changes itself. Let me explain. Below is the output of assert Python 3.9.1
Type "help", "copyright", "credits" or "license" for more information.
>>> assert np
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'np' is not defined
>>> import numpy as np
>>> assert np
>>> As you can see, if numpy is imported as expected it just does nothing. Therefore the risk is not if the calibration will continue to work, but if all other features continue to (assuming you don't have numpy installed). Since we've added the asserts only to functions which use or call a function that uses numpy, this shouldn't be an issue. Please let me / us know how you want to continue. @wolph I just realized that the assert statements are too verbose. It will never print the error message and thus just do more comparisons. I will open a PR on your fork to change those into comments. |
Update assert statements
And it's merged :) Let's hope we can continue now |
@bendavid Any update? |
also looking forward for this functionality? |
I just looked into this, I think using assert is not enough, it's bypassed when optimized code is compiled (
But I like the idea as well :) |
No description provided.