-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add version info to druid package and use it for CLI version output #50
Conversation
And use this attribute in the CLI when using "druid --version""
"setuptools_scm", | ||
"setuptools_scm_git_archive", |
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.
We need to have these installed at runtime as well, otherwise the detection isn't possible.
Not super happy about that but if you want runtime detection there isn't really another option. We can of course discuss if we want/need runtime detection, but personally I quiet like it if we ask someone for some info for a bug that we know that something might or might not have been changed,
@@ -0,0 +1 @@ | |||
.git_archival.txt export-subst |
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.
This is some git "magic" that processes the file on the left using the attribute on the right.
export-subst
basically substitutes some placeholders, see https://git-scm.com/docs/gitattributes#_creating_an_archive for more details.
The result is something like
ref-names: HEAD -> add-version-info, tag: 0.1.3, origin/add-version-info
This looks good to me, and I don't mind the extra packages now that we're using an automated setup with pip. I can't really comment on the implementation, but it's at least terse and reads cleanly to the uninitiated (read: myself). Perhaps you could add a section to the readme which describes the necessary steps to make a new release? I know it's going to be automated at some point, but would be good to document the current situation. |
Good point! I'll add that tomorrow. |
@simonvanderveldt lmk what I can do to test this out and then let's check it in! |
@trentgill I don't expect it to behave differently on different OSes but if you could give it a spin on Mac OS and Windows that would be nice (although @csboling might do that as well) |
Tested all my systems and it seems to be working well! Merging now. |
I just learned like seven new things about pip and git from trying to understand how this works, awesome. Very tidy solution! |
This uses https://pypi.org/project/setuptools-scm/ + https://pypi.org/project/setuptools-scm-git-archive/ which is a bit "magic", but from my testing this is the only way to get the version automatically with the following criteria:
git tag
dev
should be shownSome output examples:
And when making a release archive (which is what GitHub does):
And when installing from this archive
@csboling what do you think?
Fixes #29