Reputation: 2247
The Azure Pipeline example shows using pip to install requirements.
https://learn.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops
- script: pip install -r requirements.txt
displayName: 'Install requirements'
The long awaited pip -p
is not available, so what is a Pythonista to do when you've been using pipenv
and you have Pipfile
and Pipfile.lock
but no requirements.txt
?
Upvotes: 3
Views: 4023
Reputation: 11
Pipenv -r option works only with version "2022.7.24". -r option deprecated in the latest pipenv versions.
Use pipenv==2022.7.24 to fix the -r command option.
python -m pip install pipenv==2022.7.24
python -m pipenv lock -r > requirements.txt
pip install -r requirements.txt
Upvotes: 1
Reputation: 9521
You should be able to use pipenv
directly.
- script: pip install pipenv
displayName: 'Making sure pipenv is installed'
- script: python -m pipenv install
displayName: 'Installing dependencies'
If your Pipfile
is not located in the top level of your repo, you will need to specify the workingDirectory
to where it is located.
- script: python -m pipenv install
workingDirectory: path/to/Pipfile
Upvotes: 2
Reputation: 2247
Yes you can. First generate a requirements.txt and then install from it.
- script: python -m pipenv lock -r > requirements.txt
displayName: 'Create requirements.txt from Pipfile'
- script: pip install -r requirements.txt
displayName: 'Install requirements.txt'
After I posted my question, I found the pipenv lock -r
in the docs.
https://pipenv.kennethreitz.org/en/latest/advanced/#generating-a-requirements-txt
Upvotes: 6