-
Notifications
You must be signed in to change notification settings - Fork 139
Matching _version file to toml project. #940
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #940 +/- ##
==========================================
+ Coverage 72.79% 73.06% +0.26%
==========================================
Files 39 39
Lines 5675 5713 +38
==========================================
+ Hits 4131 4174 +43
+ Misses 1544 1539 -5 |
src/ansys/mapdl/core/_version.py
Outdated
|
||
# major, minor, patch | ||
version_info = 0, 60, "dev0" | ||
version_info = 0, 61, "dev0" |
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.
You might consider fetching this from the package info using importlib_metadata
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.
Agreed. @germa89, can you implement that? See:
https://github.com/pyansys/template/blob/6c53fe872f57d346f5555f2d8025c8e49b432064/src/ansys/product/library/__init__.py#L24-L29
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.
Done.
try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata
# Read from the pyproject.toml
# major, minor, patch
__version__ = importlib_metadata.version('ansys-mapdl-core')
This does not work if you change pyproject.toml
version locally and restart python. It seems it is directly linked to the version installed. I wonder who this will behave after we do a release.
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.
It seems it is directly linked to the version installed.
That's correct as the metadata is modified when installing with pip
.
Single source versioning is going to have drawbacks no matter what we choose to implement I think. Developers will be smart enough to work around this I think, but we can always revert if necessary.
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.
I felt we should have relied in directly reading the pyproject.toml
file and grabbing the version directly from there. But I didn't see any good method to reliable open that file. And everybody seems to be using this for some reason.
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.
LGTM.
As the title.