Please sign in to comment.
Add pants_runtime_python_version global option (#7363)
### Problem As discussed in pantsbuild/setup#30, we decided to add support for using Python 3 to every day user's setup script `./pants` by having them pin the interpreter version they want to use in `pants.ini`, and then grepping that value to choose the relevant interpreter. However, this currently results in this error: ``` ERROR] Invalid option 'pants_runtime_python_version' under [GLOBAL] in /Users/eric/DocsLocal/code/projects/setup/pants.ini Exception caught: (<class 'pants.option.config.ConfigValidationError'>) Exception message: Invalid config entries detected. See log for details on which entries to update or remove. (Specify --no-verify-config to disable this check.) ``` ### Solution Exactly how we handle `--pants-version`, introduce a new global option `--pants-runtime-python-version` that allows users to set `pants_runtime_python_version` in their `pants.ini`. Even though Pants code cannot dynamically change the interpreter it runs with—as it is too late to change the interpreter once the process is already running—we can check that Pants is running with the intended interpreter and print a helpful message if it is not. You can leave off the option, and you'll get no runtime check. Setup scripts are free to implement Python interpreter resolution in another way if they prefer. ### Result * Including `pants_runtime_python_version` in `pants.ini` no longer results in an error. * Running `./pants --pants-runtime-python-version=2.6` will error out. Running `./pants2 --pants-runtime-python-version=2.7` will work normally.
- Loading branch information...
Showing with 38 additions and 6 deletions.