Skip to content
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

Merged
merged 2 commits into from
May 4, 2023
Merged

Update __init__.py #155

merged 2 commits into from
May 4, 2023

Conversation

sT0v
Copy link
Contributor

@sT0v sT0v commented Apr 27, 2023

Expose the imported version of hamilton.

[Short description explaining the high-level reason for the pull request]

Changes

How I tested this

Notes

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

Expose the imported version of hamilton.
Copy link
Collaborator

@elijahbenizzy elijahbenizzy left a 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:
Copy link
Collaborator

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.

@skrawcz
Copy link
Collaborator

skrawcz commented Apr 27, 2023

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 __init__?

@sT0v
Copy link
Contributor Author

sT0v commented Apr 27, 2023 via email

@skrawcz
Copy link
Collaborator

skrawcz commented Apr 27, 2023

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 __version__ let's do that and keep it as a tuple?

@elijahbenizzy
Copy link
Collaborator

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 __version__ let's do that and keep it as a tuple?

+1 for __version__ -- looking at this: https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package

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.
@skrawcz
Copy link
Collaborator

skrawcz commented May 4, 2023

@sT0v I went ahead and did the change -- thanks!

@elijahbenizzy elijahbenizzy merged commit f535025 into DAGWorks-Inc:main May 4, 2023
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.

3 participants