Replies: 1 comment 7 replies
-
|
npm already handles this through optionalDependencies, peerDependencies, and runtime feature detection, which allows packages to adapt to different environments without adding new install syntax or increasing dependency resolution complexity. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Often I want to install a package where I wished the package declared a subset of dependencies to be installed as well.
Python and PEP 508 solves this. See also https://packaging.python.org/en/latest/specifications/dependency-specifiers/#dependency-specifiers.
An example of this can be seen here:
pip install diffusers["torch"]The
["torch"]part tells us to installdiffuserswith a subset of tools, in this case alsotorch.A real-world use case
https://github.com/socketio/socket.io/ depends on the
wspackage. But the Node.js API now includes a WebSocket implementation of its own.If I could then specify this:
I could skip that extra package and use the built-in one instead, without having to pollute my
node_modules/with unnecessary packages.Is this a good or bad idea for an RFCS?
Beta Was this translation helpful? Give feedback.
All reactions