DEV Community

loading...

Discussion on: My Favorite CLI Tools

Collapse
mowat27 profile image
Adrian Mowat

Ah, OK. I saw a lot of places where people said it was the "right/standard" way of doing things going forward. I guess that could have been wishful thinking. My main use case is writing AWS lambda functions and I like the way I can define dev dependencies separately so they don't get packaged up with the final build and impact startup time. I've never been able to find a way to do that in a requirements.txt file though. Is there an ideomatic way to deal with this? Maybe a separate requirements file?

Thread Thread
switowski profile image
Sebastian Witowski Author

Your intuition is correct - it can be achieved through separate requirements files.
I usually have 4 of them (2 maintained by hand, 2 generated automatically):

  • requirements.in - list of packages that you want to include in the final build, e.g. "django". You can be even more specific: "django<3.0"
  • requirements.txt - pinned versions - this will be generated by the pip-tools, so you never touch this file by hand, e.g. "django==2.2.2"
  • requirements-dev.in- packages used by developers (not included in the final build), e.g.: "pytest"
  • requirements-dev.txt - pinned versions of packages for developers generated by pip-tools.

You add packages to the *.in files, generate the *.txt files with, let's say a Makefile command, and use them to install packages on the destination servers.

Thread Thread
mowat27 profile image
Adrian Mowat

Awesome! Thanks for your help. I'll definitely try this as I feel like I'm swimming against the tide with pipenv.

Forem Open with the Forem app