Skip to content

Commit 5e36700

Browse files
committed
Switch to setuptools_scm.
A few noteworthy points: - The contents in the sdist now exactly match what `git archive` would include; this avoids having to additionally keep track of things in MANIFEST.in (as noted in contributing.rst). - The `__version__` of an editable install is no longer recomputed at each import (as was done with `versioneer`, but only whenever the project is (re)installed; this can actually save quite a bit of time when working with many editable installs as each version recomputation requires shelling out a subprocess. (If really wanted we could keep the old behavior by optionally adding a runtime dependency on setuptools_scm and calling `setuptools_scm.get_version` in `matplotlib/__init__.py`.)
1 parent 8768aec commit 5e36700

13 files changed

+26
-2215
lines changed

.flake8

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ exclude =
3535
doc/gallery
3636
doc/tutorials
3737
# External files.
38-
versioneer.py
3938
tools/gh_api.py
4039
tools/github_stats.py
4140
.tox

.git_archival.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref-names: $Format:%D$

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
*.ppm binary
33
*.svg binary
44
*.svg linguist-language=true
5-
lib/matplotlib/_version.py export-subst
5+
.git_archival.txt export-subst

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pip-wheel-metadata/*
4242
# tox testing tool
4343
.tox
4444
setup.cfg
45+
# generated by setuptools_scm
46+
lib/matplotlib/_version.py
4547

4648
# OS generated files #
4749
######################

MANIFEST.in

-23
This file was deleted.

doc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _check_dependencies():
196196
try:
197197
SHA = subprocess.check_output(
198198
['git', 'describe', '--dirty']).decode('utf-8').strip()
199-
# Catch the case where git is not installed locally, and use the versioneer
199+
# Catch the case where git is not installed locally, and use the setuptools_scm
200200
# version number instead
201201
except (subprocess.CalledProcessError, FileNotFoundError):
202202
SHA = matplotlib.__version__

doc/devel/contributing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ New modules and files: installation
385385

386386
* If you have added new files or directories, or reorganized existing
387387
ones, make sure the new files are included in the match patterns in
388-
:file:`MANIFEST.in`, and/or in *package_data* in :file:`setup.py`.
388+
in *package_data* in :file:`setupext.py`.
389389

390390
C/C++ extensions
391391
----------------

doc/devel/release_guide.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,12 @@ Finally, push the tag to GitHub::
178178

179179
Congratulations, the scariest part is done!
180180

181-
.. [#] The tarball that is provided by GitHub is produced using `git
182-
archive <https://git-scm.com/docs/git-archive>`__. We use
183-
`versioneer <https://github.com/warner/python-versioneer>`__
184-
which uses a format string in
181+
.. [#] The tarball that is provided by GitHub is produced using `git archive`_.
182+
We use setuptools_scm_ which uses a format string in
185183
:file:`lib/matplotlib/_version.py` to have ``git`` insert a
186184
list of references to exported commit (see
187185
:file:`.gitattributes` for the configuration). This string is
188-
then used by ``versioneer`` to produce the correct version,
186+
then used by ``setuptools_scm`` to produce the correct version,
189187
based on the git tag, when users install from the tarball.
190188
However, if there is a branch pointed at the tagged commit,
191189
then the branch name will also be included in the tarball.
@@ -197,6 +195,8 @@ Congratulations, the scariest part is done!
197195
198196
git archive v2.0.0 -o matplotlib-2.0.0.tar.gz --prefix=matplotlib-2.0.0/
199197
198+
.. _git archive: https://git-scm.com/docs/git-archive
199+
.. _setuptools_scm: https://github.com/pypa/setuptools_scm
200200

201201
If this is a final release, also create a 'doc' branch (this is not
202202
done for pre-releases)::

lib/matplotlib/__init__.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@
111111

112112
import numpy
113113

114-
# Get the version from the _version.py versioneer file. For a git checkout,
114+
# Get the version from the _version.py setuptools_scm file. For a git checkout,
115115
# this is computed based on the number of commits since the last tag.
116-
from ._version import get_versions
117-
__version__ = str(get_versions()['version'])
118-
del get_versions
116+
from ._version import version as __version__
119117

120118
_log = logging.getLogger(__name__)
121119

0 commit comments

Comments
 (0)