https://pantsbuild.org/ logo
#general
Title
# general
b

bitter-ability-32190

10/24/2022, 11:00 PM
Can I parameterize multiple fields in tandem? e.g. parameterize `python_requirement`'s
requirements
and
modules
in tandem
h

hundreds-father-404

10/24/2022, 11:39 PM
unfortunately no. You need to create two explicit targets Stu thought of a thing called "configurations" that would let you do it. but we didn't implement it because it wasn't clear it would be necessary and we wanted to avoid committing to a design that may be suboptimal
b

bitter-ability-32190

10/24/2022, 11:40 PM
Ahh I don't think two targets would be ideal in this case
h

hundreds-father-404

10/24/2022, 11:42 PM
how come?
Basically depending on the resolve, the
mxnet
module can come from packages
mxnet
or
mxnet-cu102
. I want only one
repository.txt
, and only one
python_requirements
target. So to get this working I'd need to parameterize
requirements
and
resolve
together in tandem. Otherwise I have to have a unique name for each
python_requrement
targets and thats nasty
c

curved-television-6568

10/25/2022, 11:19 AM
does it not work to hide
mxnet-cu102
“within”
mxnet
based on env markers in your
requirements
field, or some such? (I’ve done something like that, but likely for a easier case, in order to select which version of tensorflow to use) Ex from python_requirements overrides field:
Copy code
"tensorflow": {
            "requirements": [
                # Linux or intel Mac
                "tensorflow >= 2.9.0 ; sys_platform != 'darwin' or platform_machine == 'x86_64'",
                # Mac M1
                "tensorflow-macos >= 2.9.0 ; sys_platform == 'darwin' and platform_machine == 'arm64'",
            ],
        },
b

bitter-ability-32190

10/25/2022, 12:41 PM
Nope. Same platform/machine/etc... The only difference is whether it's compiled with/without CUDA.
FWIW I finally found a workable solution with minimal gunk
Since dependency inference looks in the same resolve, I can make a python script named "mxnet.py", it's only body is an import of mxnet, and then parameterize it. Since it has a singular name, clients can refer to it when they want to manually specify the dep. Suboptimal, but beats all the alternatives so far
👀 1
c

curved-television-6568

10/25/2022, 1:19 PM
interesting. we should have a tips’n tricks page for parametrizations some where..
b

bitter-ability-32190

10/25/2022, 1:29 PM
This one's going in a blog, so I can point to it when we get people asking about gpu deps 😛
💯 1
3 Views