Skip to content

Commit

Permalink
Merge pull request #1160 from zbruick/scm
Browse files Browse the repository at this point in the history
Switch versioning to setuptools_scm from versioneer
  • Loading branch information
dopplershift authored Sep 21, 2019
2 parents b71e3db + b082bc9 commit b6cd88f
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 2,515 deletions.
5 changes: 4 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
image: Visual Studio 2019
clone_depth: 5

environment:
Expand All @@ -16,6 +17,8 @@ install:
# Use the pre-installed Miniconda for the desired arch
- ps: if($env:PYTHON_VERSION -eq '3.6')
{ $env:CONDA_PATH="$($env:CONDA_PATH)36" }
- ps: if($env:PYTHON_VERSION -eq '3.7')
{ $env:CONDA_PATH="$($env:CONDA_PATH)37" }
- ps: if($env:PLATFORM -eq 'x64')
{ $env:CONDA_PATH="$($env:CONDA_PATH)-x64" }
- ps: $env:path="$($env:CONDA_PATH);$($env:CONDA_PATH)\Scripts;$($env:CONDA_PATH)\Library\bin;C:\cygwin\bin;$($env:PATH)"
Expand All @@ -39,7 +42,7 @@ build: off

test_script:
- cmd: set TEST_DATA_DIR=%APPVEYOR_BUILD_FOLDER%\\staticdata
- cmd: python setup.py test --addopts "-s --junitxml=tests.xml --flake8 --mpl --cov=metpy -W error::metpy.deprecation.MetpyDeprecationWarning"
- cmd: pytest -s --junitxml=tests.xml --flake8 --mpl --cov=metpy -W error::metpy.deprecation.MetpyDeprecationWarning
- cmd: cd docs
- cmd: make overridecheck html
- cmd: cd ..
Expand Down
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
paths:
- ./venv
key: v1-dependencies-{{ checksum "setup.py" }}

# run tests!
- run:
name: run tests
command: |
. venv/bin/activate
python setup.py test --addopts "-s --flake8 --mpl"
pytest -s --flake8 --mpl
- store_artifacts:
path: test-reports
Expand Down
2 changes: 0 additions & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,5 @@ plugins:
enabled: false

exclude_patterns:
- "versioneer.py"
- "metpy/_version.py"
- "metpy/io/_nexrad_msgs/msg*.py"
- "docs/**/*"
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
metpy/_version.py export-subst

