Skip to content

builder: utils.py print verbose information for run_command() - #1031

Draft
eshattow wants to merge 1 commit into
home-assistant:masterfrom
eshattow:wheelpy-util-verbose-run-command
Draft

builder: utils.py print verbose information for run_command()#1031
eshattow wants to merge 1 commit into
home-assistant:masterfrom
eshattow:wheelpy-util-verbose-run-command

Conversation

@eshattow

@eshattow eshattow commented Apr 24, 2026

Copy link
Copy Markdown
Contributor

builder: utils.py print inspect information for run_command() as group
Let's expose inspect information about the caller and callee filename and
function name in the CI/CD output for wheels builder python runtime, and
the non-static arguments presented to subprocess.run()

  • output is grouped instead of debug-only as a balance between verbosity
    and being noisy

  • output gates printing env if not empty or None due to concerns about
    leaking secrets via env

  • static arguments to subprocess.run() are not presented

Resolves: #1036

Co-Authored-By: Robert Resch robert@resch.dev

@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch 4 times, most recently from 7c030f8 to ecf405a Compare April 24, 2026 21:11
@eshattow
eshattow marked this pull request as ready for review April 24, 2026 21:13
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch from ecf405a to 1bb6f80 Compare April 28, 2026 07:30
@sairon
sairon requested a review from edenhaus April 30, 2026 11:28

@sairon sairon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already use prints for logging, so that's fine, but I'm not sure about the verbosity and potential of leaking of secrets, I'll appreciate second pair of eyes here, so added @edenhaus.

Comment thread builder/utils.py Outdated
Comment thread builder/utils.py Outdated
@home-assistant

home-assistant Bot commented May 4, 2026

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
home-assistant Bot marked this pull request as draft May 4, 2026 12:21
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch 9 times, most recently from 07ed6be to 949d6bc Compare May 11, 2026 15:24
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch 3 times, most recently from 63b3b2a to 02b677a Compare May 12, 2026 02:20
@eshattow
eshattow marked this pull request as ready for review May 12, 2026 03:30
@home-assistant
home-assistant Bot requested a review from edenhaus May 12, 2026 03:30
Comment thread builder/utils.py
Comment thread builder/utils.py Outdated
Comment on lines +49 to +51
f"{Path(*Path(stack()[1].filename).parts[-2:])}:{stack()[1].function}"
" => "
f"{Path(*Path(stack()[0].filename).parts[-2:])}:{stack()[0].function}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspect.stack is a expensive function to call and we should only call it if we really need it. So either:

  • we guard this print behind some check, that it will not be executed on each call
  • use a better grouping without using the stack
  • use debug instead grouping

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug and guarding are not useful as there is no way to discover we are being run by GitHub Actions with steps debug or not. I think Python has lazy loading so that did not make sense either. It won't hurt anything to call stack only once per invocation, so applied, thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently don't need this code, we are fine to add it if it will only be used when the action is running with debug logs enabled. We don't want to slow down each execution for logs that we currently don't need. Please don't resolve a conversation if you don't agree with the requested changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edenhaus writes:

We currently don't need this code, we are fine to add it if it will only be used when the action is running with debug logs enabled. We don't want to slow down each execution for logs that we currently don't need. Please don't resolve a conversation if you don't agree with the requested changes

(emphasis mine)

Sure, again, how exactly do you want that to be accomplished? I see no existing strategy that would allow checking within python code execution the caller GitHub Actions environment debug state, so are you having something in mind here how to do this ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I currently have no time to invest in this topic as our CI is working fine without any issues. We will not merge something that will slow down our CI if we don't need it. Therefore please come up with a proposal, that this debug code is just executed when enabled/needed. I thought about using the debug functionality of GitHub actions as it sounds like a good fit.

@home-assistant
home-assistant Bot marked this pull request as draft May 27, 2026 11:26
@eshattow
eshattow marked this pull request as ready for review May 27, 2026 18:47
@home-assistant
home-assistant Bot requested a review from edenhaus May 27, 2026 18:47
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch 2 times, most recently from 0b3fdc3 to 341b22f Compare May 28, 2026 20:24
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch from 341b22f to e427f2b Compare June 8, 2026 01:56
@eshattow

eshattow commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

rebased to master

@eshattow
eshattow requested a review from sairon June 8, 2026 02:39
@edenhaus

Copy link
Copy Markdown
Member

Drafting as requested changes are not implemented

@edenhaus
edenhaus marked this pull request as draft June 19, 2026 08:29
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch 2 times, most recently from 2f9c68f to 0ba3030 Compare June 30, 2026 02:49
Let's expose inspect information about the caller and callee filename and
function name in the CI/CD output for wheels builder python runtime, and
the non-static arguments presented to subprocess.run()

* output is grouped instead of debug-only as a balance between verbosity
  and being noisy

* output gates printing env if not empty or None due to concerns about
  leaking secrets via env

* static arguments to subprocess.run() are not presented

Co-Authored-By: Robert Resch <robert@resch.dev>
@eshattow
eshattow force-pushed the wheelpy-util-verbose-run-command branch from 0ba3030 to f7e8577 Compare July 2, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

builder: run_command() output in CI/CD

3 participants