Symlinking is the preferred way as it keeps all references alive, but purelibs effectively mean that
the inner folder representing the package is the one that matters. With symlinks, the content of the
package is duplicated when some functionality that doesn't support it (e.g. creating a layer with
rules_docker).
As a specific example, this patch reduces the external layer of an image depending on TensorFlow
from 2G (537M compressed) to 1.2G (335M compressed) because the heavy library isn't included twice.
Symlinking is the preferred way as it keeps all references alive, but purelibs effectively mean that the inner folder representing the package is the one that matters. With symlinks, the content of the package is duplicated when some functionality that doesn't support it (e.g. creating a layer with rules_docker).
As a specific example, this patch reduces the external layer of an image depending on TensorFlow from 2G (537M compressed) to 1.2G (335M compressed) because the heavy library isn't included twice.