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

BF - metadata version when using editable install #812

Merged
merged 4 commits into from
Nov 24, 2023

Conversation

gabknight
Copy link
Contributor

@gabknight gabknight commented Nov 22, 2023

importlib.metadata.version doesn't work for package not installed with pip, i.e. when using a local editable version (python/importlib_metadata#364)

The problem is solved by calling scilpy.version instead of metadata.version.

@arnaudbore @AlexVCaron do you see a problem with this change?

Copy link
Collaborator

@AlexVCaron AlexVCaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfect with me. I did not think of fetching the version directly from that file !

@arnaudbore
Copy link
Contributor

@arnaudbore
Copy link
Contributor

@AlexVCaron
Copy link
Collaborator

There is a missing file in MANIFEST.in, the .python-version file, which is required to import version.py. Adding it should fix the crashing tests

@gabknight
Copy link
Contributor Author

ok thx @AlexVCaron!

@arnaudbore I noticed in scilpy.version.py _version_micro is not added to __version__ if 0. For instance, the current __version__ is "1.6". If version_extra != '' and _verison_micro==0, scilpy version will be wrong: major.minor.extra.

I suggest changing the line if _version_micro: to if len(_version_micro):, producing "1.6.0" or "1.6" if _version_micro is set to ''. What do you think?

_version_major = 1
_version_minor = 6
_version_micro = 0
_version_extra = ''

# Construct full version string from these.
_ver = [_version_major, _version_minor]
if _version_micro:
    _ver.append(_version_micro)
if _version_extra:
    _ver.append(_version_extra)

__version__ = '.'.join(map(str, _ver))

@arnaudbore
Copy link
Contributor

@arnaudbore
Copy link
Contributor

@gabknight
Copy link
Contributor Author

gabknight commented Nov 24, 2023

ok... I didn't know how to have access to .python-version both through setup.py and scilpy.version, in both editable and egg installs.

I removed the PYTHON_VERSION variable from scilpy.version. It was only used in setup.py. setup.py now reads it directly from .python-version.

@arnaudbore
Copy link
Contributor

Build passed ! Good Job 🍻 !

Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTG

@arnaudbore arnaudbore merged commit fd0dda9 into scilus:master Nov 24, 2023
5 checks passed
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