pip
supports VCS installs, as documented in https://pip.pypa.io/en/stable/topics/vcs-support/ (related question: How can I install from a git subdirectory with pip?).
However, it seems that it's not possible to install providing the extras, i.e. the optional dependencies (as in https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies). Is this right? Is there any workaround?
As stated in https://github.com/pypa/pip/pull/11617 (tl;dr got to https://github.com/pypa/pip/pull/11617#issuecomment-1324285376), the right way to do it is
pip install "package_name[extras] @ git+https://github.com/user/project.git#subdirectory=path/to/subdir"
.
Thanks to @phd: it's answer works for the time being, but as it emerges from the referred issue discussion this is deprecated and will possibly be made into an error in next releases. The deprecation warning reads:
DEPRECATION: git+ssh://****@github.com/... contains an egg fragment with a non-PEP 508 name pip 25.0 will enforce this behaviour change. A possible replacement is to use the req @ url syntax, and remove the egg fragment. Discussion can be found at https://github.com/pypa/pip/issues/11617
.