Seeking clarification on the "broken until 2.0.0 n...
# general
j
Seeking clarification on the "broken until 2.0.0 note" in https://www.pantsbuild.org/docs/target-api-extending-targets
We have a
jupyter
goal that launches a Jupyter Notebook that has access to our pants codebase. The version 1.18 of the plugin has code like the following:
Copy code
class JupyterRepl(ReplTaskMixin, PythonExecutionTaskBase):
    """ Run a pants aware jupyter notebook """
Am I correct that this plugin is not able to register in versions of pants <2.0.0?
h
No, only this specific mechanism of adding a new field to a pre-exiting target doesn’t work. That was never an option with V1 plugins - it’s a new mechanism added thanks to V2
j
doh.
I was hoping I could wait to update this plugin until 2.0.0. No excuse now. 🙂
🚧 back to figuring out how to make
Exception message: Failed to load the jupyter.register backend: ModuleNotFoundError("No module named 'pants.backend.python.python_requirement'",)
go away.
h
Cc @happy-kitchen-89482 , I’m ooo till Thursday so not able to take a closer look. But yeah, I think “extending pre-exiting target types” is a red herring. If you didn’t need it before for your Jupyter plug-in, you shouldn’t need it here. That new mechanism is mostly for when you’re adding new codegen implementations
j
This plugin worked fine under 1.18. It seems to extend
ReplTaskMixin
and
PythonExecutionTaskBase
. I think this plugin is not registering correctly.
I have another plugin for Sphinx doc that is working, so I will use that as a model to figure it out.
thank you!
h
Oh. Try importing from pants.python instead of pants.backend.python. Iirc we moved that import. If you jumped multiple versions, you’d miss the deprecation
j
That was helpful. New error now. "No module named 'pants.python.targets'"
I'll check the mailing list to see if I can find the depreciation email
🚀
Copy code
pants.backend.python.tasks.python_execution_task_base
pants.backend.python.targets.python_requirement_library
pants.backend.python.targets.python_requirement_library
Are still working in engine v1 in pants 1.25.
👍 1
h
So yeah, those are still backend.python. Only a couple things moved to python
j
keeping me on my toes!
h
Those imports will be the same until 2.0, where we delete the V1 target definitions in favor of the V2 Target API
👍🏽 1
j
I'm hoping the jump to 1.25 will be the hard part. Hoping to be at 1.30 by the end of the week. And maybe V2.
👍 1
❤️ 1
h
Please keep asking for any help that will help you to upgrade!
👖 1
j
Will do.
h
Yep, we're here to help!