Is there an alternative to pip freeze in order to keep packages up to date?

1.1k Views Asked by At

So I am setting up a Github repository with Gitpod through my Ipad. I learned I could use this command in order to easily load every requirement with the .gitpod.yml file.

pip freeze > requirements.txt

My question is: inside the requirements file, the packages are listed with their current version, but I would love them all to be of the form:

pandas==*

and not:

pandas==1.4.1

Thanks in advance for any help!

2

There are 2 best solutions below

0
On

You can do:

pip freeze | sed 's|==.*|==*|g' > requirements.txt
1
On

inside the requirements file, the packages are listed with their current version

...keep packages up to date?

Then put the entry as just pandas without any version number:

pandas

It will upgrade to the latest version whenever you do pip install --upgrade -r requirements.txt.

Note that you shouldn't do this in a production environment because it's possible for a future version to become incompatible with your current code or other libraries.