There's scattered information in Slack, but I'm tr...
# general
a
There's scattered information in Slack, but I'm trying to make sense of it. What's the state of the art for dealing with packages that expect a dependency to be present in the environment at install or build time? Eg.
particles
expecting
numpy
in setup.py, or
torch-geometric
expecting
torch
at build time?
e
Is this a case where the package essentially has bad metadata and doesn't fully declare its dependencies? If so, you can use
python_requirements(overrides="...")
(or the similar overrides field in whatever target generator you use. https://www.pantsbuild.org/stable/reference/targets/python_requirements#overrides In short, the steps are: 1. Identify what package is needed (and version/extras/etc.) 2. Add this requirement to your project manually 3. add an override to tell pants that the
particles
requirement depends on
numpy
. Now, they should always be sandboxed together and things (should) work
a
I tried that, by setting
dependencies
in an overide but as I understand that applies to runtime deps, not buildtime. I also tried setting the
requirements
but I suspect that just replaces the package you want with the package you're setting.
Other options I've seen floating around the Slack channel include setting build-environment in pants.toml. I've seen a bunch of people with
requirements="some_address"
which I don't think is actually supported cos requirements needs to be a pip string.
e
hmm, yeah, I'm not sure about buildtime things. If that doesn't solve it at buildtime then I'm afraid I'm not too sure
a
np - Ive seen John Sirois pop up a few times to say "fork the package, build it, host a wheel" which ... I dunno, maybe that's an option, but it's a faff .