-
Notifications
You must be signed in to change notification settings - Fork 55
Feature Request: Support python package installation somehow #66
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
Comments
This may be a difficult goal. The only real solutions are 1) fully manual, and 2) pyscript installed For fully manual, as you mentioned, you'd have to install the packages. I don't think it would be too difficult to alter the homeassistant docker image to allow user injectable requirements. And, most likely, a change like this in a PR to the homeassistant docker would most likely be accepted. Another option in fully manual is to use For pyscript installed, the simplest solution is to have a user editable requirements.txt file. Pyscript could scan this before starting up and ensure all modules were installed. An even better solution would involve special variables in the py files to indicate that modules are needed and pyscript code to check it and ensure it happens. As far as version mismatches go, I don't think there is a solution other than "defer to Home Assistant". Anything else could potentially lead to a broken Home Assistant. |
I haven't tested this yet, but I looked into this and put together what I think would allow this to work for The logic here is that when loading scripts (either on initial setup or on reload), Thoughts? |
I haven't check all of the code, but this approach seems pretty straight forward and lets code already in HASS core do the heavy lifting which is nice. |
I went through some iterations of testing and I'm pretty satisfied with the approach after some tweaks. I would like to add some tests at some point but I am going to go ahead and submit a PR to get Craig's feedback |
tests added! |
I love that
pyscript
lets you import any package to use in automations, but I am somewhat limited in the packages I can use because I run HomeAssistant in a Docker container, and I would have to either manually install the packages each time I rebuilt the container or create my ownDockerfile
that did the same. It would be great if there was a mechanism throughpyscript
to install packages if they are not found. I am not sure what the best way to achieve this would be, there are two problems to consider:manifest.json
which lists the dependent package and version.Open questions:
pyscript
deal with version mismatches between what HomeAssistant expects and whatpyscript
wants? My take is that we should always defer to HomeAssistant requirements to prevent issues with the core applicationThanks for the consideration!
The text was updated successfully, but these errors were encountered: