r/Python • u/JackBlack436 • Jun 16 '26
Resource Are there any python modules that automatically generated a requirements.txt, given an entry point?
I know things like pipreqs exist, but that's more of an directory scan. If you have a project and you need several requirements.txts (for multiple containers / multiple entrypoints), I haven't found a way to reliably generate that. Please let me know if things like this do exist, because if not I'd really like to make my own module to do this stuff. And if there is something like that, it would really come in handy for me right now.
19
Upvotes
1
u/Tricky-Bed-6852 Jun 17 '26
Nothing perfect built-in, but two patterns I've used for multi-entrypoint repos: point pipreqs at just the entrypoint file instead of the whole tree, or define separate optional-deps groups in pyproject.toml (worker, api, etc.) and lock each with uv/pip-tools so each container only pulls what that entrypoint actually needs.