I'm running into a weird issue trying to modify th...
# development
h
I'm running into a weird issue trying to modify the repl integration tests in this draft PR for adding ipython support: https://github.com/pantsbuild/pants/pull/9171
in the test, but not when I'm actually running the
repl
goal, it seems like
PythonToolBase.get_entry_point
on the
IPython
subsystem is failing because there's no
entry_point
option on the Subsystem
I can't figure out where this is supposed to get initialized
h
Try declaring
subsystem_rule(IPython)
in
src/python/pants/backend/python/rules/repl.py
. I think the only reason this works in production is that
IPython
is registered as a global subsystem in V1
h
ok will try that
I guess subsystem registration doesn't pay attention to --(no)-v1
ah, no, that has the same problem
I added a println in
PythonToolBase.get_entry_point
that is saying that the result of
get_options
in the test is a
_FakeOptionValues
and then immeidately afterwards
get_entry_point
blows up because
entry_point
doesn't exist on that object
I don't know if the problem is that we're using the fake option in the test, or if that's fine and the problem is that the fake option class isn't getting initialized with
entry_point
oh but requesting the subsytem as an input to the rule does solve the problem
although I have no idea why
should we just avoid invoking
global_instance
in v2 `@rule`s?
h
should we just avoid invoking global_instance in v2 @rules?
yes, you should. That is a V1 idiom that reaches into global state. In V2, you should explicitly declare that you have a dependency on that subsystem
👍 1
h
I wonder if we could add some kind of check in v2 rules that makes sure we're not doing this