Roy Menczer
Roy Menczer

Reputation: 570

How Can I generate a requirements file from Pipfile with indexes, without locking?

I want to generate a requirements.txt file from a Pipfile.

I've tried several tools that do this (pigar, pipenv-to-requirements, pipfile-requirements) but none of them address indexes

Meaning that for the following Pipfile:

[[source]] 
url = <some-url>
verify_ssl = true
name = <some-name>
[packages]
statsd = "*"
pytest = "*"

I get the following requirements file:

pytest
statsd

Instead of the expected requirements file with an index:

-i <some-url>
pytest
statsd

Another solution that was suggested to me is using "pipenv lock":

pipenv lock --requirements > requirements.txt

But this updates Pipfile.lock - which I really want to avoid

Isn't there some way to generate requirements without locking?

Upvotes: 0

Views: 2630

Answers (2)

Frank C.
Frank C.

Reputation: 8098

With pipenv version 2023.7.23

Use the requirements command.

pipenv requirements > requirements.txt

Also pipenv requirements --help for command options.

Upvotes: 4

Ash
Ash

Reputation: 1466

pipenv lock --requirements > requirements.txt isn't working.

Error: No such option: -r

pipenv version:

bash-4.2# pipenv --version
pipenv, version 2022.9.4

Following workaround worked:

pipenv run pip freeze > requirements.txt

Upvotes: 1

Related Questions