I’m trying out the `adhoc_tool` for generating doc...
# general
w
I’m trying out the
adhoc_tool
for generating documentation with
pdoc
. pdoc needs the target distribution installed along with it’s deps (on top of pdoc itself) to work. pex_binary seemed to be a good way to do this, but Im probably misunderstanding how to configure this. Example:
Copy code
python_requirement(
    name='pdoc_req',
    requirements=[
       'pdoc'
    ]
)

pex_binary(
    name='pdoc_sdk',
    dependencies=[
       ':pdoc_req',
       ':dist'
    ],
    entry_point='pdoc'
)

adhoc_tool(
    name="build-pdoc",
    runnable=":pdoc_sdk",
    args=["pdoc", "-d", "google", "-o", "docs/", "src/my_package/"],
    execution_dependencies=[":dist"],
    output_files=["docs"],
    root_output_directory=".",
)

run_shell_command(
     name="run-build-pdoc",
     command="ls {chroot}/docs",
     execution_dependencies=[":build-pdoc",],
)
Doing
./pants run my_package:run-build-pdoc
yields
Copy code
Engine traceback:
  in `run` goal

ProcessExecutionFailure: Process 'the `adhoc_tool` at my_package:build-pdoc' failed with exit code 127.
stdout:

stderr:
env: python3.9: No such file or directory
:dist
is a
python_distribution
b
What version of pants are you using?
w
Trying 2.17
b
Does it work with 2.17.0.dev4? I vaguely recall some fixes that sounded similar going in recently
w
I'll give it a whirl
Trying
2.17.0.dev4
but seeing this error. Trying to get an adhoc command to work
Copy code
19:21:44.89 [DEBUG] Completed: Extracting plugin locations
19:21:44.89 [DEBUG] Completed: Scheduling: Extracting plugin locations
19:21:44.89 [DEBUG] computed 1 nodes in 0.191871 seconds. there are 73 total nodes.
19:21:45.09 [ERROR] cannot import name 'Environment' from 'pants.engine.environment' (/Users/nasron/.cache/pants/setup/bootstrap-Darwin-arm64/2.17.0.dev4_py39/lib/python3.9/site-packages/pants/engine/environment.py)
b
Do you have any custom plugins?
w
Nope, just standard ones. I can try disabling a bunch
e
The change that yanked that type is here: https://github.com/pantsbuild/pants/commit/1bced7cf2f918345f032c31f9ff3393784e6ece0 Not sure beyond that.
It first landed in 2.17.0.dev4 though.
w
Commenting out toolchain plugin fixes this (I’m evaluating). is there a newer version i should use maybe? Was
0.25.0
e
🙏 1
w
All works now! Thanks for the guidance.