fix: Usage of __main__.py is not idiomatic#144
Merged
mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom Mar 13, 2025
Merged
fix: Usage of __main__.py is not idiomatic#144mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom
mwiebe merged 1 commit intoOpenJobDescription:mainlinefrom
Conversation
In https://docs.python.org/3/library/__main__.html#main-py-in-python-packages it says: > The content of __main__.py typically isn’t fenced with an > if __name__ == '__main__' block. Instead, those files are kept > short and import functions to execute from other modules. > Those other modules can then be easily unit-tested and are properly reusable. and later > This won’t work for __main__.py files in the root directory of a .zip file > though. Hence, for consistency, a minimal __main__.py without a __name__ > check is preferred. In the last release, we updated __main__.py to be idiomatic, but missed that the pyproject.toml file required the script to be non-idiomatic. This fix corrects usage in pyproject.toml. Signed-off-by: Mark Wiebe <399551+mwiebe@users.noreply.github.com>
|
AWS-Samuel
approved these changes
Mar 13, 2025
epmog
approved these changes
Mar 13, 2025
leongdl
approved these changes
Mar 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes: #143
What was the problem/requirement? (What/Why)
In https://docs.python.org/3/library/__main__.html#main-py-in-python-packages it says:
and later
In the last release, we updated
__main__.pyto be idiomatic, but missed that the pyproject.toml file required the script to be non-idiomatic.What was the solution? (How)
This fix corrects usage in pyproject.toml to be idiomatic.
What is the impact of this change?
Using the
openjdcommand should no longer run it twice.How was this change tested?
I ran
hatch buildto create a .whl. Installed that .whl into a virtual environment, and confirmed the resultingopenjdcommand worked as expected.Was this change documented?
N/A
Is this a breaking change?
No
Does this change impact security?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.