pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Allow users to exclude index args when creating requirements.txt

Open kaptajnen opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe.

Currently the output of pipenv lock -r includes index arguments (e.g. -i https://somehost/simple) unconditionally (see https://github.com/pypa/pipenv/blob/d69198c0fb13a0ff92a6d105f2eb07f23ceb70b5/pipenv/core.py#L849). If you are using different repositories for your local environment and production (e.g. if you are using devpi locally), you need to manually delete those lines before deploying to production.

Describe the solution you'd like

I would like it if the inclusion of index arguments in requirements.txt was configurable, through a command-line flag or a setting in the Pipfile (or both)

Describe alternatives you've considered

An alternative would be to exclude the arguments when --pypi-mirror is set to an empty string when executing pipenv lock

kaptajnen avatar Jul 23 '20 15:07 kaptajnen

I stumble upon this problem too. By using pipenv lock -r > requirements.txt, i create this file and the 1st line has -i https://pypi.org/simple

I'm trying to create a debian package, and I'm using dh_python3 to calculate the dependencies that my package needs.

But when I execute dh_python3 --requires=requirements.txt

I get the following error:

Exception: requirement is not valid: _i https://pypi.org/simple

If I remove this line, the command works perfectly.

Enorio avatar Dec 07 '20 16:12 Enorio

For anyone else who run into this issue, I just created a small bash script that runs pipenv lock -r | sed '/^-/d' to generate the file.

kaptajnen avatar Dec 07 '20 17:12 kaptajnen

The new command for handling requirements is pipenv requirements and pipenv lock -r and install -r have been dropped. Please revisit this issue, I am willing to reopen it but I think the new requirements command does what you want.

matteius avatar Aug 17 '22 07:08 matteius

The new command has not changed this behavior so it is still required to run pipenv requirements | sed '/^-/d' to get the desired output.

kaptajnen avatar Aug 22 '22 14:08 kaptajnen

@kaptajnen would a --no-index option to the requirements command that excluded any -i <index> lines be a suitable solution?

matteius avatar Sep 03 '22 12:09 matteius