Closed cybe closed 3 years ago
Hi
Some time ago I've added option to print all or configured only requirements. https://github.com/zewelor/bt-mqtt-gateway/blob/master/gateway.py#L49. Its used in docker now: https://github.com/zewelor/bt-mqtt-gateway/blob/master/Dockerfile#L17 . Maybe we should check for missing dependencies, on start, to give nice error to use, that there is missing dep and install it via
pip install `./gateway.py -r configured`
Sounds good to me! I'll prepare a PR based on pkg_resources
.
Hey,
I think we should solve the issue of using pips internal API:
The official solution is to not import pip at all, but to run pip in a subprocess. Any other way is not supported and might break at any time.
However, I myself am really not a fan of installing dependencies at runtime anyway. I strictly separate installation from runtime. So I would advocate for a solution that eliminates runtime dependency installation all together. Not sure how that should be approached in a usable way yet, just want to hear your thoughts on this first.