https://pantsbuild.org/ logo
#general
Title
# general
p

proud-dentist-22844

05/12/2021, 5:06 AM
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

hundreds-father-404

05/12/2021, 5:13 AM
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

proud-dentist-22844

05/12/2021, 5:25 AM
Hmm. OK, that can work in CI for now.
h

hundreds-father-404

05/12/2021, 5:27 AM
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

proud-dentist-22844

05/12/2021, 5:43 AM
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
3 Views