That's great! It could be used to avoiding needing multi stage builds in Docker when using JS frontend in a Python app. Assuming pip uninstall nodejs-bin work cleanly one also has easy way of keeping the image slim by uninstalling after frontend build.
Re:Bundling binary tools in Python wheels
by samwillis on Saturday June 18, 2022 @06:41AM
(#31788713)
Thanks!
Yes, "pip uninstall nodejs-bin" will remove the full nodejs install from your python environments site_packages. It won't remove node_packages however, you will still need to handle that yourself depending on use case.
This works particularly well in combination with Python virtual environments (or docker), it will allow you to have a specific version of Node for a particular project without additional tooling. Just add "nodejs-bin" to your requirements.txt.
You can also add it as an optional dependency on another Python package. That's my plan with the full stack Python/Django/Apline.js framework I'm building (Tetra[1]), that way users will be able to optional do this to setup the full project including Node.js:
The framework uses esbuild, and will use PostCSS. It was either package them with the framework (including Node.js), or create a way to easily install Node.js for Python developers using the tools they are most used to.It's brand new, I have only packed Node.js v16 so far. Once I'm happy there are no show stopping issues the plan is to release wheels for current+LTS Node.js versions as they come out.
Developer UX is my number one priority and removing the need for two toolchains is an important part of that.
[0]: https://pypi.org/project/nodejs-bin/
[1]: http://tetraframework.com