Working with resolves & different Python versi...
# general
h
Working with resolves & different Python versions is a bit confusing to me I've got 2 resolve files, one with py37 and the other with py38 My code supports both of them so in my
BUILD
file I did
Copy code
python_sources(
    interpreter_constraints=['>=3.7'],
    resolve=parametrize('py_37', 'py_38'),
)
but then I got this error
Copy code
The inputs use interpreter constraints (`CPython>=3.7`) that are not a subset of those used to generate the lockfile (`CPython==3.7.*`).
How can I have it support both resolve files at the same time?
1
b
Can you apply the
parametrize
to the
interpreter_constraints
field as well? Like this: https://www.pantsbuild.org/2.22/docs/python/overview/interpreter-compatibility#setting-the-default-python-version Then you could make it:
Copy code
interpreter_constraints=parametrize('==3.7.*', '==3.8.*')
Or if the second lockfile was generated with a different set of constraints, you can sub in those too
Ah, you’d have to parametrize them together: https://www.pantsbuild.org/2.22/docs/using-pants/key-concepts/targets-and-build-files#parametrizing-targets but should work aside from that
h
Thanks! That makes sense. I'll look into that and report back
Reporting back that it works Thanks!
🙌 1