Hi folks, I've got a question about interpreter_c...
# general
f
Hi folks, I've got a question about interpreter_constraints for tools (e.g. black) that I've found various threads/issues about but I'm not sure what the latest status is. Background The problem is that we set:
Copy code
[python]
interpreter_constraints = ["==3.10.*"]
But running
pants fmt
uses 3.9 for black. We're using ubuntu where 3.9 by default is a bit stunted (e.g. missing parts of distutils). I can fix this either by trying to make sure python3.9 has all the required pieces, or with:
Copy code
[black]
interpreter_constraints = ["==3.10.*"]
Questions 1. Is there a way to have interpreter_constraints for tools use the [python] default or are both sections needed? I've seen some work e.g. https://github.com/pantsbuild/pants/pull/18714 but not sure what the current status is. 2. What are the tools using system python for? Aren't the default tool lockfiles supposed to have everything the tools need? Is there some bootstrapping phase which uses system python libraries? Thanks!
e
I'll let other answer the rest, but for #2 you need some Python from somewhere to actually run the thing, regardless of where you get dependencies from. I.E.: when you create a venv ... that uses a Python on your system by definition.
f
Gotcha, thanks John. Why am I getting missing module errors (e.g. distutils.cmd) then? Shouldn't all the modules be installed in the environment based on the lockfile? Or is distutils a weird one where it's supposed to be a standard lib?
e
No, those are part of the Python stdlib. The Debian packaging that ships CPython is both consternating and "well known". You want to
apt install Python X.Y-distutils
.
You generally want
pythonX.Y-dev
and then others like
pythonX.Y-distutils
, etc. Now that you know Debian distros chop up CPython this way, it should yield Google hits.
f
Excellent thanks!
So now the question I have is just #1. Is there a way to specify globally that every tool should use the standard python interpreter constraints?