Import __version__ from package metadata to avoid mismatches#53
Import __version__ from package metadata to avoid mismatches#53LourensVeen wants to merge 1 commit into
Conversation
maarten-ic
left a comment
There was a problem hiding this comment.
doesn't work with git-flow. Or at least, it'll work for releases, but for e.g. something on develop it will give an odd version because the latest release's tag is not an ancestor.
Ah, right, that's because of the github-specific annoying thing that any merge (even if it could be a fast-forward merge) gets a merge commit.
So merging develop -> master will push a new commit onto master, which gets the tag on release. The master and develop branch are now diverged and the tag is not in the commit history on develop... 🙁
Either way: one comment on the changes, otherwise good to merge!
| This package contains all the classes needed to represent a yMMSL file, | ||
| as well as to read and write yMMSL files. | ||
| """ | ||
| import importlib |
There was a problem hiding this comment.
| import importlib | |
| import importlib.metadata |
Perhaps it now works because someone (perhaps third party dependency?) already imported the metadata submodule, but in a fresh python session this gives an error:
>>> import importlib
>>> importlib.metadata
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'importlib' has no attribute 'metadata'There was a problem hiding this comment.
Ah, thanks, I'll fix that and test it!
|
It's a git-flow thing actually, I'm doing it exactly as prescribed. Anyway, this'll work for now, and I'll fix the import, thanks! |
I tried using setuptools-scm to get the version, but it turns out that that doesn't work with git-flow. Or at least, it'll work for releases, but for e.g. something on develop it will give an odd version because the latest release's tag is not an ancestor.
I think that that could be worked around with a custom setuptools-scm plugin, but that's a bit too complicated for now.
This keeps the version in pyproject.toml and requires manual changes, but at least the
ymmsl.__version__now comes from the metadata and doesn't have to be synchronised by hand.Addresses #48