Can I use environment vars in `[pylint].args` ? ``...
# general
p
Can I use environment vars in
[pylint].args
?
Copy code
[pylint]
args = [
  "--jobs=${PYLINT_CONCURRENCY:-1}",
]
[subprocess-environment]
env_vars.add = [
  "PYLINT_CONCURRENCY",
]
It looks like I can't use shell syntax, so is there another way?
pex: error: option --jobs: invalid integer value: '${PYLINT_CONCURRENCY:-1}'
h
I'd love this feature and proposed it last year: https://github.com/pantsbuild/pants/issues/10399. Note tho that it's unlikely we would support Bash syntax w/ that default, as instead the Python code would read from
os.environ
In the meantime, you can set the option as an env var like
PANTS_PYLINT_ARGS="+[\"--jobs=${PYLINT_CONCURRENCY:-1}\"]"
(ack that is annoying to not have in a config file)
p
Hmm. OK, that can work in CI for now.
h
If you have any thoughts on this, it'd be helpful to add to https://github.com/pantsbuild/pants/issues/10399. What should happen in
pants.toml
if you specify an env var and it's not in
os.environ
? Error? Allow you to set a default with something like
${ENV_VAR:default}
?
oh you beat me to it 🙂
👍 1
p
Oh sweet. I just discovered (by surfing pylint's code) that I can use
--jobs=0
to make pylint autodetect the number of processors available.
🙌 1