Can I parameterize multiple fields in tandem? e.g....
# general
b
Can I parameterize multiple fields in tandem? e.g. parameterize `python_requirement`'s
requirements
and
modules
in tandem
h
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
Ahh I don't think two targets would be ideal in this case
h
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
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
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
interesting. we should have a tips’n tricks page for parametrizations some where..
b
This one's going in a blog, so I can point to it when we get people asking about gpu deps 😛
💯 1