nodejs
nodejs copied to clipboard
Install a Python interpreter at buildtime when node-gyp is used
Describe the Enhancement
I'd like to be able to use node-gyp
to install native addons to node_modules
. Some of these native addons require a Python interpreter. This will only need to be available during the build phase.
Possible Solution
This buildpack should include the cpython
buildpack as an optional buildpack in all of its order groups.
Motivation
The Paketo Base stack does not have a Python interpreter installed and so requires that I use the Full stack. I'd like to eventually see Python removed from the Full stack, and I'd like to be able to compile native addons that require Python on the current Base stack as well.
cc/ @voor
@ryanmoran if the cpython
buildpack is optional, which buildpack (if any) in nodejs build order would require it, and under what conditions?
It seems like we'd need to define both sides of the requires/provides contract, otherwise we end up with an optional buildpack that is never used. Am I missing something?
You are totally right. Its unspecified here, but the npm-install
and yarn-install
buildpacks would need to detect that node-gyp
is a dependency and that cpython
is required.
An example app that would require cpython
through node-gyp
can be found at https://github.com/Gerg/gyp-app.
@ryanmoran This issue is rather old, but still valid I guess. It sounded handy to me first, but I am not so sure about the actual value add anymore. It would only work for very specific stacks. right? For stacks NOT having python BUT a compiler chain to build the native extensions.
That is true for the base
stack, but isn't it quite specific?
And what is the difference to just use the full
stack for building, but the run
image from the base
stack? That would basically be the same right? But with some user action.