big-hamburger-40484
05/23/2025, 10:25 PMpants package <target>
that will print out the dest path without creating the package? I'm trying to integrate pants
into a workflow that needs to know where things land before running the package step.big-hamburger-40484
05/23/2025, 10:25 PMpants package <target> --output-path
or that I could extract it from pants peek
but that only gave me the template: "output_path": "${spec_path_normalized}/${target_name_normalized}${file_suffix}"
In case I missed it in the docs and it's just a funneling issue, I checked the following:
# hopefully there's an option to dry-run?
pants help-advanced package
# maybe there's a global dry-run for all goals?
pants help-advanced global
# maybe I can just pass --from=<package target> and it knows I want the output destination since it's a package?
pants help-advanced paths
command line help: https://www.pantsbuild.org/stable/docs/using-pants/command-line-help
project introspection: https://www.pantsbuild.org/stable/docs/using-pants/project-introspectionwide-midnight-78598
05/23/2025, 11:08 PMpeek
?wide-midnight-78598
05/23/2025, 11:08 PMfast-nail-55400
05/23/2025, 11:14 PMvalue_or_default
is actually called. https://github.com/pantsbuild/pants/blob/40a1e07b1a92c3220847d97bcdfbd4d7fab9a6b6/src/python/pants/core/goals/package.py#L123fast-nail-55400
05/23/2025, 11:15 PMAsyncFieldMixin
. An improvement to pants peek
would be for it to understand all of the fields which subclass AsyncFieldMixin
and know how to ask for their finalized values.fast-nail-55400
05/23/2025, 11:16 PMoutput_path
)wide-midnight-78598
05/23/2025, 11:35 PMoutput_path
, it is emitted (but not resolved... e.g. when I update it in the BUILD, it is peeked out with the same value). But, the way we make default output paths is deterministic - so a janky way would be to manually re-do some of that logic 🤮wide-midnight-78598
05/23/2025, 11:36 PMwide-midnight-78598
05/23/2025, 11:41 PMfast-nail-55400
05/23/2025, 11:42 PMissubclass(field, AsyncFieldMixin)
is true. Or maybe we have a union ResolveFieldForPeek
which peek
can use so backends can register which fields should get special treatment.fast-nail-55400
05/23/2025, 11:43 PMfast-nail-55400
05/23/2025, 11:44 PMpeek
goal to know how to do such things.big-hamburger-40484
05/23/2025, 11:44 PMpeek
and the build target used.
$ pants peek src/lambdas/widget:lambda
[
{
"address": "src/lambdas/widget:lambda",
"target_type": "python_aws_lambda_function",
"architecture": "x86_64",
"complete_platforms": null,
"dependencies": [
"src/py/corp/widget/entrypoint.py"
],
"dependencies_raw": null,
"description": null,
"environment": "__local__",
"goals": [
"package"
],
"handler": "corp.widget.entrypoint:lambda_handler",
"include_requirements": true,
"layout": "flat-zipped",
"output_path": "${spec_path_normalized}/${target_name_normalized}${file_suffix}",
"pex3_venv_create_extra_args": [],
"pex_build_extra_args": [],
"resolve": null,
"runtime": "python3.13",
"tags": null
}
]
and using this BUILD:
python_aws_lambda_function(
name="lambda",
handler="corp.widget.entrypoint:lambda_handler",
runtime="python3.13",
)
fast-nail-55400
05/23/2025, 11:45 PMbig-hamburger-40484
05/23/2025, 11:47 PMspec_path_normalized
etc. Is there something like a peek
for the global context that pants runs in?big-hamburger-40484
05/23/2025, 11:48 PMfast-nail-55400
05/23/2025, 11:48 PMspec_path_normalized
is just replacing the BUILD file's directory separators with .
fast-nail-55400
05/23/2025, 11:48 PMbig-hamburger-40484
05/23/2025, 11:50 PM