Ops, I introduced a change that breaks the toolcha...
# development
c
Ops, I introduced a change that breaks the toolchain plugin: 🧵
Copy code
File "/home/runner/.cache/pants/named_caches/pex_root/venvs/s/8b470e11/venv/lib/python3.7/site-packages/toolchain/pants/buildsense/reporter.py", line 166, in _get_run_tracker_info
    "recorded_options": run_tracker.get_options_to_record(),
  File "/home/runner/work/pants/pants/src/python/pants/goal/run_tracker.py", line 216, in get_options_to_record
    recorded_options[scope] = self._get_option_to_record(*scope_and_maybe_option)
  File "/home/runner/work/pants/pants/src/python/pants/goal/run_tracker.py", line 228, in _get_option_to_record
    scope_to_look_up, check_deprecations=False
  File "/home/runner/work/pants/pants/src/python/pants/option/option_value_container.py", line 118, in as_dict
    return {key: self.get(key) for key in self._value_map}
  File "/home/runner/work/pants/pants/src/python/pants/option/option_value_container.py", line 118, in <dictcomp>
    return {key: self.get(key) for key in self._value_map}
  File "/home/runner/work/pants/pants/src/python/pants/option/option_value_container.py", line 115, in get
    return self._get_underlying_value(key)
  File "/home/runner/work/pants/pants/src/python/pants/option/option_value_container.py", line 130, in _get_underlying_value
    raise ranked_val.error
pants.option.errors.MissingRequiredOptionError: The option --from in scope 'paths' is required.
https://github.com/pantsbuild/pants/pull/18780
There’s a number of ways to solve this that comes to mind: Pants fixes: • revert the PR • add option to
.get_safe()
an option so it doesn’t throw toolchain plugin workaround hack: • access the ranked value directly rather than go through
.get()
I think it makes more sense to fix this in Pants though..
actually, the code that “should” throw uses the
__getattr__
dunder method to get the value, so
.get()
could be made safe by default. I’ll open a PR with that.