*.ipynb diff=jupyternotebook
talks/* linguist-documentation
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.coverage.*
.cache
.pytest_cache
pip-wheel-metadata/

.ipynb_checkpoints/

Expand Down
27 changes: 0 additions & 27 deletions .landscape.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .lgtm.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
path_classifiers:
generated:
- metpy/_version.py
library:
- versioneer.py
- metpy/deprecation.py
test:
- exclude: metpy/testing.py
3 changes: 0 additions & 3 deletions .stickler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@ linters:
flake8:
ignore: 'F405'
max-line-length: 95
files:
ignore:
- 'metpy/_version.py'
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ matrix:
before_install:
# We hard-code the sphinx_rtd_theme to lock in our build with patch for
# version chooser
- pip install --upgrade pip;
- pip install --upgrade setuptools;
- python -m pip install --upgrade pip;
- if [[ ! -f $HOME/local/lib/libproj.so ]]; then
wget http://download.osgeo.org/proj/proj-4.9.3.tar.gz;
tar xf proj-4.9.3.tar.gz;
Expand Down Expand Up @@ -113,17 +112,19 @@ before_install:
fi;
fi;
- mkdir $WHEELDIR;
# These need to be downloaded because when we run builds later we disable the index
- python -m pip download -d $WHEELDIR -f $WHEELHOUSE setuptools wheel setuptools_scm;
# Cython needs to be installed before even downloading CartoPy
- pip install Cython;
- pip download -d $WHEELDIR ".[$EXTRA_INSTALLS]" $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- python -m pip install Cython;
- python -m pip download -d $WHEELDIR ".[$EXTRA_INSTALLS]" $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- touch $WHEELDIR/download_marker && ls -lrt $WHEELDIR;
- travis_wait pip wheel -w $WHEELDIR $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- pip install $EXTRA_PACKAGES --upgrade --upgrade-strategy=eager --no-index -f file://$PWD/$WHEELDIR $VERSIONS;
- travis_wait 30 pip wheel -w $WHEELDIR ".[$EXTRA_INSTALLS]" $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- travis_wait python -m pip wheel -w $WHEELDIR $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- python -m pip install $EXTRA_PACKAGES --upgrade --upgrade-strategy=eager --no-index -f file://$PWD/$WHEELDIR $VERSIONS;
- travis_wait 30 python -m pip wheel -w $WHEELDIR ".[$EXTRA_INSTALLS]" $EXTRA_PACKAGES -f $WHEELHOUSE $PRE $VERSIONS;
- rm -f $WHEELDIR/MetPy*.whl;

install:
- pip install ".[$EXTRA_INSTALLS]" --upgrade --upgrade-strategy=eager --no-index $PRE -f file://$PWD/$WHEELDIR $VERSIONS;
- python -m pip install ".[$EXTRA_INSTALLS]" --upgrade --upgrade-strategy=eager --no-index $PRE -f file://$PWD/$WHEELDIR $VERSIONS;

script:
- if [[ $TASK == "docs" ]]; then
Expand All @@ -144,7 +145,7 @@ script:
fi;
else
flake8 --version;
python setup.py test --addopts "$TEST_OUTPUT_CONTROL $TEST_OPTS";
python -m pytest $TEST_OUTPUT_CONTROL $TEST_OPTS;
fi

after_script:
Expand Down
20 changes: 3 additions & 17 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
include README.rst
include CITATION.txt
include AUTHORS.txt
include LICENSE
include CONTRIBUTING.md
include versioneer.py
include metpy/_version.py
include metpy/static-data-manifest.txt
recursive-include examples *.py *.txt
recursive-include tutorials *.py *.txt
recursive-include docs *
prune docs/build
prune docs/examples
prune docs/tutorials
prune docs/api/generated
prune **/__pycache__
exclude .ipynb_checkpoints/*
prune staticdata
prune talks
exclude docs/_static/*.pdf
25 changes: 10 additions & 15 deletions docs/infrastructureguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ information on how we manage MetPy and the infrastructure behind it.
Versioning
----------

To manage identifying the version of the code, MetPy relies upon `versioneer
<https://github.com/warner/python-versioneer>`_. ``versioneer`` takes the current version of
the source from git tags and any additional commits. For development, the version will have a
string like ``0.1.1+76.g136e37b.dirty``, which comes from ``git describe``. This version means
that the current code is 76 commits past the 0.1.1 tag, on git hash ``136e37b``, with local
changes on top (indicated by ``dirty``). For a release, or non-git repo source dir, the version
will just come from the most recent tag (i.e. ``v0.1.1``).
To manage identifying the version of the code, MetPy relies upon `setuptools_scm
<https://github.com/pypa/setuptools_scm>`_. ``setuptools_scm`` takes the current version of the
source from git tags and any additional commits. For development, the version will have a
string like ``0.10.0.post209+gff2e549f.d20190918``, which comes from ``git describe``. This
version means that the current code is 209 commits past the 0.10.0 tag, on git hash
``gff2e549f``, with local changes on top, last made on a date (indicated by ``d20190918``). For
a release, or non-git repo source dir, the version will just come from the most recent tag
(i.e. ``v0.10.0``).

To make a new version, simply add a new tag with a name like ``vMajor.Minor.Bugfix`` and push
to GitHub. Github will add a new release with a source archive.zip file. Running
Expand All @@ -26,12 +27,6 @@ to GitHub. Github will add a new release with a source archive.zip file. Running
will build a new source distribution with the appropriately generated version file as well.
This will also create a new stable set of documentation.

``versioneer`` is installed in the base of the repository. To update, install the latest copy
using ``pip install versioneer``. Then recreate the ``_version.py`` file using:

.. parsed-literal::
python setup.py versioneer
-------------
Documentation
-------------
Expand Down Expand Up @@ -91,8 +86,8 @@ distribution and wheels, and upload them to PyPI.

To build and upload manually (if for some reason it is necessary):

1. Do a pull locally to grab the new tag. This will ensure that ``versioneer`` will give you
the proper version.
1. Do a pull locally to grab the new tag. This will ensure that ``setuptools_scm`` will give
you the proper version.
2. (optional) Perform a ``git clean -f -x -d`` from the root of the repository. This will
**delete** everything not tracked by git, but will also ensure clean source distribution.
``MANIFEST.in`` is set to include/exclude mostly correctly, but could miss some things.
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:
- pytest-cov
- pytest-flake8
- pytest-mpl
- pytest-runner
- flake8-builtins!=1.4.0
- flake8-comprehensions=1.4.1
- flake8-copyright
Expand All @@ -37,3 +36,4 @@ dependencies:
- doc8
- m2r
- pooch>=0.1
- setuptools_scm
8 changes: 4 additions & 4 deletions metpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015 MetPy Developers.
# Copyright (c) 2015,2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for reading, calculating, and plotting with weather data."""
Expand All @@ -11,10 +11,10 @@
# Must occur before below imports
warnings.filterwarnings('ignore', 'numpy.dtype size changed')

from ._version import get_versions # noqa: E402
from ._version import get_version # noqa: E402
from .xarray import * # noqa: F401, F403
__version__ = get_versions()['version']
del get_versions
__version__ = get_version()
del get_version

try:
# Added in Python 3.2, will log anything warning or higher to stderr
Expand Down
Loading

0 comments on commit b6cd88f

Please sign in to comment.