https://pantsbuild.org/ logo
a

average-vr-56795

04/10/2023, 7:19 AM
Aah apologies, I totally missed a dev release on Friday among Easter holiday times @ancient-vegetable-10556 What's the desired behaviour from the
EnvironmentBehavior
deprecation? Defaulting to
USES_ENVIRONMENTS
? Removing a default and requiring the property to be overridden in every
Goal
subclass?
(It looks like just removing the default is the right thing to do, but want to make sure! 🙂)
If I remove the default, I get:
Copy code
AttributeError: type object 'AccessTokenAcquisition' has no attribute 'environment_behavior'
Looks like a plugin (presumably the toolchain one) needs migrating?
h

hundreds-father-404

04/10/2023, 2:25 PM
It's okay to bump deprecations that you aren't sure how to handle. The deprecation author is supposed to remove what they deprecated
a

ancient-vegetable-10556

04/10/2023, 4:36 PM
@average-vr-56795 Yes, this is something that plugins need to opt into. The Toolchain plugin has been migrated for several months now, iirc.
a

average-vr-56795

04/10/2023, 4:51 PM
Well, uh, whatever is in pants
main
branch appears to not be working... It looks like it's using the latest release on pypi, maybe a release needs to happen?
a

ancient-vegetable-10556

04/10/2023, 4:52 PM
hrrrm, ok
a

average-vr-56795

04/10/2023, 5:12 PM
In the mean time I'll bump the deprecation; prep here: https://github.com/pantsbuild/pants/pull/18710 🙂
a

ancient-vegetable-10556

04/10/2023, 5:18 PM
@average-vr-56795 Looking at the Toolchain plugin, we should be marking the
environment_behavior
attribute correctly, and I’ve not seen a deprecation warning against
main
with the Toolchain plugin enabled for several months now. Can you dump the error you’re seeing?
a

average-vr-56795

04/10/2023, 5:27 PM
Copy code
% ./pants help                                 
19:26:45.65 [INFO] waiting for pantsd to start...
19:26:47.00 [INFO] pantsd started
19:26:50.53 [INFO] Initializing scheduler...
19:26:50.55 [ERROR] type object 'AccessTokenAcquisition' has no attribute 'environment_behavior'
Traceback (most recent call last):
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/bin/daemon_pants_runner.py", line 133, in single_daemonized_run
    scheduler, options_initializer = self._core.prepare(options_bootstrapper, complete_env)
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/pantsd/pants_daemon_core.py", line 181, in prepare
    scheduler_restart_explanation,
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/pantsd/pants_daemon_core.py", line 119, in _initialize
    raise e
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/pantsd/pants_daemon_core.py", line 110, in _initialize
    bootstrap_options, build_config, dynamic_remote_options, self._executor
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 212, in setup_graph
    is_bootstrap=is_bootstrap,
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 329, in setup_graph_extended
    QueryRule(Snapshot, [PathGlobs]),  # Used by the SchedulerService.
  File "/Users/dwh/src/github.com/pantsbuild/pants/src/python/pants/init/engine_initializer.py", line 320, in <genexpr>
    for goal_type in goal_map.values()
AttributeError: type object 'AccessTokenAcquisition' has no attribute 'environment_behavior'

Use -ldebug for more logs. 
See <https://www.pantsbuild.org/v2.17/docs/troubleshooting> for common issues.
Consider reaching out for help: <https://www.pantsbuild.org/v2.17/docs/getting-help>
a

ancient-vegetable-10556

04/10/2023, 5:31 PM
Hrrrrm, OK.
I think I see the issue. Feel free to bump the deprecation warning up to 2.17.0.dev4, and I’ll see about fixing the plugin.
a

average-vr-56795

04/10/2023, 5:33 PM
👍 Thanks!
a

ancient-vegetable-10556

04/10/2023, 7:49 PM
So the fun discovery is that a declaration of a
ClassVar
without a default doesn’t actually set the attribute. I’ve landed an update of the Toolchain plugin which will get published soonishly, and it doesn’t break when we stop setting the default.
@average-vr-56795 The Toolchain plugin is up-to-date, and I’ve assigned you a PR removing the deprecation warning