-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update __init__.py #155
Update __init__.py #155
Conversation
Expose the imported version of hamilton.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! One quick though in the comments.
@@ -0,0 +1,6 @@ | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we output this as __version__
? Or keep it in caps...
Looking at this (old but I think still relevant, updated recently), I think we want the __version__
. Can be tuple or string 🤷. https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package.
Thanks for the PR @sT0v ! Question, what's your intended use of this? The reason I ask is, is there any reason to keep it a string? Why not just expose the tuple? E.g. you can't do string comparison properly without comparing each of components? Otherwise we technically don't need this since you could just do: from hamilton import version
print(version.VERSION) Any particular reason to pull it into |
Yeah you could also just expose the tuple.
The reason I thought to do this was in the event someone wanted to know
which version they were using. In pandas, you would just type
*pd.__version__* at the top level without knowing the package structure. Of
course, if you know where to look, it’s as easy as what you presented.
…On Thu, Apr 27, 2023 at 4:10 PM Stefan Krawczyk ***@***.***> wrote:
Thanks for the PR @sT0v <https://github.com/sT0v> !
Question, what's your intended use of this?
The reason I ask is, is there any reason to keep it a string? Why not just
expose the tuple? E.g. you can't do string comparison properly without
comparing each of components?
Otherwise we technically don't need this since you could just do:
from hamilton import versionprint(version.VERSION)
Any need to pull it, into *init*?
—
Reply to this email directly, view it on GitHub
<#155 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARDIUV5H4QJ4Q7QLU7GUGRDXDLOENANCNFSM6AAAAAAXOMKCFU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
That's fair! If the convention is |
+1 for |
This seems to be the most defactor standard way of exposing package version information.I decided to keep it as a tuple, since if you want to compare/pull things from it, it's already split into numeric numbers. There doesn't seem to be consensus here on whether it should be a string or tuple. But my guess is if you're programmatically pulling it, you'll want parse the string anyway, in which case, why translate to a string in the first place. Thanks to @sT0v for the push here.
@sT0v I went ahead and did the change -- thanks! |
Expose the imported version of hamilton.
[Short description explaining the high-level reason for the pull request]
Changes
How I tested this
Notes
Checklist