Skip to content

Versioneer #2163

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

Merged
merged 5 commits into from
May 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# reduce the number of merge conflicts
doc/whats-new.rst merge=union
xarray/_version.py export-subst
28 changes: 12 additions & 16 deletions HOW_TO_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ Time required: about an hour.
2. Look over whats-new.rst and the docs. Make sure "What's New" is complete
(check the date!) and add a brief summary note describing the release at the
top.
3. Update the version in setup.py and switch to `ISRELEASED = True`.
4. If you have any doubts, run the full test suite one final time!
3. If you have any doubts, run the full test suite one final time!
py.test
5. On the master branch, commit the release in git:
4. On the master branch, commit the release in git:
git commit -a -m 'Release v0.X.Y'
6. Tag the release:
5. Tag the release:
git tag -a v0.X.Y -m 'v0.X.Y'
7. Build source and binary wheels for pypi:
6. Build source and binary wheels for pypi:
python setup.py bdist_wheel sdist
8. Use twine to register and upload the release on pypi. Be careful, you can't
7. Use twine to register and upload the release on pypi. Be careful, you can't
take this back!
twine upload dist/xarray-0.X.Y*
You will need to be listed as a package owner at
https://pypi.python.org/pypi/xarray for this to work.
9. Push your changes to master:
8. Push your changes to master:
git push upstream master
git push upstream --tags
9. Update the stable branch (used by ReadTheDocs) and switch back to master:
Expand All @@ -32,25 +31,22 @@ Time required: about an hour.
It's OK to force push to 'stable' if necessary.
We also update the stable branch with `git cherrypick` for documentation
only fixes that apply the current released version.
10. Revert ISRELEASED in setup.py back to False. Don't change the version
number: in normal development, we keep the version number in setup.py as the
last released version.
11. Add a section for the next release (v.X.(Y+1)) to doc/whats-new.rst.
12. Commit your changes and push to master again:
10. Add a section for the next release (v.X.(Y+1)) to doc/whats-new.rst.
11. Commit your changes and push to master again:
git commit -a -m 'Revert to dev version'
git push upstream master
You're done pushing to master!
13. Issue the release on GitHub. Click on "Draft a new release" at
12. Issue the release on GitHub. Click on "Draft a new release" at
https://github.com/pydata/xarray/releases and paste in the latest from
whats-new.rst.
14. Update the docs. Login to https://readthedocs.org/projects/xray/versions/
13. Update the docs. Login to https://readthedocs.org/projects/xray/versions/
and switch your new release tag (at the bottom) from "Inactive" to "Active".
It should now build automatically.
15. Update conda-forge. Clone https://github.com/conda-forge/xarray-feedstock
14. Update conda-forge. Clone https://github.com/conda-forge/xarray-feedstock
and update the version number and sha256 in meta.yaml. (On OS X, you can
calculate sha256 with `shasum -a 256 xarray-0.X.Y.tar.gz`). Submit a pull
request (and merge it, once CI passes).
16. Issue the release announcement! For bug fix releases, I usually only email
15. Issue the release announcement! For bug fix releases, I usually only email
[email protected]. For major/feature releases, I will email a broader
list (no more than once every 3-6 months):
[email protected], [email protected],
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ recursive-include doc *
prune doc/_build
prune doc/generated
global-exclude .DS_Store
include versioneer.py
include xarray/_version.py
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
# built documents.
#
# The short X.Y version.
version = xarray.version.short_version
version = xarray.__version__.split('+')[0]
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the one change that worries me. It is possible people were relying on the xarray.version module...

Copy link
Member

Choose a reason for hiding this comment

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

If they were... then they will have to fix up their code.

# The full version, including alpha/beta/rc tags.
release = xarray.__version__

Expand Down
4 changes: 4 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ Enhancements
behavior when dimensions are not specified (previously this raised an error).
By `Stephan Hoyer <https://github.com/shoyer>`_

- Xarray now uses `Versioneer <https://github.com/warner/python-versioneer>`__
to manage its version strings. (:issue:`1300`).
By `Joe Hamman <https://github.com/jhamman>`_.

Bug fixes
~~~~~~~~~

Expand Down
11 changes: 11 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ exclude=
default_section=THIRDPARTY
known_first_party=xarray
multi_line_output=4

[versioneer]
VCS = git
style = pep440
versionfile_source = xarray/_version.py
versionfile_build = xarray/_version.py
tag_prefix =
parentdir_prefix = xarray-

[aliases]
test = pytest
87 changes: 3 additions & 84 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/usr/bin/env python
import os
import re
import sys
import warnings

from setuptools import find_packages, setup

MAJOR = 0
MINOR = 10
MICRO = 4
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
QUALIFIER = ''
import versioneer


DISTNAME = 'xarray'
Expand Down Expand Up @@ -65,83 +57,10 @@
- SciPy2015 talk: https://www.youtube.com/watch?v=X0pAhJgySxk
""" # noqa

# Code to extract and write the version copied from pandas.
# Used under the terms of pandas's license, see licenses/PANDAS_LICENSE.
FULLVERSION = VERSION
write_version = True

if not ISRELEASED:
import subprocess
FULLVERSION += '.dev'

pipe = None
for cmd in ['git', 'git.cmd']:
try:
pipe = subprocess.Popen(
[cmd, "describe", "--always", "--match", "v[0-9]*"],
stdout=subprocess.PIPE)
(so, serr) = pipe.communicate()
if pipe.returncode == 0:
break
except BaseException:
pass

if pipe is None or pipe.returncode != 0:
# no git, or not in git dir
if os.path.exists('xarray/version.py'):
warnings.warn(
"WARNING: Couldn't get git revision,"
" using existing xarray/version.py")
write_version = False
else:
warnings.warn(
"WARNING: Couldn't get git revision,"
" using generic version string")
else:
# have git, in git dir, but may have used a shallow clone (travis does
# this)
rev = so.strip()
# makes distutils blow up on Python 2.7
if sys.version_info[0] >= 3:
rev = rev.decode('ascii')

if not rev.startswith('v') and re.match("[a-zA-Z0-9]{7,9}", rev):
# partial clone, manually construct version string
# this is the format before we started using git-describe
# to get an ordering on dev version strings.
rev = "v%s+dev.%s" % (VERSION, rev)

# Strip leading v from tags format "vx.y.z" to get th version string
FULLVERSION = rev.lstrip('v')

# make sure we respect PEP 440
FULLVERSION = FULLVERSION.replace("-", "+dev", 1).replace("-", ".")

else:
FULLVERSION += QUALIFIER


def write_version_py(filename=None):
cnt = """\
version = '%s'
short_version = '%s'
"""
if not filename:
filename = os.path.join(
os.path.dirname(__file__), 'xarray', 'version.py')

a = open(filename, 'w')
try:
a.write(cnt % (FULLVERSION, VERSION))
finally:
a.close()


if write_version:
write_version_py()

setup(name=DISTNAME,
version=FULLVERSION,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license=LICENSE,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
Expand Down
Loading