The default value for `--build-file-imports` is `w...
# general
c
The default value for
--build-file-imports
is
warn
, what’s the reason to discourage using import in BUILD file? If I need read the environment variable (e.g. the git branch) and do different things based on if the branch is master. Something like:
Copy code
def get_version(version):
  import os
  release = os.getenv("CIRCLE_BRANCH") == "master"
  if not release:
    version += ".dev"
  return version
What is the recommended alternative?
a
Pants won’t factor that into caching; so if you run pants, change the env var, and run pants again, you may get stale results
If you’re fine with that, you can do the thing you’re doing, but in general we’d recommend using a custom pants plugin for this kind of functionality, rather than putting the logic in a BUILD file
👍 3
c
Make sense. Thanks