https://pantsbuild.org/ logo
#general
Title
# general
j

jolly-midnight-72759

10/05/2020, 10:49 PM
I'm getting a
ModuleNotFoundError: No module named 'pants.backend.python.targets'
on my branch for testing 2.0.0b3. Has this moved to
'pants.backend.python.targets_types'
?
Looks like the there are two lines where this module is imported:
from pants.backend.python.targets.python_target import PythonTarget
from pants.backend.targets.python_requirement_library import PythonRequirementLibrary
h

hundreds-father-404

10/05/2020, 10:54 PM
How is your plugin using this import?
pants.backend.python.targets*
refers to the v1 target definitions, which were deleted. If your plugin is written in v1, it’ll unfortunately need to be rewritten to v2 using the Target API and Rules API. This is the hardest part of the upgrade, unfortunately. But we are eager to help with the process
j

jolly-midnight-72759

10/05/2020, 10:55 PM
Yes. They were written in v1.
I have two plugins that need to be rewritten in v2.
One creates a goal: jupyter (allowing us to run
./pants jupyter project/src/python/myapp
and get a jupyter notebook (and server) running.
The other creates a target that uses sphinx to build our docs.
Let me look a little closer at https://www.pantsbuild.org/docs/plugins-overview and see what needs to be done.
I guess my wishful thinking that I just needed to import something different isn't coming to fruition.
h

hundreds-father-404

10/05/2020, 11:00 PM
The other creates a target that uses sphinx to build our docs
Is this plugin only creating the target type, or you also have logic to read that target and run sphinx?
j

jolly-midnight-72759

10/05/2020, 11:02 PM
The ladder. It adds all the different directories that contain Sphinx docs to the main
sources
directory and it reads the docstrings to create API docs for the different modules.
👍 1
h

hundreds-father-404

10/05/2020, 11:03 PM
No, sorry 😕 It’s a ground-up rewrite, which is why we made the hard break with 2.0. It should be much better code after, and you’ll get caching automatically without having to think about it like v1. But ack that it sucks to have to rewrite. -- Starting with the “overview” is a good idea, and then reading the Target API docs. I think you already will have created those Target API definitions in order to upgrade to 1.27 iirc, though Then proceed with Rules API concepts. For Jupyter, we have a guide for how to hook up to the
repl
goal: https://www.pantsbuild.org/docs/plugins-repl-goal. Also totally valid to have a distinct
jupyter
goal if you prefer
j

jolly-midnight-72759

10/05/2020, 11:04 PM
Using
repl
is probably acceptable to our crew. I'll investigate that first.
Thank you
More questions to come.
❤️ 1
🙂
h

hundreds-father-404

10/05/2020, 11:05 PM
It’s totally feasible to either hook up to
repl
or to use a distinct goal. Only comes down to preference for your org