-
Notifications
You must be signed in to change notification settings - Fork 303
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
Switch to setuptools_scm for automatic version numbers from git tags #856
Conversation
Codecov Report
@@ Coverage Diff @@
## master #856 +/- ##
==========================================
+ Coverage 84.09% 84.64% +0.54%
==========================================
Files 167 171 +4
Lines 24541 25048 +507
==========================================
+ Hits 20637 21201 +564
+ Misses 3904 3847 -57
Continue to review full report at Codecov.
|
@@ -66,3 +66,7 @@ htmlcov | |||
# vi / vim swp files | |||
*.swp | |||
.DS_STORE | |||
|
|||
# setuptools_scm files | |||
# this should be generated automatically when installed |
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.
Does this include python setup.py develop
?
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.
Anything that runs setup.py
should generate the necessary version files, however python setup.py X
is technically deprecated. The preferred way of installing things is pip install .
(full install) or pip install -e .
(development mode).
However-however, pip install -e .
won't work if we add a pyproject.toml
without adding a --no-use-pep517
. This is because I guess development mode is also deprecated?
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.
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.
ok, but does this version.py get generated with pip install -e .
?
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'm not sure I understand correctly, so I have a question: it looks like the version.py file is now created on installation. But what happens when devs are working on the software, is the version.py updated for every commit ?
What is supposed to happen is that version.py gets updated every time you run an installation command. This means that if you did development mode your version number in python would stick with whatever it was when you installed it (I think). This is similar to other egg-info and other package metadata that won't update unless you reinstall the package. The alternative is to have setuptools-scm check the git history every time the package is imported which can have a performance penalty. I also can't remember off hand how that works when outside of a git repository (wheel, sdist, github release tarball). |
Looks like versioneer was recomputing the version every time satpy was imported: https://github.com/pytroll/satpy/blob/master/satpy/__init__.py#L54 |
I can switch it to use |
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 mentioned in #678, we currently use versioneer to automatically figure out what the latest git tag is and provide a version number for satpy based on that. However, versioneer is unmaintained and it was suggested in pydata/xarray#2853 to switch to setuptools_scm. This PR attempts to do that.
References for things used and done in this PR:
https://pypi.org/project/setuptools-scm/
https://pypi.org/project/setuptools-scm-git-archive/
pypa/setuptools-scm#190 (comment)
A couple things to note:
0.16.2.dev1+gc4291966
) but it depends if you current directory is dirty or not. Not a huge deal, but important to note.pkg_resources
to access the installation information and get the version number for the package. It has an option to write to a file instead which should improve startup/import of the satpy package. I use this in this PR and specifically ignore adding the file (satpy/version.py
) to the repository so it is autogenerated every time.