Home > Blockchain >  Specify minimum requirement in a python project
Specify minimum requirement in a python project

Time:12-10

I'm working on a project hosted on GitHub and I would like to specify a minimum version of a package required for the project. My current options:

  • specify the requirement in requirements.txt, but from my understanding this file is an exhaustive list provided by pip of pinned versions of packages in a working environment
  • specify the requirement in a setup.py, but this feels a lit overkill as the project I'm working on isn't intended to be published or used as a package
  • simply mention it in the README.md

Is there a more elegant way of doing it ?

CodePudding user response:

You can simply specify it in the requirements.txt file like this. In your case you would want to set a min or max on the version of SomeProject as in line 2 below.

SomeProject == 1.3
SomeProject >=1.2,<2.0
SomeProject[foo, bar]
SomeProject~=1.4.2

Read all about it here in the pip documentation.

  • Related