-
Notifications
You must be signed in to change notification settings - Fork 60
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 module that allows to compare versions in python #678
Add version module that allows to compare versions in python #678
Conversation
Unless, there are any major concerns here, I would like to merge this later today and make a v01-01 tag tomorrow, once the nightlies have passed. |
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.
Looks good to me.
Reading between the lines the bindings for |
Wouldn't it be enough in python to just give a version as a string? And in the client code just use |
You are correct. I didn't check whether it's actually the
We could also do that, but I am not sure how many physics users are aware of that ;) (I wasn't until an hour ago) |
I think it's just any
Fair point. It just feels like a lot of code just to wrap the |
python/podio/version.py
Outdated
@@ -1,6 +1,9 @@ | |||
#!/usr/bin/env python3 | |||
"""Module that facilitates working with the podio::version::Version""" | |||
|
|||
from functools import total_ordering | |||
from packaging import version |
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 packaging
also appear in the requirements.txt
(and readme?).
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.
Indeed it should. I though it was part of the standard library.
One other issue is that cppyy can apparently not deal with aggregate initialization, because simply doing if ROOT.gInterpreter.LoadFile("podio/podioVersion.h") == 0: # noqa: E402
from ROOT import podio # noqa: E402 # pylint: disable=wrong-import-position
Version = podio.version.Version
v = Version(1, 2, 3) leads to:
In that case, I would rather keep the c++ version unchanged and do a bit more legwork on the python side, even if we effectively just re-wrap |
Ouch, okay then 👍 |
3e8b383
to
e90fb73
Compare
I added an alternative implementation where we effectively leverage the c++ class and only add a new |
No strong preferences. This version doesn't need the |
e90fb73
to
b458e49
Compare
Dropped the commits with the changes to |
Aggregation init issue root-project/root#16469 |
BEGINRELEASENOTES
podio.version
module exposingpodio::version::Version
also in python.version_as_str
method again, since that is handled byVersion
now.ENDRELEASENOTES