Skip to content

Conversation

@anthrotype
Copy link
Member

@anthrotype anthrotype commented Nov 20, 2025

python -m ttx_diff --help wasn't showing any flags and telling users to use --helpfull (which unhelpfully shows all absl-related flags which the user could care less).

The problem is absl-py only shows flags from the "main" module in --help. So I moved them there to make it happy and python -m ttx_diff --help finally shows our flags.

But still, when running via the installed ttx-diff entry point, because the __name__ of that one was not 'main', absl woudn't recognize it as the main module and end up showing no flags.

So I resorted to runpy.run_module which executes the main.py module with run_name="main" mimicking pyton -m module behavior.

So now both pythom -m ttx_diff --help and ttx-diff --help display all flags consistently.

I also added a --version which absl-py doesn't provide out of the box.

python -m ttx_diff --help wasn't showing any flags and telling users to
use --helfull (which unhelpfully shows all absl-related flags which the
user could care less).

The problem is absl-py only shows flags from the "__main__" module in --help.
So I moved them there to make it happy and `python -m ttx_diff --help`
finally shows our flags.

But still, when running via the installed `ttx-diff` entry point, because the
`__name__` of that one was not '__main__', absl woudn't recognize it as the
main module and end up showing no flags.

So I resorted to runpy.run_module which executes the __main__.py module
with run_name="__main__" mimicking `pyton -m module` behavior.

So now both `pythom -m ttx_diff --help` and `ttx-diff --help` display
all flags consistently.

I also added a --version which absl-py doesn't provide out of the box.
@anthrotype anthrotype added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit 3ff8f54 Nov 20, 2025
8 checks passed
@anthrotype anthrotype deleted the absl branch November 20, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants