docs: add example documenting pip install --target#13766
docs: add example documenting pip install --target#13766
Conversation
|
This PR only updates documentation and does not require a changelog entry. |
docs/html/cli/pip_install.rst
Outdated
There was a problem hiding this comment.
IMO, this is a bad example. It suggests that --target is suited for installing packages into an existing Python installation, and that isn't the case. The intended use for --target is in embedding scenarios, where you create a brand new, empty directory, and use pip install --target to install requirements into that directory. Your embedded application can then add the directory to the Python interpreter's path.
Using --target to install into an existing site-packages directory may work, but it's very much a "use at your own risk" scenario, and not one that we want to encourage.
There was a problem hiding this comment.
Thanks for the clarification. I've updated the example to use an initially empty
directory and clarified that the intended use case is embedding scenarios.
There was a problem hiding this comment.
Thanks, that's a lot better.
I'm still not sure we even want to make the --target option "more discoverable", to be honest. So I'll leave it up to the other maintainers to comment, and decide whether to merge this.
There was a problem hiding this comment.
What I've used --target for is creating zipapp's: https://github.com/scikit-hep/particle/blob/8ffe2da9151aedf8f15d49a07ccf3401b7815aef/noxfile.py#L55-L91 creates particle.pyz.
Basically you create a dir, install pure Python dependencies with --target, then zip it with python -m zippapp.
|
What about keeping the description simple and adding a warning? E.g. Many users are using |
|
Thanks for the suggestion. I’ve updated the section to keep the description simple and added a warning highlighting the intended use of |
|
I mean, I'm +1 on this approach as I suggested it, but I'm sure other maintainers will have thoughts about the specific wording. |
Adds a usage example for the --target flag to improve discoverability.
Fixes #12667