Anyone run into this before using the docker backe...
# general
w
Anyone run into this before using the docker backend (and nothing else)? Feels weird that running hadolint would force me to specify interpreter_constraints (I mean, my guess is that something in the docker backend activates the python backend - but this isn't ideal)
Copy code
Engine traceback:
  in `lint` goal

OptionsError: You must explicitly specify the default Python interpreter versions your code is intended to run against.

You specify these interpreter constraints using the `interpreter_constraints` option in the `[python]` section of pants.toml.

We recommend constraining to a single interpreter minor version if you can, e.g., `interpreter_constraints = ['==3.11.*']`, or at least a small number of interpreter minor versions, e.g., `interpreter_constraints = ['>=3.10,<3.12']`.

Individual targets can override these default interpreter constraints, if different parts of your codebase run against different python interpreter versions in a single repo.

See <https://www.pantsbuild.org/2.21/docs/python/overview/interpreter-compatibility> for details.
Copy code
backend_packages = [
    "pants.backend.docker",
    "pants.backend.docker.lint.hadolint",
]
My off-the-cuff guess is due to something using a pex, but I would have thought that maybe internal-only tooling could use the scie-pants packaged interpreter
w
the dockerfile parser is a pex
w
Yeah, saw that - too bad we can't just use the pants python interpreter as a default 🤷
w
sounds reasonable to me tbh, and probably what should happen? Or how else can we provide lockfiles? I guess we just set a wide range of interpreter constraints and pray it runs
w
💯 - or do both 🙂 My logic is, while MOST people will definitely use this with Python - I don't think we want to enforce python work unnecessarily on the user. This does roll into an idea where we have the option to use Python Build Standalones to download and run, instead of system pythons (or the pyenv hook we have). In the short term, if it were possible, my gut feel is: If you don't explicitly have
python
in your pants.toml backends - we should use a default (ideally the
pants
interpreter). If you do have an explicit python backend keep the error
c
it's one of the things we want to address in the next version of the python backend. It's also come up in the context of the number of python-specific rules (lockfiles, export) that end up pulled in by every backend that uses a helper pex
💯 1