In Python’s pip, there isn’t a direct equivalent to npm install package --save-dev, because Python’s dependency management system doesn’t make a distinction between dependencies needed for development and those needed for production.
However, you can achieve a similar effect by using pip to install the package and then manually adding it to a requirements.txt file with an appropriate comment indicating that it’s a development dependency.
Here’s how you can do it:
- Install the package using
pip:
pip install package_name
- Manually add the package to your
requirements.txtfile with a comment indicating it’s for development:
package_name # for development
This way, you have a record of the package in your requirements.txt file, and it’s clear that it’s a development dependency.
When someone else wants to install the dependencies, they can run pip install -r requirements.txt, and all dependencies, including those for development, will be installed.