hundreds-father-404
10/29/2020, 4:19 PMhundreds-father-404
10/29/2020, 4:28 PMawait Get(Pex, PexFromTargetsRequest.for_requirements). See https://github.com/pantsbuild/pants/blob/c98ee3696818bc9945968ba94a14180d9466a6e7/src/python/pants/backend/python/goals/pytest_runner.py#L122-L126 as an example, although you’ll want to put all of the specified_addresses in for_requirements() method call, not just one like this example does.
This will grab all relevant 3rd party reqs for that code and create a Pex with it for you. If you have a constraints file set up, this same requirements.pex will be reused across test, run, repl, etc.
Then, you need to add the arguments ["--pex-path", requirements_pex.output_filename] to the PexRequest to create your Jupyter Pex. https://github.com/pantsbuild/pants/blob/c98ee3696818bc9945968ba94a14180d9466a6e7/src/python/pants/backend/python/goals/pytest_runner.py#L148-L149. This tells Pex to ~merge the two PEX files at runtime.
(In the example, we’re saying the more verbose requirements_pex_request.input.output_filename - this is because we haven’t yet called await with the Get(Pex, PexFromTargetsRequest). The requirements_pex_request has the type Get, rather than the type Pex. So we need to unwrap that Get.)jolly-midnight-72759
10/29/2020, 7:00 PMjolly-midnight-72759
10/29/2020, 7:00 PMEngine traceback:
in select
in jupyter.goal.jupyter
in pants.backend.python.util_rules.pex.create_pex
in pants.backend.python.util_rules.pex_from_targets.pex_from_targets
in pants.engine.internals.graph.transitive_targets
in pants.engine.internals.graph.resolve_targets
in pants.engine.internals.graph.resolve_unexpanded_targets
Traceback (no traceback):
<pants native internals>
Exception: WithDeps(Inner(InnerEntry { params: {Addresses}, rule: Task(Task { product: UnexpandedTargets, can_modify_workunit: false, clause: [Addresses], gets: [Get { output: WrappedTarget, input: Address }], func: pants.engine.internals.graph:177:resolve_unexpanded_targets(), cacheable: true, display_info: DisplayInfo { name: "pants.engine.internals.graph.resolve_unexpanded_targets", desc: None, level: Trace } }) })) did not declare a dependency on JustGet(Get { output: WrappedTarget, input: Addresses })hundreds-father-404
10/29/2020, 7:01 PMGet are off. Are you using Get(WrappedTarget, Address) somewhere?hundreds-father-404
10/29/2020, 7:02 PMjolly-midnight-72759
10/29/2020, 7:02 PMWrappedTarget anywhere in my codejolly-midnight-72759
10/29/2020, 7:04 PMjolly-midnight-72759
10/29/2020, 7:04 PMtransitive_targets = await Get(
TransitiveTargets, TransitiveTargetsRequest(all_specified_addresses)
)hundreds-father-404
10/29/2020, 7:05 PMjolly-midnight-72759
10/29/2020, 7:05 PMawait Get before the `await MultiGet that builds the digests that will become the pexhundreds-father-404
10/29/2020, 7:06 PMPexFromTargetsRequest.for_requirements(
[all_specified_addresses], internal_only=True
)
Remove the []. all_specified_addresses is already an iterable, and you’re accidentally wrapping it in a list again so it’s a nested list, which breaks thingsjolly-midnight-72759
10/29/2020, 7:09 PMrequest.field_set.address is not a list. Got itjolly-midnight-72759
10/29/2020, 7:09 PMhundreds-father-404
10/29/2020, 7:12 PMGood eye!The error message is horrible. We have an issue to fix it, which I think I may be able to knock out soon. But FYI I found this by looking at this part of the stacktrace:
in pants.backend.python.util_rules.pex.create_pex
in pants.backend.python.util_rules.pex_from_targets.pex_from_targets
in pants.engine.internals.graph.transitive_targets
So I suspected something was off with the PexFromTargets part of the code, and voilajolly-midnight-72759
10/29/2020, 7:14 PMjolly-midnight-72759
10/29/2020, 7:15 PMhundreds-father-404
10/29/2020, 7:16 PMjolly-midnight-72759
10/29/2020, 7:16 PM