-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Current Situation
Hi everyone,
first of all I want to say that I am very greatful for this amazing project. It really has changed the way I use my HomeKit home.
I am currently developing the plugin homebridge-appletv-enhanced which enables more possibilities than the vanilla integration of Apple TV into HomeKit. It is still in beta phase, but my aim is to provide a painless experience to the users from installation to initial setup to the usage. I am aiming to get this plugin verified.
The plugin is utilizing the pyatv python package because sadly there is no maintained npm packages which implements the protocol to control an Apple TV … and I know what you are thinking now … how could a plugin that is utilizing a python package provide a painless installation experience?
First, let’s talk about how easy it is for the user up until now.
- The user installs the plugin, no postinstall scripts necessary
- The user configures the plugin via the UI
- The user restarts the homebridge
- The plugin starts (PythonChecker.ts)
a. The plugin checks if a supported Python version is installed
b. The plugin checks if the python packagevirtualenvis installed
c. The plugin creates a virtual environment in the user storage path of homebridge (if not already created)
d. The plugin installs python packages according to a requirements.txt (if requirements not already satisfied)
e. The plugin discovers devices and so on … installation complete
Since Python 3 is in the docker image, the apt package and the raspian image by default, this requirement should not be a problem.
However, now we are finally coming to the problem I currently have, in order to comply with the requirements of getting a plugin verified, the plugin is not allowed to modify the users system, which is totally understandable and right to do in my mind. So my plugin creates a virtual environment (steps c-d) in the users storage path which is allowed according to the verified requirements. The issue with that is, that many users do not have installed the python package virtualenv. There was already an issue created in my repository regarding this problem.
Proposed Change
Include the apt package python3-venv in the docker image, the raspian image and as a dependency in the apt package.
What would be the benefit?
- Plugins that depend on python packages could rely on
virtualenvbeing present. This would encourage to use virtual python environments which isolates the plugins that utilize python. - Users don‘t need to install ˋvirtualenvˋ manually
- In cases such as mine with the Apple TV plugin where there is simply no npm package which meets the needs, one can use a python package in an venv without worrying if the venv can be created or not
Wouldn‘t it be better to "just" use plain type-/javascript? Of course, but in many cases there is not the time to create complex JavaScript libraries that provide functionality that can already be provided by a well maintained python package, like in my case. When not supporting virtualenv many developers may be deterred since in the end, there will be no way of installing a plugin painlessly and complying to the verified requirements at the same time without virtualenv (when utilizing python).
Additional Context
No response