How to log to stdout from build hooks? #3777
Replies: 1 comment 2 replies
|
TL;DR — Two separate things: (1) your Why you see “no dice” Practical fixes
If stderr + no capture still shows nothing, it’s worth opening an issue on pdm-backend with a tiny repro: that’s when we’d confirm whether a first-class “reporter” hook exists for progress lines versus errors. Happy to help turn this into a short doc PR for the hooks page once you settle on a pattern that works for you. |
Uh oh!
There was an error while loading. Please reload this page.
Hello everyone! I don't think this quite justifies an issue and is probably just me missing something when reading the code, but my question is pretty simple - I want to log messages from build hooks to notify the builder of progress (and, ideally, to just pass through stdout from the commands invoked), but can't quite figure out how to do that.
So I have a pretty simple build hook, where i want to build some JS components and bundle them in with my python package. I am just invoking vite as a subprocess, which puts them in
package/src/_jspdm_build.pybut no dice, i get just the normal build output
When what I would like is this
I was looking through the
pdm-corecode and saw that it seemed to be using a loggerpdm.termuiso i also tried thatbut that also didn't work.
Bonus points would be if i could just have the stdout from the subprocess pass through entirely (just show the vite build output), but i'd settle for just being able to log my own messages.
I see the use of rich as well, but i don't want to just sort of hack around. I figure this is something that would be a general need for anyone using build hooks, so if we come up with some answer i'd be happy to write it up for the hooks docs page.
Thanks in advance everyone!
All reactions