0

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?

Roy Menczer
  • 500
  • 1
  • 4
  • 11

2 Answers2

0

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
Ash
  • 1,180
  • 3
  • 22
  • 36
0

With pipenv version 2023.7.23

Use the requirements command.

pipenv requirements > requirements.txt

Also pipenv requirements --help for command options.

Frank C.
  • 7,758
  • 4
  • 35
  • 45