brash-glass-61350
12/17/2024, 5:45 PMelegant-florist-94385
12/17/2024, 6:13 PMrequirements-production.txt
to represent explicitly removing some dependencies (compared to the requirements-research.txt
)?
I ask because my gut instinct is that you would be fine with just 1 requirements file. Anything pants does (builds, tests, etc.) will only need/use those dependencies that are actually required.
Typically, the main reasons to use multiple requirements files (or lockfiles) are:
1. You have projects that use the same 3rd party dependency, but cannot use the same version. You need a requirements file for each, (and then specify which lockfile each of your source files is designed to work with)
2. You are in the "one lockfile" situation, but you need to actively prevent some projects from using certain dependencies. These projects need to be linked to their own lockfile that does not contain those dependencies.
So in your case, I don't think you need requirements-production.txt
if you don't want some particular experiment to use numpy
(to choose a random example), then just don't import numpy
, and then the build won't have numpy
If you want your build to fail because someone accidentally imported numpy
(or imported some common file that imports something that eventually imports numpy
) then you might need to consider having a separate requirements-production.txt
elegant-florist-94385
12/17/2024, 6:14 PMbrash-glass-61350
12/17/2024, 7:06 PMrequirements.txt
file. They need these dependencies to run experiments (that also interact with the production code).
However, as they add more and more dependencies, it becomes harder to add/update dependencies in production - all because some random package used in a couple of jupyter notebooks uses itbrash-glass-61350
12/17/2024, 7:07 PMelegant-florist-94385
12/17/2024, 8:04 PMresolve=parametrize(...)
to declare that it must work with both resolves. This will make pants lint/test/mypy/etc. these files twice, to make sure they work with both resolveselegant-florist-94385
12/17/2024, 8:05 PMbrash-glass-61350
12/18/2024, 8:34 AMelegant-florist-94385
12/18/2024, 12:36 PMcareful-address-89803
12/18/2024, 11:32 PMpython_requirements.resolve
field for production, and then have other python_requirements
for the/each research resolve. I think something like this should work:
python_requirements(name="all", source="requirements.txt", resolve=parametrize("prod", "research"))
python_requirements(name="research", source="requirements_research.txt", resolve="research")
elegant-florist-94385
12/19/2024, 10:46 AMresearch
resolve gets all the standard requirements, and`requirements_research.txt` only needs to specfiy requirements above and beyond those, correct?careful-address-89803
12/19/2024, 9:44 PMresearch
resolve every time someone adds something or you update one of the core packages, so I think you might spend the same amount of time locking things...brash-glass-61350
12/20/2024, 6:31 PM