Arnaud Lecat
Arnaud Lecat

Reputation: 33

How to update requirements?

I would like to know how to update outdated requirements with the multi requirements files setup that cookie cutter uses (base, local, etc...) ?

If i launch a "pip freeze" it will write the requirements in a single file. It will not dispatch them in correct files

Do I miss something ?

Upvotes: 3

Views: 3616

Answers (2)

ikreb
ikreb

Reputation: 2775

You could update all outdated python modules with this command:

Linux:

pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U 

Windows (Powershell):

pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

After this you have to update your requirements.txt with:

pip freeze > requirements.txt

If you use Pipenv:

pipenv shell
pipenv update

If you use poetry:

poetry self show --outdated
poetry update

If you use pip-tools:

pip-compile --upgrade --dry-run
pip-compile --upgrade

Upvotes: 2

Quique
Quique

Reputation: 966

pip-update-requirements updates the packages in a requirements.txt-like file (whatever its actual name is):

pip install pur
pur -r requirements/local.txt

Pur does not modify your environment or installed packages, it only modifies your requirements.txt-like file.

It will also update nested requirements files, unless otherwise indicated.

Upvotes: 1

Related Questions