The Python Oracle

Should we put all required and their dependent packages on requirement.txt or only required packages

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Popsicle Puzzles

--

Chapters
00:00 Question
01:38 Accepted answer (Score 3)
02:37 Thank you

--

Full question
https://stackoverflow.com/questions/4852...

Question links:
[Document of PIP]: https://pip.pypa.io/en/stable/user_guide...

Accepted answer links:
[@Charles Duffy]: https://stackoverflow.com/users/14122/ch...
[pipenv]: https://github.com/pypa/pipenv

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #python3x #python27 #pip

#avk47



ACCEPTED ANSWER

Score 5


I digged myself a lot, and what @Charles Duffy commented above seems most proper way.

You should have two separate dependency lists: One with the dependencies a human has decided you need (which shouldn't contain transitive dependencies); one with the frozen list that reflects what you tested against (which should contain transitive dependencies)

However, Recently with the release of pipenv, I think this is the better way to keep track of dependencies.

It's like npm, much easier to maintain requirements and creating venv.

It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever–important Pipfile.lock, which is used to produce deterministic builds.