Repository: oturns/geosnap (language: python)

Issue:
parameterize weights in `transition`
the `Community.transition` method creates a weights object internally, but doesnt allow options to be passed (e.g. specifying the number of neighbors to a KNN weights). I think we should allow:

1. users to pass their own `W` if they want, and
2. provide a `weights_kws` argument (or similar) so users can provide additional parameters to internally-created `W`s


Discussion / hints:

Fix patch:
diff --git a/.ci/37.yml b/.ci/37.yml
index ea5c0da2..ae35d625 100644
--- a/.ci/37.yml
+++ b/.ci/37.yml
@@ -27,6 +27,7 @@ dependencies:
   - s3fs
   - botocore >=1.20.21
   - segregation >=2.0
+  - versioneer
   # testing
   - descartes
   - jupyter
diff --git a/.ci/38.yml b/.ci/38.yml
index 3dc1b055..abbbac14 100644
--- a/.ci/38.yml
+++ b/.ci/38.yml
@@ -27,6 +27,7 @@ dependencies:
   - s3fs
   - botocore >=1.20.21
   - segregation >=2.0
+  - versioneer
   # testing
   - descartes
   - jupyter
diff --git a/.ci/39.yml b/.ci/39.yml
index 15ac149c..927f8634 100644
--- a/.ci/39.yml
+++ b/.ci/39.yml
@@ -27,6 +27,7 @@ dependencies:
   - s3fs
   - botocore >=1.20.21
   - segregation >=2.0
+  - versioneer
 
   # testing
   - descartes
diff --git a/docs/api.rst b/docs/api.rst
index 47d37ed1..98e8d09d 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -49,6 +49,7 @@ It also provides a storage container `datasets` that provides access to datasets
     datasets.msa_definitions
     datasets.msas
     datasets.ncdb
+    datasets.show_data_dir
     datasets.states
     datasets.tracts_1990
     datasets.tracts_2000
@@ -188,6 +189,21 @@ Model neighborhood change using optimal-matching algorithms or spatial discrete
    analyze.sequence
    analyze.transition
 
+Segregation Dynamics Methods
+'''''''''''''''''''''''''''''''''''''''''''''
+
+Rapidly compute and compare changes in segregation measures over time and across space
+
+.. currentmodule:: geosnap.analyze
+
+.. autosummary::
+   :toctree: generated/
+   
+    segdyn.singlegroup_tempdyn
+    segdyn.multigroup_tempdyn
+    segdyn.spacetime_dyn
+
+
 .. _harmonize_api:
 
 Harmonize Module
diff --git a/environment.yml b/environment.yml
index b5c9bba4..dbeaef9b 100644
--- a/environment.yml
+++ b/environment.yml
@@ -30,5 +30,6 @@ dependencies:
   - s3fs
   - botocore >=1.20.21
   - segregation >=2.0
+  - versioneer
 
   
\ No newline at end of file
diff --git a/geosnap/__init__.py b/geosnap/__init__.py
index 3b4d9af5..3d3d45c2 100644
--- a/geosnap/__init__.py
+++ b/geosnap/__init__.py
@@ -1,4 +1,3 @@
-__version__ = "0.7.0"
 
 r"""
 
@@ -33,3 +32,6 @@
 from . import harmonize
 from ._data import datasets, _Map
 from ._community import Community
+
+from . import _version
+__version__ = _version.get_versions()['version']
diff --git a/geosnap/_community.py b/geosnap/_community.py
index fb7a5819..bd709a6c 100644
--- a/geosnap/_community.py
+++ b/geosnap/_community.py
@@ -330,13 +330,16 @@ def plot_transition_matrix(
         cluster_col=None,
         w_type="queen",
         w_options=None,
+        temporal_index="year",
+        unit_index="geoid",
+        permutations=0,
         figsize=(13, 12),
         n_rows=3,
         n_cols=3,
         suptitle=None,
+        title_kwds=None,
         savefig=None,
         dpi=300,
-        **kwargs,
     ):
         """Plot global and spatially-conditioned transition matrices as heatmaps
 
@@ -344,10 +347,21 @@ def plot_transition_matrix(
         ----------
         cluster_col : str
             column on the Community.gdf containing neighborhood type labels
-        w_type : str {'queen', 'rook'}
-            which type of libpysal spatial weights objects to encode connectivity
+        temporal_index : string, optional
+            Column defining time and or sequencing of the long-form data.
+            Default is "year".
+        unit_index : string, optional
+            Column identifying the unique id of spatial units.
+            Default is "geoid".
+        w_type : string, optional
+            Type of spatial weights type ("rook", "queen", "knn" or
+            "kernel") to be used for spatial structure. Default is
+            None, if non-spatial Markov transition rates are desired.
         w_options : dict
             additional options passed to a libpysal weights constructor (e.g. `k` for a KNN weights matrix)
+        permutations : int, optional
+            number of permutations for use in randomization based
+            inference (the default is 0).
         figsize : tuple, optional
             size of the resulting figure (13, 12)
         n_rows : int, optional
@@ -373,13 +387,16 @@ def plot_transition_matrix(
             cluster_col=cluster_col,
             w_type=w_type,
             w_options=w_options,
+            temporal_index=temporal_index,
+            unit_index=unit_index,
+            permutations=permutations,
             figsize=figsize,
             n_rows=n_rows,
             n_cols=n_cols,
             suptitle=suptitle,
+            title_kwds=title_kwds,
             savefig=savefig,
             dpi=dpi,
-            **kwargs,
         )
         return ax
 
@@ -466,8 +483,8 @@ def plot_silhouette_map(
         cmap="bwr",
         title="",
         dpi=500,
-        time_var="year",
-        id_var="geoid",
+        temporal_index="year",
+        unit_index="geoid",
         **kwargs,
     ):
         """Plot of the silhouette scores of a Community model.
@@ -498,10 +515,10 @@ def plot_silhouette_map(
         dpi        : int, optional
                      dpi of the saved image if save_fig=True
                     default is 500
-        time_var   : string, optional
+        temporal_index   : string, optional
                      the column in the community gdf that identifies time period
                      default is 'year' from US census data
-        id_var     : string, optional
+        unit_index     : string, optional
                      column in gdf that identifies geographic units
                      default is 'geoid' from US census data
         kwargs     : **kwargs, optional
@@ -528,7 +545,9 @@ def plot_silhouette_map(
                 df = df.to_crs(epsg=3857)
         if not year:
             ax[0].hist(self.models[model_name].silhouettes["silhouettes"])
-            df.join(self.models[model_name].silhouettes, on=[id_var, time_var]).plot(
+            df.join(
+                self.models[model_name].silhouettes, on=[unit_index, temporal_index]
+            ).plot(
                 "silhouettes",
                 ax=ax[1],
                 alpha=alpha,
@@ -543,7 +562,8 @@ def plot_silhouette_map(
         else:
             ax[0].hist(self.models[model_name][year].silhouettes["silhouettes"])
             df[df.year == year].join(
-                self.models[model_name][year].silhouettes, on=[id_var, time_var]
+                self.models[model_name][year].silhouettes,
+                on=[unit_index, temporal_index],
             ).plot(
                 "silhouettes",
                 ax=ax[1],
@@ -576,8 +596,8 @@ def plot_next_best_label(
         title="",
         alpha=0.5,
         dpi=500,
-        time_var="year",
-        id_var="geoid",
+        temporal_index="year",
+        unit_index="geoid",
         **kwargs,
     ):
         """Plot the nearest_labels of the community model.
@@ -605,10 +625,10 @@ def plot_next_best_label(
         dpi        : int, optional
                      dpi of the saved image if save_fig=True
                      default is 500
-        time_var   : string, optional
+        temporal_index   : string, optional
                      the column in the community gdf that identifies time period
                      default is 'year' from US census data
-        id_var     : string, optional
+        unit_index     : string, optional
                      column in gdf that identifies geographic units
                      default is 'geoid' from US census data
         kwargs     : **kwargs, optional
@@ -640,7 +660,7 @@ def plot_next_best_label(
                 df = df.to_crs(epsg=3857)
         if not year:
             temp_df = df.join(
-                self.models[model_name].nearest_labels, on=[id_var, time_var]
+                self.models[model_name].nearest_labels, on=[unit_index, temporal_index]
             )
             temp_df = temp_df[["nearest_label", "geometry", model_name]]
             temp_df.set_index(model_name, inplace=True)
@@ -658,9 +678,10 @@ def plot_next_best_label(
                 ctx.add_basemap(ax[1], source=ctxmap)
         else:
             temp_df = df.join(
-                self.models[model_name][year].nearest_labels, on=[id_var, time_var]
+                self.models[model_name][year].nearest_labels,
+                on=[unit_index, temporal_index],
             )
-            temp_df = temp_df[["nearest_label", time_var, "geometry", model_name]]
+            temp_df = temp_df[["nearest_label", temporal_index, "geometry", model_name]]
             temp_df.set_index(model_name, inplace=True)
             df[df.year == year].plot(
                 model_name, ax=ax[0], alpha=alpha, legend=True, categorical=True
@@ -697,8 +718,8 @@ def plot_path_silhouette(
         alpha=0.5,
         cmap="bwr",
         dpi=500,
-        time_var="year",
-        id_var="geoid",
+        temporal_index="year",
+        unit_index="geoid",
         **kwargs,
     ):
         """Plot the path_silhouettes of Commmunity model.
@@ -729,10 +750,10 @@ def plot_path_silhouette(
         dpi : int, optional
             dpi of the saved image if save_fig=True
             default is 500
-        time_var : string, optional
+        temporal_index : string, optional
             the column in the community gdf that identifies time period
             default is 'year' from US census data
-        id_var : string, optional
+        unit_index : string, optional
             column in gdf that identifies geographic units
             default is 'geoid' from US census data
         kwargs : **kwargs, optional
@@ -755,7 +776,8 @@ def plot_path_silhouette(
         if not year:
             ax[0].hist(self.models[model_name].path_silhouettes["path_silhouettes"])
             self.gdf.join(
-                self.models[model_name][year].path_silhouettes, on=[id_var, time_var]
+                self.models[model_name][year].path_silhouettes,
+                on=[unit_index, temporal_index],
             ).plot(
                 "path_silhouettes",
                 ax=ax[1],
@@ -773,7 +795,8 @@ def plot_path_silhouette(
                 self.models[model_name][year].path_silhouettes["path_silhouettes"]
             )
             self.gdf[self.gdf.year == year].join(
-                self.models[model_name][year].path_silhouettes, on=[id_var, time_var]
+                self.models[model_name][year].path_silhouettes,
+                on=[unit_index, temporal_index],
             ).plot(
                 "path_silhouettes",
                 ax=ax[1],
@@ -806,8 +829,8 @@ def plot_boundary_silhouette(
         alpha=0.5,
         cmap="bwr",
         dpi=500,
-        time_var="year",
-        id_var="geoid",
+        temporal_index="year",
+        unit_index="geoid",
         **kwargs,
     ):
         """Plot boundary_silhouettes of the Commiunity model.
@@ -838,10 +861,10 @@ def plot_boundary_silhouette(
         dpi        : int, optional
                      dpi of the saved image if save_fig=True
                      default is 500
-        time_var   : string, optional
+        temporal_index   : string, optional
                      the column in the community gdf that identifies time period
                      default is 'year' from US census data
-        id_var     : string, optional
+        unit_index     : string, optional
                      column in gdf that identifies geographic units
                      default is 'geoid' from US census data
         kwargs     : **kwargs, optional
@@ -871,7 +894,7 @@ def plot_boundary_silhouette(
             )
             self.gdf.join(
                 self.models[model_name][year].boundary_silhouettes,
-                on=[id_var, time_var],
+                on=[unit_index, temporal_index],
             ).plot(
                 "boundary_silhouettes",
                 ax=ax[1],
@@ -897,7 +920,7 @@ def plot_boundary_silhouette(
             )
             self.gdf[self.gdf.year == year].join(
                 self.models[model_name][year].boundary_silhouettes,
-                on=[id_var, time_var],
+                on=[unit_index, temporal_index],
             ).plot(
                 "boundary_silhouettes",
                 ax=ax[1],
@@ -1056,7 +1079,6 @@ def plot_timeseries(
                             legend=legend,
                             legend_kwds=legend_kwds,
                             alpha=alpha,
-
                         )
                     else:
                         df[df.year == year].plot(
@@ -1069,7 +1091,6 @@ def plot_timeseries(
                             legend=legend,
                             legend_kwds=legend_kwds,
                             alpha=alpha,
-
                         )
                 if ctxmap:  # need set basemap of each graph
                     ctx.add_basemap(axs[i], source=ctxmap)
@@ -1091,7 +1112,6 @@ def plot_timeseries(
                         legend=legend,
                         legend_kwds=legend_kwds,
                         alpha=alpha,
-
                     )
                 else:
                     df[df.year == year].plot(
@@ -1124,7 +1144,7 @@ def animate_timeseries(
         column=None,
         filename=None,
         title="",
-        time_col="year",
+        temporal_index="year",
         time_periods=None,
         scheme="quantiles",
         k=5,
@@ -1151,7 +1171,7 @@ def animate_timeseries(
                         output file name
         title        : str, optional
                        desired title of figure
-        time_col     : str, required
+        temporal_index     : str, required
                         column on the Community.gdf that stores time periods
         time_periods:  list, optional
                         subset of time periods to include in the animation. If None, then all times will be used
@@ -1192,14 +1212,14 @@ def animate_timeseries(
         if not gdf.crs == 3857:
             gdf = gdf.to_crs(3857)
         if not time_periods:
-            time_periods = list(gdf[time_col].unique())
+            time_periods = list(gdf[temporal_index].unique())
         time_periods = sorted(time_periods)
         with tempfile.TemporaryDirectory() as tmpdirname:
             for i, time in enumerate(time_periods):
                 fig, ax = plt.subplots(figsize=figsize)
                 outpath = PurePath(tmpdirname, f"file_{i}.png")
                 if categorical:
-                    gdf[gdf[time_col] == time].plot(
+                    gdf[gdf[temporal_index] == time].plot(
                         column,
                         categorical=True,
                         ax=ax,
@@ -1209,7 +1229,7 @@ def animate_timeseries(
                     )
                 else:
                     classifier = schemes[scheme](gdf[column].dropna().values, k=k)
-                    gdf[gdf[time_col] == time].plot(
+                    gdf[gdf[temporal_index] == time].plot(
                         column,
                         scheme="user_defined",
                         classification_kwds={"bins": classifier.bins},
@@ -1237,7 +1257,13 @@ def animate_timeseries(
             )
 
     def transition(
-        self, cluster_col, time_var="year", id_var="geoid", w_type=None, permutations=0
+        self,
+        cluster_col,
+        temporal_index="year",
+        unit_index="geoid",
+        w_type=None,
+        w_options=None,
+        permutations=0,
     ):
         """
         (Spatial) Markov approach to transitional dynamics of neighborhoods.
@@ -1248,43 +1274,45 @@ def transition(
 
         Parameters
         ----------
-        cluster_col     : string or int
-                          Column name for the neighborhood segmentation, such as
-                          "ward", "kmeans", etc.
-        time_var        : string, optional
-                          Column defining time and or sequencing of the long-form data.
-                          Default is "year".
-        id_var          : string, optional
-                          Column identifying the unique id of spatial units.
-                          Default is "geoid".
-        w_type          : string, optional
-                          Type of spatial weights type ("rook", "queen", "knn" or
-                          "kernel") to be used for spatial structure. Default is
-                          None, if non-spatial Markov transition rates are desired.
-        permutations    : int, optional
-                          number of permutations for use in randomization based
-                          inference (the default is 0).
-
+        cluster_col : string or int
+            Column name for the neighborhood segmentation, such as
+            "ward", "kmeans", etc.
+        temporal_index : string, optional
+            Column defining time and or sequencing of the long-form data.
+            Default is "year".
+        unit_index : string, optional
+            Column identifying the unique id of spatial units.
+            Default is "geoid".
+        w_type : string, optional
+            Type of spatial weights type ("rook", "queen", "knn" or
+            "kernel") to be used for spatial structure. Default is
+            None, if non-spatial Markov transition rates are desired.
+        w_options : dict
+            additional options passed to a libpysal weights constructor (e.g. `k` for a KNN weights matrix)
+        permutations : int, optional
+            number of permutations for use in randomization based
+            inference (the default is 0).
 
         Returns
         ---------
-        mar             : giddy.markov.Markov or giddy.markov.Spatial_Markov
-                          if w_type=None, return a classic Markov instance;
-                          if w_type is given, return a Spatial_Markov instance
+        mar : giddy.markov.Markov or giddy.markov.Spatial_Markov
+            if w_type=None, return a classic Markov instance;
+            if w_type is given, return a Spatial_Markov instance
 
         """
-        assert id_var in self.gdf.columns.to_list(), (
-            f"id_var: {id_var} is not in the columns."
+        assert unit_index in self.gdf.columns.to_list(), (
+            f"unit_index: {unit_index} is not in the columns."
             " Please use an appropriate index that properly identifies spatial units."
         )
 
         mar = _transition(
             self.gdf,
             cluster_col,
-            time_var=time_var,
-            id_var=id_var,
+            temporal_index=temporal_index,
+            unit_index=unit_index,
             w_type=w_type,
             permutations=permutations,
+            w_options=w_options,
         )
         return mar
 
@@ -1295,8 +1323,8 @@ def sequence(
         subs_mat=None,
         dist_type=None,
         indel=None,
-        time_var="year",
-        id_var="geoid",
+        temporal_index="year",
+        unit_index="geoid",
     ):
         """
         Pairwise sequence analysis to evaluate the distance/dissimilarity
@@ -1331,10 +1359,10 @@ def sequence(
                           transitions. Based on :cite:`Biemann:2011`.
         indel           : float, optional
                           insertion/deletion cost.
-        time_var        : string, optional
+        temporal_index   : string, optional
                           Column defining time and or sequencing of the long-form data.
                           Default is "year".
-        id_var          : string, optional
+        unit_index       : string, optional
                           Column identifying the unique id of spatial units.
                           Default is "geoid".
 
@@ -1359,8 +1387,8 @@ def sequence(
             subs_mat=subs_mat,
             dist_type=dist_type,
             indel=indel,
-            time_var=time_var,
-            id_var=id_var,
+            temporal_index=temporal_index,
+            unit_index=unit_index,
         )
         gdf_new = Community(gdf_temp)
         return gdf_new, df_wide, seq_dis_mat
@@ -1368,14 +1396,14 @@ def sequence(
     def simulate(
         self,
         model_name=None,
-        index_col="geoid",
+        unit_index="geoid",
         w_type="queen",
         w_options=None,
         base_year=2010,
         new_colname="predicted",
         increment=10,
         time_steps=3,
-        time_col="year",
+        temporal_index="year",
         seed=None,
     ):
         """Simulate community dynamics using spatial Markov transition rules.
@@ -1384,7 +1412,7 @@ def simulate(
         ----------
         model_name : [type], optional
             [description], by default None
-        index_col : str, optional
+        unit_index : str, optional
             column on the community gdf that denotes the unique index of geographic units
             for U.S. census data this is "geoid" (which is the default)
         w_type : str {'queen', 'rook'}
@@ -1400,7 +1428,7 @@ def simulate(
             number of units in each time step (e.g. for a model based on decennial census data, this is 10)
         time_steps : int, optional
             number of time periods to simulate
-        time_col : str, optional
+        temporal_index : str, optional
             column on the community gdf that denotes the time index. For builtin data, this is "year"
         seed: int, optional
             seed passed to numpy random number generator
@@ -1420,10 +1448,10 @@ def simulate(
                 w_options=w_options,
                 base_year=base_year,
                 new_colname=new_colname,
-                index_col=index_col,
+                unit_index=unit_index,
                 increment=increment,
                 time_steps=time_steps,
-                time_col=time_col,
+                temporal_index=temporal_index,
                 seed=seed,
             )
             return gdf
@@ -1435,10 +1463,10 @@ def simulate(
                 w_options=w_options,
                 base_year=base_year,
                 new_colname=new_colname,
-                index_col=index_col,
+                unit_index=unit_index,
                 increment=increment,
                 time_steps=time_steps,
-                time_col=time_col,
+                temporal_index=temporal_index,
                 seed=seed,
             )
             gdfs = pd.concat(gdfs)
diff --git a/geosnap/_data.py b/geosnap/_data.py
index 2605b3f9..92fcaab6 100644
--- a/geosnap/_data.py
+++ b/geosnap/_data.py
@@ -71,6 +71,7 @@ def __dir__(self):
             "msas",
             "ncdb",
             "states",
+            "show_data_dir"
             "tracts_1990",
             "tracts_2000",
             "tracts_2010",
@@ -78,6 +79,18 @@ def __dir__(self):
 
         return atts
 
+    def show_data_dir(self):
+        """Print the location of the local geosnap data storage directory.
+
+        Returns
+        -------
+        string
+            location of local storage directory.
+        """
+        print(data_dir)
+        return data_dir
+
+
     def acs(self, year=2018, level="tract", states=None):
         """American Community Survey Data.
 
diff --git a/geosnap/_version.py b/geosnap/_version.py
new file mode 100644
index 00000000..5b34becb
--- /dev/null
+++ b/geosnap/_version.py
@@ -0,0 +1,623 @@
+
+# This file helps to compute a version number in source trees obtained from
+# git-archive tarball (such as those provided by githubs download-from-tag
+# feature). Distribution tarballs (built by setup.py sdist) and build
+# directories (produced by setup.py build) will contain a much shorter file
+# that just contains the computed version number.
+
+# This file is released into the public domain. Generated by
+# versioneer-0.20 (https://github.com/python-versioneer/python-versioneer)
+
+"""Git implementation of _version.py."""
+
+import errno
+import os
+import re
+import subprocess
+import sys
+
+
+def get_keywords():
+    """Get the keywords needed to look up the version information."""
+    # these strings will be replaced by git during git-archive.
+    # setup.py/versioneer.py will grep for the variable names, so they must
+    # each be defined on a line of their own. _version.py will just call
+    # get_keywords().
+    git_refnames = "$Format:%d$"
+    git_full = "$Format:%H$"
+    git_date = "$Format:%ci$"
+    keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
+    return keywords
+
+
+class VersioneerConfig:  # pylint: disable=too-few-public-methods
+    """Container for Versioneer configuration parameters."""
+
+
+def get_config():
+    """Create, populate and return the VersioneerConfig() object."""
+    # these strings are filled in when 'setup.py versioneer' creates
+    # _version.py
+    cfg = VersioneerConfig()
+    cfg.VCS = "git"
+    cfg.style = "pep440"
+    cfg.tag_prefix = "v"
+    cfg.parentdir_prefix = "tobler-"
+    cfg.versionfile_source = "tobler/_version.py"
+    cfg.verbose = False
+    return cfg
+
+
+class NotThisMethod(Exception):
+    """Exception raised if a method is not valid for the current scenario."""
+
+
+LONG_VERSION_PY = {}
+HANDLERS = {}
+
+
+def register_vcs_handler(vcs, method):  # decorator
+    """Create decorator to mark a method as the handler of a VCS."""
+    def decorate(f):
+        """Store f in HANDLERS[vcs][method]."""
+        if vcs not in HANDLERS:
+            HANDLERS[vcs] = {}
+        HANDLERS[vcs][method] = f
+        return f
+    return decorate
+
+
+# pylint:disable=too-many-arguments,consider-using-with # noqa
+def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
+                env=None):
+    """Call the given command(s)."""
+    assert isinstance(commands, list)
+    process = None
+    for command in commands:
+        try:
+            dispcmd = str([command] + args)
+            # remember shell=False, so use git.cmd on windows, not just git
+            process = subprocess.Popen([command] + args, cwd=cwd, env=env,
+                                       stdout=subprocess.PIPE,
+                                       stderr=(subprocess.PIPE if hide_stderr
+                                               else None))
+            break
+        except EnvironmentError:
+            e = sys.exc_info()[1]
+            if e.errno == errno.ENOENT:
+                continue
+            if verbose:
+                print("unable to run %s" % dispcmd)
+                print(e)
+            return None, None
+    else:
+        if verbose:
+            print("unable to find command, tried %s" % (commands,))
+        return None, None
+    stdout = process.communicate()[0].strip().decode()
+    if process.returncode != 0:
+        if verbose:
+            print("unable to run %s (error)" % dispcmd)
+            print("stdout was %s" % stdout)
+        return None, process.returncode
+    return stdout, process.returncode
+
+
+def versions_from_parentdir(parentdir_prefix, root, verbose):
+    """Try to determine the version from the parent directory name.
+
+    Source tarballs conventionally unpack into a directory that includes both
+    the project name and a version string. We will also support searching up
+    two directory levels for an appropriately named parent directory
+    """
+    rootdirs = []
+
+    for _ in range(3):
+        dirname = os.path.basename(root)
+        if dirname.startswith(parentdir_prefix):
+            return {"version": dirname[len(parentdir_prefix):],
+                    "full-revisionid": None,
+                    "dirty": False, "error": None, "date": None}
+        rootdirs.append(root)
+        root = os.path.dirname(root)  # up a level
+
+    if verbose:
+        print("Tried directories %s but none started with prefix %s" %
+              (str(rootdirs), parentdir_prefix))
+    raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
+
+
+@register_vcs_handler("git", "get_keywords")
+def git_get_keywords(versionfile_abs):
+    """Extract version information from the given file."""
+    # the code embedded in _version.py can just fetch the value of these
+    # keywords. When used from setup.py, we don't want to import _version.py,
+    # so we do it with a regexp instead. This function is not used from
+    # _version.py.
+    keywords = {}
+    try:
+        with open(versionfile_abs, "r") as fobj:
+            for line in fobj:
+                if line.strip().startswith("git_refnames ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["refnames"] = mo.group(1)
+                if line.strip().startswith("git_full ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["full"] = mo.group(1)
+                if line.strip().startswith("git_date ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["date"] = mo.group(1)
+    except EnvironmentError:
+        pass
+    return keywords
+
+
+@register_vcs_handler("git", "keywords")
+def git_versions_from_keywords(keywords, tag_prefix, verbose):
+    """Get version information from git keywords."""
+    if "refnames" not in keywords:
+        raise NotThisMethod("Short version file found")
+    date = keywords.get("date")
+    if date is not None:
+        # Use only the last line.  Previous lines may contain GPG signature
+        # information.
+        date = date.splitlines()[-1]
+
+        # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
+        # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
+        # -like" string, which we must then edit to make compliant), because
+        # it's been around since git-1.5.3, and it's too difficult to
+        # discover which version we're using, or to work around using an
+        # older one.
+        date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+    refnames = keywords["refnames"].strip()
+    if refnames.startswith("$Format"):
+        if verbose:
+            print("keywords are unexpanded, not using")
+        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
+    refs = {r.strip() for r in refnames.strip("()").split(",")}
+    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
+    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
+    TAG = "tag: "
+    tags = {r[len(TAG):] for r in refs if r.startswith(TAG)}
+    if not tags:
+        # Either we're using git < 1.8.3, or there really are no tags. We use
+        # a heuristic: assume all version tags have a digit. The old git %d
+        # expansion behaves like git log --decorate=short and strips out the
+        # refs/heads/ and refs/tags/ prefixes that would let us distinguish
+        # between branches and tags. By ignoring refnames without digits, we
+        # filter out many common branch names like "release" and
+        # "stabilization", as well as "HEAD" and "master".
+        tags = {r for r in refs if re.search(r'\d', r)}
+        if verbose:
+            print("discarding '%s', no digits" % ",".join(refs - tags))
+    if verbose:
+        print("likely tags: %s" % ",".join(sorted(tags)))
+    for ref in sorted(tags):
+        # sorting will prefer e.g. "2.0" over "2.0rc1"
+        if ref.startswith(tag_prefix):
+            r = ref[len(tag_prefix):]
+            # Filter out refs that exactly match prefix or that don't start
+            # with a number once the prefix is stripped (mostly a concern
+            # when prefix is '')
+            if not re.match(r'\d', r):
+                continue
+            if verbose:
+                print("picking %s" % r)
+            return {"version": r,
+                    "full-revisionid": keywords["full"].strip(),
+                    "dirty": False, "error": None,
+                    "date": date}
+    # no suitable tags, so version is "0+unknown", but full hex is still there
+    if verbose:
+        print("no suitable tags, using unknown + full revision id")
+    return {"version": "0+unknown",
+            "full-revisionid": keywords["full"].strip(),
+            "dirty": False, "error": "no suitable tags", "date": None}
+
+
+@register_vcs_handler("git", "pieces_from_vcs")
+def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
+    """Get version from 'git describe' in the root of the source tree.
+
+    This only gets called if the git-archive 'subst' keywords were *not*
+    expanded, and _version.py hasn't already been rewritten with a short
+    version string, meaning we're inside a checked out source tree.
+    """
+    GITS = ["git"]
+    if sys.platform == "win32":
+        GITS = ["git.cmd", "git.exe"]
+
+    _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
+                   hide_stderr=True)
+    if rc != 0:
+        if verbose:
+            print("Directory %s not under git control" % root)
+        raise NotThisMethod("'git rev-parse --git-dir' returned error")
+
+    # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
+    # if there isn't one, this yields HEX[-dirty] (no NUM)
+    describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
+                                     "--always", "--long",
+                                     "--match", "%s*" % tag_prefix],
+                              cwd=root)
+    # --long was added in git-1.5.5
+    if describe_out is None:
+        raise NotThisMethod("'git describe' failed")
+    describe_out = describe_out.strip()
+    full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root)
+    if full_out is None:
+        raise NotThisMethod("'git rev-parse' failed")
+    full_out = full_out.strip()
+
+    pieces = {}
+    pieces["long"] = full_out
+    pieces["short"] = full_out[:7]  # maybe improved later
+    pieces["error"] = None
+
+    branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
+                             cwd=root)
+    # --abbrev-ref was added in git-1.6.3
+    if rc != 0 or branch_name is None:
+        raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
+    branch_name = branch_name.strip()
+
+    if branch_name == "HEAD":
+        # If we aren't exactly on a branch, pick a branch which represents
+        # the current commit. If all else fails, we are on a branchless
+        # commit.
+        branches, rc = runner(GITS, ["branch", "--contains"], cwd=root)
+        # --contains was added in git-1.5.4
+        if rc != 0 or branches is None:
+            raise NotThisMethod("'git branch --contains' returned error")
+        branches = branches.split("\n")
+
+        # Remove the first line if we're running detached
+        if "(" in branches[0]:
+            branches.pop(0)
+
+        # Strip off the leading "* " from the list of branches.
+        branches = [branch[2:] for branch in branches]
+        if "master" in branches:
+            branch_name = "master"
+        elif not branches:
+            branch_name = None
+        else:
+            # Pick the first branch that is returned. Good or bad.
+            branch_name = branches[0]
+
+    pieces["branch"] = branch_name
+
+    # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
+    # TAG might have hyphens.
+    git_describe = describe_out
+
+    # look for -dirty suffix
+    dirty = git_describe.endswith("-dirty")
+    pieces["dirty"] = dirty
+    if dirty:
+        git_describe = git_describe[:git_describe.rindex("-dirty")]
+
+    # now we have TAG-NUM-gHEX or HEX
+
+    if "-" in git_describe:
+        # TAG-NUM-gHEX
+        mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
+        if not mo:
+            # unparseable. Maybe git-describe is misbehaving?
+            pieces["error"] = ("unable to parse git-describe output: '%s'"
+                               % describe_out)
+            return pieces
+
+        # tag
+        full_tag = mo.group(1)
+        if not full_tag.startswith(tag_prefix):
+            if verbose:
+                fmt = "tag '%s' doesn't start with prefix '%s'"
+                print(fmt % (full_tag, tag_prefix))
+            pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
+                               % (full_tag, tag_prefix))
+            return pieces
+        pieces["closest-tag"] = full_tag[len(tag_prefix):]
+
+        # distance: number of commits since tag
+        pieces["distance"] = int(mo.group(2))
+
+        # commit: short hex revision ID
+        pieces["short"] = mo.group(3)
+
+    else:
+        # HEX: no tags
+        pieces["closest-tag"] = None
+        count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
+        pieces["distance"] = int(count_out)  # total number of commits
+
+    # commit date: see ISO-8601 comment in git_versions_from_keywords()
+    date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
+    # Use only the last line.  Previous lines may contain GPG signature
+    # information.
+    date = date.splitlines()[-1]
+    pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+
+    return pieces
+
+
+def plus_or_dot(pieces):
+    """Return a + if we don't already have one, else return a ."""
+    if "+" in pieces.get("closest-tag", ""):
+        return "."
+    return "+"
+
+
+def render_pep440(pieces):
+    """Build up version string, with post-release "local version identifier".
+
+    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
+    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+
+    Exceptions:
+    1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += plus_or_dot(pieces)
+            rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0+untagged.%d.g%s" % (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_branch(pieces):
+    """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .
+
+    The ".dev0" means not master branch. Note that .dev0 sorts backwards
+    (a feature branch will appear "older" than the master branch).
+
+    Exceptions:
+    1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0"
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+untagged.%d.g%s" % (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_pre(pieces):
+    """TAG[.post0.devDISTANCE] -- No -dirty.
+
+    Exceptions:
+    1: no tags. 0.post0.devDISTANCE
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += ".post0.dev%d" % pieces["distance"]
+    else:
+        # exception #1
+        rendered = "0.post0.dev%d" % pieces["distance"]
+    return rendered
+
+
+def render_pep440_post(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX] .
+
+    The ".dev0" means dirty. Note that .dev0 sorts backwards
+    (a dirty tree will appear "older" than the corresponding clean one),
+    but you shouldn't be releasing software with -dirty anyways.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%s" % pieces["short"]
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+        rendered += "+g%s" % pieces["short"]
+    return rendered
+
+
+def render_pep440_post_branch(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .
+
+    The ".dev0" means not master branch.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%s" % pieces["short"]
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+g%s" % pieces["short"]
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_old(pieces):
+    """TAG[.postDISTANCE[.dev0]] .
+
+    The ".dev0" means dirty.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+    return rendered
+
+
+def render_git_describe(pieces):
+    """TAG[-DISTANCE-gHEX][-dirty].
+
+    Like 'git describe --tags --dirty --always'.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render_git_describe_long(pieces):
+    """TAG-DISTANCE-gHEX[-dirty].
+
+    Like 'git describe --tags --dirty --always -long'.
+    The distance/hash is unconditional.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render(pieces, style):
+    """Render the given version pieces into the requested style."""
+    if pieces["error"]:
+        return {"version": "unknown",
+                "full-revisionid": pieces.get("long"),
+                "dirty": None,
+                "error": pieces["error"],
+                "date": None}
+
+    if not style or style == "default":
+        style = "pep440"  # the default
+
+    if style == "pep440":
+        rendered = render_pep440(pieces)
+    elif style == "pep440-branch":
+        rendered = render_pep440_branch(pieces)
+    elif style == "pep440-pre":
+        rendered = render_pep440_pre(pieces)
+    elif style == "pep440-post":
+        rendered = render_pep440_post(pieces)
+    elif style == "pep440-post-branch":
+        rendered = render_pep440_post_branch(pieces)
+    elif style == "pep440-old":
+        rendered = render_pep440_old(pieces)
+    elif style == "git-describe":
+        rendered = render_git_describe(pieces)
+    elif style == "git-describe-long":
+        rendered = render_git_describe_long(pieces)
+    else:
+        raise ValueError("unknown style '%s'" % style)
+
+    return {"version": rendered, "full-revisionid": pieces["long"],
+            "dirty": pieces["dirty"], "error": None,
+            "date": pieces.get("date")}
+
+
+def get_versions():
+    """Get version information or return default if unable to do so."""
+    # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
+    # __file__, we can work backwards from there to the root. Some
+    # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
+    # case we can only use expanded keywords.
+
+    cfg = get_config()
+    verbose = cfg.verbose
+
+    try:
+        return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
+                                          verbose)
+    except NotThisMethod:
+        pass
+
+    try:
+        root = os.path.realpath(__file__)
+        # versionfile_source is the relative path from the top of the source
+        # tree (where the .git directory might live) to this file. Invert
+        # this to find the root from __file__.
+        for _ in cfg.versionfile_source.split('/'):
+            root = os.path.dirname(root)
+    except NameError:
+        return {"version": "0+unknown", "full-revisionid": None,
+                "dirty": None,
+                "error": "unable to find root of source tree",
+                "date": None}
+
+    try:
+        pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+        return render(pieces, cfg.style)
+    except NotThisMethod:
+        pass
+
+    try:
+        if cfg.parentdir_prefix:
+            return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
+    except NotThisMethod:
+        pass
+
+    return {"version": "0+unknown", "full-revisionid": None,
+            "dirty": None,
+            "error": "unable to compute version", "date": None}
diff --git a/geosnap/analyze/analytics.py b/geosnap/analyze/analytics.py
index b641cb32..9293329c 100644
--- a/geosnap/analyze/analytics.py
+++ b/geosnap/analyze/analytics.py
@@ -180,8 +180,8 @@ def cluster(
     best_model=False,
     columns=None,
     verbose=False,
-    time_var="year",
-    id_var="geoid",
+    temporal_index="year",
+    unit_index="geoid",
     scaler="std",
     pooling="fixed",
     **kwargs,
@@ -203,10 +203,10 @@ def cluster(
         subset of columns on which to apply the clustering
     verbose : bool, optional
         whether to print warning messages (the default is False).
-    time_var : str, optional
+    temporal_index : str, optional
         which column on the dataframe defines time and or sequencing of the
         long-form data. Default is "year"
-    id_var : str, optional
+    unit_index : str, optional
         which column on the long-form dataframe identifies the stable units
         over time. In a wide-form dataset, this would be the unique index
     scaler : None or scaler from sklearn.preprocessing, optional
@@ -258,8 +258,8 @@ def cluster(
     if not columns:
         raise ValueError("You must provide a subset of columns as input")
 
-    times = gdf[time_var].unique()
-    gdf = gdf.set_index([time_var, id_var])
+    times = gdf[temporal_index].unique()
+    gdf = gdf.set_index([temporal_index, unit_index])
 
     # this is the dataset we'll operate on
     data = gdf.copy()[columns]
@@ -292,14 +292,18 @@ def cluster(
         labels = model.labels_.astype(str)
         data = data.reset_index()
         clusters = pd.DataFrame(
-            {model_name: labels, time_var: data[time_var], id_var: data[id_var]}
+            {
+                model_name: labels,
+                temporal_index: data[temporal_index],
+                unit_index: data[unit_index],
+            }
         )
-        clusters.set_index([time_var, id_var], inplace=True)
+        clusters.set_index([temporal_index, unit_index], inplace=True)
         clusters = clusters[~clusters.index.duplicated(keep="first")]
         gdf = gdf.join(clusters, how="left")
         gdf = gdf.reset_index()
         results = ModelResults(
-            X=data.set_index([id_var, time_var]),
+            X=data.set_index([unit_index, temporal_index]),
             columns=columns,
             labels=model.labels_,
             instance=model,
@@ -313,7 +317,7 @@ def cluster(
         data = data.reset_index()
 
         for time in times:
-            df = data[data[time_var] == time]
+            df = data[data[temporal_index] == time]
 
             model = specification[method](
                 df[columns],
@@ -325,12 +329,12 @@ def cluster(
 
             labels = model.labels_.astype(str)
             clusters = pd.DataFrame(
-                {model_name: labels, time_var: time, id_var: df[id_var]}
+                {model_name: labels, temporal_index: time, unit_index: df[unit_index]}
             )
-            clusters.set_index([time_var, id_var], inplace=True)
+            clusters.set_index([temporal_index, unit_index], inplace=True)
             gdf.update(clusters)
             results = ModelResults(
-                X=df.set_index([id_var, time_var]),
+                X=df.set_index([unit_index, temporal_index]),
                 columns=columns,
                 labels=model.labels_,
                 instance=model,
@@ -351,8 +355,8 @@ def regionalize(
     columns=None,
     threshold_variable="count",
     threshold=10,
-    time_var="year",
-    id_var="geoid",
+    temporal_index="year",
+    unit_index="geoid",
     scaler="std",
     weights_kwargs=None,
     **kwargs,
@@ -381,10 +385,10 @@ def regionalize(
         been aggregated
     threshold : numeric
         threshold to use for max-p clustering (the default is 10).
-    time_var : str
+    temporal_index : str
         which column on the dataframe defines time and or sequencing of the
         long-form data. Default is "year"
-    id_var : str
+    unit_index : str
         which column on the long-form dataframe identifies the stable units
         over time. In a wide-form dataset, this would be the unique index
     weights_kwargs : dict
@@ -435,8 +439,8 @@ def regionalize(
     if not weights_kwargs:
         weights_kwargs = {}
 
-    times = gdf[time_var].unique()
-    gdf = gdf.set_index([time_var, id_var])
+    times = gdf[temporal_index].unique()
+    gdf = gdf.set_index([temporal_index, unit_index])
 
     # this is the dataset we'll operate on
     data = gdf.copy()[columns + ["geometry"]]
@@ -456,7 +460,7 @@ def regionalize(
     # loop over each time period, standardize the data and build a weights matrix
     for time in times:
         df = data.loc[time].dropna(how="any", subset=columns).reset_index()
-        df[time_var] = time
+        df[temporal_index] = time
 
         if scaler:
             df[columns] = scaler.fit_transform(df[columns].values)
@@ -478,13 +482,17 @@ def regionalize(
 
         labels = pd.Series(model.labels_).astype(str)
         clusters = pd.DataFrame(
-            {model_name: labels, time_var: df[time_var], id_var: df[id_var]}
+            {
+                model_name: labels,
+                temporal_index: df[temporal_index],
+                unit_index: df[unit_index],
+            }
         )
-        clusters = clusters.drop_duplicates(subset=[id_var])
-        clusters.set_index([time_var, id_var], inplace=True)
+        clusters = clusters.drop_duplicates(subset=[unit_index])
+        clusters.set_index([temporal_index, unit_index], inplace=True)
         gdf.update(clusters)
         results = ModelResults(
-            X=df.set_index([id_var, time_var]).drop("geometry", axis=1),
+            X=df.set_index([unit_index, temporal_index]).drop("geometry", axis=1),
             columns=columns,
             labels=model.labels_,
             instance=model,
@@ -499,8 +507,8 @@ def regionalize(
 
 def predict_labels(
     comm,
-    index_col="geoid",
-    time_col="year",
+    unit_index="geoid",
+    temporal_index="year",
     model_name=None,
     w_type="queen",
     w_options=None,
@@ -529,11 +537,17 @@ def predict_labels(
 
     gdf = comm.gdf.copy()
     gdf = gdf.dropna(subset=[model_name]).reset_index(drop=True)
-    t = comm.transition(model_name, w_type=w_type)
+    t = comm.transition(
+        model_name,
+        w_type=w_type,
+        unit_index=unit_index,
+        temporal_index=temporal_index,
+        w_options=w_options,
+    )
 
     if time_steps == 1:
 
-        gdf = gdf[gdf[time_col] == base_year].reset_index(drop=True)
+        gdf = gdf[gdf[temporal_index] == base_year].reset_index(drop=True)
         w = Ws[w_type].from_dataframe(gdf, **w_options)
         lags = lag_categorical(w, gdf[model_name].values)
         lags = lags.astype(int)
@@ -553,7 +567,7 @@ def predict_labels(
             except:
                 labels[i] = np.random.choice(t.classes, p=t.p[cluster])
         labels = pd.Series(labels, name=new_colname)
-        out = gdf[[index_col, "geometry"]]
+        out = gdf[[unit_index, "geometry"]]
         predicted = pd.concat([labels, out], axis=1)
         return gpd.GeoDataFrame(predicted)
 
@@ -562,8 +576,8 @@ def predict_labels(
             increment
         ), "You must set the `increment` argument to simulate multiple time steps"
         predictions = []
-        gdf = gdf[gdf[time_col] == base_year]
-        gdf = gdf[[index_col, model_name, time_col, "geometry"]]
+        gdf = gdf[gdf[temporal_index] == base_year]
+        gdf = gdf[[unit_index, model_name, temporal_index, "geometry"]]
         current_time = base_year + increment
         gdf = gdf.dropna(subset=[model_name]).reset_index(drop=True)
         w = Ws[w_type].from_dataframe(gdf, **w_options)
@@ -590,8 +604,8 @@ def predict_labels(
                 except:
                     labels[i] = np.random.choice(t.classes, p=t.p[cluster])
             labels = pd.Series(labels, name=model_name)
-            out = gdf[[index_col, "geometry"]]
-            out[time_col] = current_time
+            out = gdf[[unit_index, "geometry"]]
+            out[temporal_index] = current_time
             predicted = pd.concat([labels, out], axis=1)
             predictions.append(gpd.GeoDataFrame(predicted).dropna(subset=[model_name]))
             current_time += increment
diff --git a/geosnap/analyze/dynamics.py b/geosnap/analyze/dynamics.py
index 45f86436..a156de3c 100644
--- a/geosnap/analyze/dynamics.py
+++ b/geosnap/analyze/dynamics.py
@@ -3,43 +3,62 @@
 from giddy.markov import Markov, Spatial_Markov
 from giddy.sequence import Sequence
 from libpysal.weights.contiguity import Queen, Rook
-from libpysal.weights.distance import KNN, Kernel
+from libpysal.weights.distance import KNN, Kernel, DistanceBand
+from libpysal.weights import Voronoi
 from sklearn.cluster import AgglomerativeClustering
+import geopandas as gpd
 
+Ws = {
+    "queen": Queen,
+    "rook": Rook,
+    "voronoi": Voronoi,
+    "knn": KNN,
+    "kernel": Kernel,
+    "distanceband": DistanceBand,
+}
 
 def transition(
-    gdf, cluster_col, time_var="year", id_var="geoid", w_type=None, permutations=0
+    gdf,
+    cluster_col,
+    temporal_index="year",
+    unit_index="geoid",
+    w_type="rook",
+    w_options=None,
+    permutations=0,
 ):
     """
     (Spatial) Markov approach to transitional dynamics of neighborhoods.
 
     Parameters
     ----------
-    gdf             : geopandas.GeoDataFrame or pandas.DataFrame
-                      Long-form geopandas.GeoDataFrame or pandas.DataFrame containing neighborhood
-                      attributes with a column defining neighborhood clusters.
-    cluster_col     : string or int
-                      Column name for the neighborhood segmentation, such as
-                      "ward", "kmeans", etc.
-    time_var        : string, optional
-                      Column defining time and or sequencing of the long-form data.
-                      Default is "year".
-    id_var          : string, optional
-                      Column identifying the unique id of spatial units.
-                      Default is "geoid".
-    w_type          : string, optional
-                      Type of spatial weights type ("rook", "queen", "knn" or
-                      "kernel") to be used for spatial structure. Default is
-                      None, if non-spatial Markov transition rates are desired.
-    permutations    : int, optional
-                      number of permutations for use in randomization based
-                      inference (the default is 0).
+    gdf : geopandas.GeoDataFrame or pandas.DataFrame
+        Long-form geopandas.GeoDataFrame or pandas.DataFrame containing neighborhood
+        attributes with a column defining neighborhood clusters.
+    cluster_col : string or int
+        Column name for the neighborhood segmentation, such as
+        "ward", "kmeans", etc.
+    temporal_index : string, optional
+        Column defining time and or sequencing of the long-form data.
+        Default is "year".
+    unit_index : string, optional
+        Column identifying the unique id of spatial units.
+        Default is "geoid".
+    w_type : string, optional
+        Type of spatial weights type ("rook", "queen", "knn" or
+        "kernel") to be used for spatial structure. Default is
+        None, if non-spatial Markov transition rates are desired.
+    w_options : dict
+        additional options passed to a libpysal weights constructor
+        (e.g. `k` for a KNN weights matrix)
+    permutations : int, optional
+        number of permutations for use in randomization based
+        inference (the default is 0).
 
     Returns
     --------
-    mar             : giddy.markov.Markov instance or giddy.markov.Spatial_Markov
-                      if w_type=None, a classic Markov instance is returned. 
-                      if w_type is given, a Spatial_Markov instance is returned.
+    mar : giddy.markov.Markov instance or giddy.markov.Spatial_Markov
+        if w_type=None, a classic Markov instance is returned. 
+        if w_type is given, a Spatial_Markov instance is returned.
 
     Examples
     --------
@@ -77,11 +96,15 @@ def transition(
        [0.28571429, 0.        , 0.        , 0.        , 0.        ,
         0.71428571]])
     """
-
+    if not w_options:
+        w_options = {}
+    assert (
+        unit_index in gdf.columns
+    ), f"The unit_index ({unit_index}) column is not in the geodataframe"
     gdf_temp = gdf.copy().reset_index()
-    df = gdf_temp[[id_var, time_var, cluster_col]]
+    df = gdf_temp[[unit_index, temporal_index, cluster_col]]
     df_wide = (
-        df.pivot(index=id_var, columns=time_var, values=cluster_col)
+        df.pivot(index=unit_index, columns=temporal_index, values=cluster_col)
         .dropna()
         .astype("int")
     )
@@ -89,10 +112,9 @@ def transition(
     if w_type is None:
         mar = Markov(y)  # class markov modeling
     else:
-        gdf_one = gdf_temp.drop_duplicates([id_var])
-        gdf_wide = df_wide.merge(gdf_one, left_index=True, right_on=id_var)
-        w_dict = {"rook": Rook, "queen": Queen, "knn": KNN, "kernel": Kernel}
-        w = w_dict[w_type].from_dataframe(gdf_wide)
+        geoms = gdf_temp.groupby(unit_index).first()[gdf_temp.geometry.name]
+        gdf_wide = df_wide.merge(geoms, left_index=True, right_index=True)
+        w = Ws[w_type].from_dataframe(gpd.GeoDataFrame(gdf_wide), **w_options)
         w.transform = "r"
         mar = Spatial_Markov(
             y, w, permutations=permutations, discrete=True, variable_name=cluster_col
@@ -107,8 +129,8 @@ def sequence(
     subs_mat=None,
     dist_type=None,
     indel=None,
-    time_var="year",
-    id_var="geoid",
+    temporal_index="year",
+    unit_index="geoid",
 ):
     """
     Pairwise sequence analysis and sequence clustering.
@@ -143,10 +165,10 @@ def sequence(
                       0 cost between the same type), symmetric and non-negative.
     indel           : float, optional
                       insertion/deletion cost.
-    time_var        : string, optional
+    temporal_index        : string, optional
                       Column defining time and or sequencing of the long-form data.
                       Default is "year".
-    id_var          : string, optional
+    unit_index          : string, optional
                       Column identifying the unique id of spatial units.
                       Default is "geoid".
 
@@ -180,11 +202,13 @@ def sequence(
            [5., 3., 2., 0., 0.]])
 
     """
-
+    assert (
+        unit_index in gdf.columns
+    ), f"The unit_index ({unit_index}) column is not in the geodataframe"
     gdf_temp = gdf.copy().reset_index()
-    df = gdf_temp[[id_var, time_var, cluster_col]]
+    df = gdf_temp[[unit_index, temporal_index, cluster_col]]
     df_wide = (
-        df.pivot(index=id_var, columns=time_var, values=cluster_col)
+        df.pivot(index=unit_index, columns=temporal_index, values=cluster_col)
         .dropna()
         .astype("int")
     )
@@ -195,7 +219,7 @@ def sequence(
     model = AgglomerativeClustering(n_clusters=seq_clusters).fit(seq_dis_mat)
     name_seq = dist_type + "_%d" % (seq_clusters)
     df_wide[name_seq] = model.labels_
-    gdf_temp = gdf_temp.merge(df_wide[[name_seq]], left_on=id_var, right_index=True)
+    gdf_temp = gdf_temp.merge(df_wide[[name_seq]], left_on=unit_index, right_index=True)
     gdf_temp = gdf_temp.reset_index()
 
     return gdf_temp, df_wide, seq_dis_mat
diff --git a/geosnap/harmonize/harmonize.py b/geosnap/harmonize/harmonize.py
index 4f90056d..80ec05c8 100644
--- a/geosnap/harmonize/harmonize.py
+++ b/geosnap/harmonize/harmonize.py
@@ -7,6 +7,7 @@
 from tobler.util.util import _check_presence_of_crs
 from tqdm.auto import tqdm
 
+
 def harmonize(
     raw_community,
     target_year=None,
@@ -17,8 +18,8 @@ def harmonize(
     raster=None,
     codes=[21, 22, 23, 24],
     force_crs_match=True,
-    index="geoid",
-    time_col="year",
+    temporal_index="year",
+    unit_index='geoid'
 ):
     r"""
     Use spatial interpolation to standardize neighborhood boundaries over time.
@@ -27,35 +28,28 @@ def harmonize(
     ----------
     raw_community : list of geopandas.GeoDataFrames
         Multiple GeoDataFrames given by a list (see (1) in Notes).
-
     target_year : string
         The target year that represents the bondaries of all datasets generated
         in the harmonization. Could be, for example '2010'.
-
     weights_method : string
         The method that the harmonization will be conducted. This can be set to:
             * "area"                      : harmonization using simple area-weighted interprolation.
             * "dasymetric"                : harmonization using area-weighted interpolation with raster-based
                                             ancillary data to mask out uninhabited land.
-
     extensive_variables : list
         The names of variables in each dataset of raw_community that contains
         extensive variables to be harmonized (see (2) in Notes).
-
     intensive_variables : list
         The names of variables in each dataset of raw_community that contains
         intensive variables to be harmonized (see (2) in Notes).
-
     allocate_total : boolean
         True if total value of source area should be allocated.
         False if denominator is area of i. Note that the two cases
         would be identical when the area of the source polygon is
         exhausted by intersections. See (3) in Notes for more details.
-
     raster : str
         the path to a local raster image to be used as a dasymetric mask. If using
         "dasymetric" this is a required argument.
-
     codes : list of ints
         list of raster pixel values that should be considered as
         'populated'. Since this draw inspiration using the National Land Cover
@@ -65,12 +59,14 @@ def harmonize(
         found here:
         https://www.mrlc.gov/sites/default/files/metadata/landcover.html
         Ignored if not using dasymetric harmonizatiton.
-
     force_crs_match : bool. Default is True.
         Wheter the Coordinate Reference System (CRS) of the polygon will be
         reprojected to the CRS of the raster file. It is recommended to
         leave this argument True.
         Only taken into consideration for harmonization raster based.
+    unit_index : str
+        name of column in the Community gdf that denotes unique unit identifiers, default is "geoid"
+
 
 
     Notes
@@ -105,7 +101,8 @@ def harmonize(
         w_{i,j} = a_{i,j} / \sum_k a_{k,j}
 
     """
-    assert target_year, ('target_year is a required parameter')
+    assert unit_index in raw_community.columns, f"{unit_index} must be available"
+    assert target_year, "target_year is a required parameter"
     if extensive_variables is None and intensive_variables is None:
         raise ValueError(
             "You must pass a set of extensive and/or intensive variables to interpolate"
@@ -118,18 +115,18 @@ def harmonize(
 
     _check_presence_of_crs(raw_community)
     dfs = raw_community.copy()
-    times = dfs[time_col].unique().tolist()
+    times = dfs[temporal_index].unique().tolist()
     times.remove(target_year)
 
-    target_df = dfs[dfs[time_col] == target_year].reset_index()
+    target_df = dfs[dfs[temporal_index] == target_year].reset_index()
 
     interpolated_dfs = {}
     interpolated_dfs[target_year] = target_df.copy()
 
-    with tqdm(total=len(times), desc=f'Converting {len(times)} time periods') as pbar:
+    with tqdm(total=len(times), desc=f"Converting {len(times)} time periods") as pbar:
         for i in times:
             pbar.write(f"Harmonizing {i}")
-            source_df = dfs[dfs[time_col] == i]
+            source_df = dfs[dfs[temporal_index] == i]
 
             if weights_method == "area":
 
@@ -153,6 +150,7 @@ def harmonize(
                         allocate_total=allocate_total,
                         codes=codes,
                         raster=raster,
+                        force_crs_match=force_crs_match,
                     )
                 except IOError:
                     raise IOError(
@@ -167,15 +165,14 @@ def harmonize(
             profiles.append(profile)
 
             profile["geometry"] = target_df["geometry"]
-            profile[index] = target_df[index]
-            profile[time_col] = i
+            profile[unit_index] = target_df[unit_index]
+            profile[temporal_index] = i
 
             interpolated_dfs[i] = profile
             pbar.update(1)
         pbar.set_description("Complete")
         pbar.close()
 
-
     harmonized_df = gpd.GeoDataFrame(
         pd.concat(list(interpolated_dfs.values()), sort=True)
     )
diff --git a/geosnap/visualize/transitions.py b/geosnap/visualize/transitions.py
index 0a3ea361..77d78c7a 100644
--- a/geosnap/visualize/transitions.py
+++ b/geosnap/visualize/transitions.py
@@ -12,6 +12,9 @@ def plot_transition_matrix(
     cluster_col=None,
     w_type="queen",
     w_options=None,
+    temporal_index="year",
+    unit_index="geoid",
+    permutations=0,
     figsize=(13, 12),
     n_rows=3,
     n_cols=3,
@@ -29,10 +32,21 @@ def plot_transition_matrix(
          a geosnap Community instance
      cluster_col : str
          column on the Community.gdf containing neighborhood type labels
-     w_type : str {'queen', 'rook'}
-         which type of libpysal spatial weights objects to encode connectivity
-     w_options : dict
-         additional options passed to a libpysal weights constructor (e.g. `k` for a KNN weights matrix)
+    temporal_index        : string, optional
+        Column defining time and or sequencing of the long-form data.
+        Default is "year".
+    unit_index : string, optional
+        Column identifying the unique id of spatial units.
+        Default is "geoid".
+    w_type : string, optional
+        Type of spatial weights type ("rook", "queen", "knn" or
+        "kernel") to be used for spatial structure. Default is
+        None, if non-spatial Markov transition rates are desired.
+    w_options : dict
+        additional options passed to a libpysal weights constructor (e.g. `k` for a KNN weights matrix)
+    permutations : int, optional
+        number of permutations for use in randomization based
+        inference (the default is 0).
      figsize : tuple, optional
          size of the resulting figure (13, 12)
      n_rows : int, optional
@@ -47,7 +61,7 @@ def plot_transition_matrix(
          location the plot will be saved
      dpi : int, optional
          dpi of the resulting image, default is 300
- 
+
      Returns
      -------
      matplotlib Axes
@@ -61,7 +75,14 @@ def plot_transition_matrix(
             "fontsize": 20,
         }
 
-    sm = community.transition(cluster_col=cluster_col, w_type=w_type)
+    sm = community.transition(
+        cluster_col=cluster_col,
+        temporal_index=temporal_index,
+        unit_index=unit_index,
+        w_type=w_type,
+        permutations=permutations,
+        w_options=w_options,
+    )
 
     _, axs = plt.subplots(n_rows, n_cols, figsize=figsize)
     axs = axs.flatten()
@@ -127,6 +148,10 @@ def plot_transition_graphs(
     cluster_col=None,
     output_dir=".",
     w_type="queen",
+    w_options=None,
+    temporal_index="year",
+    unit_index="geoid",
+    permutations=0,
     layout="dot",
     args="-n -Groot=0 -Goverlap=false -Gnodesep=0.01 -Gfont_size=1 -Gmindist=3.5 -Gsize=30,30!",
 ):
@@ -145,8 +170,21 @@ def plot_transition_graphs(
         column on the Community.gdf containing neighborhood type labels
     output_dir : str
         the location that output images will be placed
-    w_type : str {'queen', 'rook'}
-        which type of libpysal spatial weights objects to encode connectivity
+    temporal_index        : string, optional
+        Column defining time and or sequencing of the long-form data.
+        Default is "year".
+    unit_index : string, optional
+        Column identifying the unique id of spatial units.
+        Default is "geoid".
+    w_type : string, optional
+        Type of spatial weights type ("rook", "queen", "knn" or
+        "kernel") to be used for spatial structure. Default is
+        None, if non-spatial Markov transition rates are desired.
+    w_options : dict
+        additional options passed to a libpysal weights constructor (e.g. `k` for a KNN weights matrix)
+    permutations : int, optional
+        number of permutations for use in randomization based
+        inference (the default is 0).
     layout : str, 'dot'
         graphviz layout for plotting
     args : str, optional
@@ -161,8 +199,14 @@ def plot_transition_graphs(
         import pygraphviz
     except ImportError:
         raise ImportError("You must have pygraphviz installed to use graph plotting")
-    sm = community.transition(cluster_col=cluster_col, w_type=w_type)
-
+    sm = community.transition(
+        cluster_col=cluster_col,
+        temporal_index=temporal_index,
+        unit_index=unit_index,
+        w_type=w_type,
+        permutations=permutations,
+        w_options=w_options,
+    )
     # plot the global transition matrix
     p = sm.p
     graph = np.round(p, 2)
diff --git a/requirements.txt b/requirements.txt
index 0e2d7f3d..15383e7b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -25,4 +25,5 @@ fsspec
 s3fs
 botocore >=1.20.21
 segregation>=2.1
-proplot>=9
\ No newline at end of file
+proplot>=9
+versioneer
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 00000000..6b0eabdb
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,7 @@
+[versioneer]
+VCS = git
+style = pep440
+versionfile_source = geosnap/_version.py
+versionfile_build = geosnap/_version.py
+tag_prefix = v
+parentdir_prefix = geosnap-
diff --git a/setup.py b/setup.py
index 3b3ca6ef..3ec7c6e6 100644
--- a/setup.py
+++ b/setup.py
@@ -1,17 +1,15 @@
 # coding: utf-8
-
-from setuptools import setup, find_packages
-
-from distutils.command.build_py import build_py
-
 import os
+from distutils.command.build_py import build_py
+from setuptools import find_packages, setup
+import versioneer
 
 with open("README.md", encoding="utf8") as file:
     long_description = file.read()
 
 # Get __version__ from libpysal/__init__.py without importing the package
 # __version__ has to be defined in the first line
-with open('geosnap/__init__.py', 'r') as f:
+with open("geosnap/__init__.py", "r") as f:
     exec(f.readline())
 
 
@@ -47,14 +45,15 @@ def setup_package():
 
     setup(
         name="geosnap",
-        version=__version__,
+        version=versioneer.get_version(),
+        cmdclass=versioneer.get_cmdclass({"build_py": build_py}),
         description="Geospatial Neighborhood Analysis Package",
         long_description=long_description,
         long_description_content_type="text/markdown",
         maintainer="geosnap Developers",
         maintainer_email="pysal-dev@googlegroups.com",
         url="https://spatialucr.github.io/geosnap-guide",
-        download_url='https://pypi.python.org/pypi/geosnap',
+        download_url="https://pypi.python.org/pypi/geosnap",
         license="BSD",
         py_modules=["geosnap"],
         packages=find_packages(),
@@ -75,7 +74,9 @@ def setup_package():
         install_requires=install_reqs,
         extras_require=extras_reqs,
         include_package_data=True,
-        package_data={"geosnap": ["io/variables.csv", "io/stfipstable.csv", "io/lodes.csv"]},
+        package_data={
+            "geosnap": ["io/variables.csv", "io/stfipstable.csv", "io/lodes.csv"]
+        },
         python_requires=">3.5",
     )
 
diff --git a/versioneer.py b/versioneer.py
new file mode 100644
index 00000000..97130070
--- /dev/null
+++ b/versioneer.py
@@ -0,0 +1,2064 @@
+
+# Version: 0.20
+
+"""The Versioneer - like a rocketeer, but for versions.
+
+The Versioneer
+==============
+
+* like a rocketeer, but for versions!
+* https://github.com/python-versioneer/python-versioneer
+* Brian Warner
+* License: Public Domain
+* Compatible with: Python 3.6, 3.7, 3.8, 3.9 and pypy3
+* [![Latest Version][pypi-image]][pypi-url]
+* [![Build Status][travis-image]][travis-url]
+
+This is a tool for managing a recorded version number in distutils-based
+python projects. The goal is to remove the tedious and error-prone "update
+the embedded version string" step from your release process. Making a new
+release should be as easy as recording a new tag in your version-control
+system, and maybe making new tarballs.
+
+
+## Quick Install
+
+* `pip install versioneer` to somewhere in your $PATH
+* add a `[versioneer]` section to your setup.cfg (see [Install](INSTALL.md))
+* run `versioneer install` in your source tree, commit the results
+* Verify version information with `python setup.py version`
+
+## Version Identifiers
+
+Source trees come from a variety of places:
+
+* a version-control system checkout (mostly used by developers)
+* a nightly tarball, produced by build automation
+* a snapshot tarball, produced by a web-based VCS browser, like github's
+  "tarball from tag" feature
+* a release tarball, produced by "setup.py sdist", distributed through PyPI
+
+Within each source tree, the version identifier (either a string or a number,
+this tool is format-agnostic) can come from a variety of places:
+
+* ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows
+  about recent "tags" and an absolute revision-id
+* the name of the directory into which the tarball was unpacked
+* an expanded VCS keyword ($Id$, etc)
+* a `_version.py` created by some earlier build step
+
+For released software, the version identifier is closely related to a VCS
+tag. Some projects use tag names that include more than just the version
+string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool
+needs to strip the tag prefix to extract the version identifier. For
+unreleased software (between tags), the version identifier should provide
+enough information to help developers recreate the same tree, while also
+giving them an idea of roughly how old the tree is (after version 1.2, before
+version 1.3). Many VCS systems can report a description that captures this,
+for example `git describe --tags --dirty --always` reports things like
+"0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the
+0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has
+uncommitted changes).
+
+The version identifier is used for multiple purposes:
+
+* to allow the module to self-identify its version: `myproject.__version__`
+* to choose a name and prefix for a 'setup.py sdist' tarball
+
+## Theory of Operation
+
+Versioneer works by adding a special `_version.py` file into your source
+tree, where your `__init__.py` can import it. This `_version.py` knows how to
+dynamically ask the VCS tool for version information at import time.
+
+`_version.py` also contains `$Revision$` markers, and the installation
+process marks `_version.py` to have this marker rewritten with a tag name
+during the `git archive` command. As a result, generated tarballs will
+contain enough information to get the proper version.
+
+To allow `setup.py` to compute a version too, a `versioneer.py` is added to
+the top level of your source tree, next to `setup.py` and the `setup.cfg`
+that configures it. This overrides several distutils/setuptools commands to
+compute the version when invoked, and changes `setup.py build` and `setup.py
+sdist` to replace `_version.py` with a small static file that contains just
+the generated version data.
+
+## Installation
+
+See [INSTALL.md](./INSTALL.md) for detailed installation instructions.
+
+## Version-String Flavors
+
+Code which uses Versioneer can learn about its version string at runtime by
+importing `_version` from your main `__init__.py` file and running the
+`get_versions()` function. From the "outside" (e.g. in `setup.py`), you can
+import the top-level `versioneer.py` and run `get_versions()`.
+
+Both functions return a dictionary with different flavors of version
+information:
+
+* `['version']`: A condensed version string, rendered using the selected
+  style. This is the most commonly used value for the project's version
+  string. The default "pep440" style yields strings like `0.11`,
+  `0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section
+  below for alternative styles.
+
+* `['full-revisionid']`: detailed revision identifier. For Git, this is the
+  full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac".
+
+* `['date']`: Date and time of the latest `HEAD` commit. For Git, it is the
+  commit date in ISO 8601 format. This will be None if the date is not
+  available.
+
+* `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that
+  this is only accurate if run in a VCS checkout, otherwise it is likely to
+  be False or None
+
+* `['error']`: if the version string could not be computed, this will be set
+  to a string describing the problem, otherwise it will be None. It may be
+  useful to throw an exception in setup.py if this is set, to avoid e.g.
+  creating tarballs with a version string of "unknown".
+
+Some variants are more useful than others. Including `full-revisionid` in a
+bug report should allow developers to reconstruct the exact code being tested
+(or indicate the presence of local changes that should be shared with the
+developers). `version` is suitable for display in an "about" box or a CLI
+`--version` output: it can be easily compared against release notes and lists
+of bugs fixed in various releases.
+
+The installer adds the following text to your `__init__.py` to place a basic
+version in `YOURPROJECT.__version__`:
+
+    from ._version import get_versions
+    __version__ = get_versions()['version']
+    del get_versions
+
+## Styles
+
+The setup.cfg `style=` configuration controls how the VCS information is
+rendered into a version string.
+
+The default style, "pep440", produces a PEP440-compliant string, equal to the
+un-prefixed tag name for actual releases, and containing an additional "local
+version" section with more detail for in-between builds. For Git, this is
+TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags
+--dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the
+tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and
+that this commit is two revisions ("+2") beyond the "0.11" tag. For released
+software (exactly equal to a known tag), the identifier will only contain the
+stripped tag, e.g. "0.11".
+
+Other styles are available. See [details.md](details.md) in the Versioneer
+source tree for descriptions.
+
+## Debugging
+
+Versioneer tries to avoid fatal errors: if something goes wrong, it will tend
+to return a version of "0+unknown". To investigate the problem, run `setup.py
+version`, which will run the version-lookup code in a verbose mode, and will
+display the full contents of `get_versions()` (including the `error` string,
+which may help identify what went wrong).
+
+## Known Limitations
+
+Some situations are known to cause problems for Versioneer. This details the
+most significant ones. More can be found on Github
+[issues page](https://github.com/python-versioneer/python-versioneer/issues).
+
+### Subprojects
+
+Versioneer has limited support for source trees in which `setup.py` is not in
+the root directory (e.g. `setup.py` and `.git/` are *not* siblings). The are
+two common reasons why `setup.py` might not be in the root:
+
+* Source trees which contain multiple subprojects, such as
+  [Buildbot](https://github.com/buildbot/buildbot), which contains both
+  "master" and "slave" subprojects, each with their own `setup.py`,
+  `setup.cfg`, and `tox.ini`. Projects like these produce multiple PyPI
+  distributions (and upload multiple independently-installable tarballs).
+* Source trees whose main purpose is to contain a C library, but which also
+  provide bindings to Python (and perhaps other languages) in subdirectories.
+
+Versioneer will look for `.git` in parent directories, and most operations
+should get the right version string. However `pip` and `setuptools` have bugs
+and implementation details which frequently cause `pip install .` from a
+subproject directory to fail to find a correct version string (so it usually
+defaults to `0+unknown`).
+
+`pip install --editable .` should work correctly. `setup.py install` might
+work too.
+
+Pip-8.1.1 is known to have this problem, but hopefully it will get fixed in
+some later version.
+
+[Bug #38](https://github.com/python-versioneer/python-versioneer/issues/38) is tracking
+this issue. The discussion in
+[PR #61](https://github.com/python-versioneer/python-versioneer/pull/61) describes the
+issue from the Versioneer side in more detail.
+[pip PR#3176](https://github.com/pypa/pip/pull/3176) and
+[pip PR#3615](https://github.com/pypa/pip/pull/3615) contain work to improve
+pip to let Versioneer work correctly.
+
+Versioneer-0.16 and earlier only looked for a `.git` directory next to the
+`setup.cfg`, so subprojects were completely unsupported with those releases.
+
+### Editable installs with setuptools <= 18.5
+
+`setup.py develop` and `pip install --editable .` allow you to install a
+project into a virtualenv once, then continue editing the source code (and
+test) without re-installing after every change.
+
+"Entry-point scripts" (`setup(entry_points={"console_scripts": ..})`) are a
+convenient way to specify executable scripts that should be installed along
+with the python package.
+
+These both work as expected when using modern setuptools. When using
+setuptools-18.5 or earlier, however, certain operations will cause
+`pkg_resources.DistributionNotFound` errors when running the entrypoint
+script, which must be resolved by re-installing the package. This happens
+when the install happens with one version, then the egg_info data is
+regenerated while a different version is checked out. Many setup.py commands
+cause egg_info to be rebuilt (including `sdist`, `wheel`, and installing into
+a different virtualenv), so this can be surprising.
+
+[Bug #83](https://github.com/python-versioneer/python-versioneer/issues/83) describes
+this one, but upgrading to a newer version of setuptools should probably
+resolve it.
+
+
+## Updating Versioneer
+
+To upgrade your project to a new release of Versioneer, do the following:
+
+* install the new Versioneer (`pip install -U versioneer` or equivalent)
+* edit `setup.cfg`, if necessary, to include any new configuration settings
+  indicated by the release notes. See [UPGRADING](./UPGRADING.md) for details.
+* re-run `versioneer install` in your source tree, to replace
+  `SRC/_version.py`
+* commit any changed files
+
+## Future Directions
+
+This tool is designed to make it easily extended to other version-control
+systems: all VCS-specific components are in separate directories like
+src/git/ . The top-level `versioneer.py` script is assembled from these
+components by running make-versioneer.py . In the future, make-versioneer.py
+will take a VCS name as an argument, and will construct a version of
+`versioneer.py` that is specific to the given VCS. It might also take the
+configuration arguments that are currently provided manually during
+installation by editing setup.py . Alternatively, it might go the other
+direction and include code from all supported VCS systems, reducing the
+number of intermediate scripts.
+
+## Similar projects
+
+* [setuptools_scm](https://github.com/pypa/setuptools_scm/) - a non-vendored build-time
+  dependency
+* [minver](https://github.com/jbweston/miniver) - a lightweight reimplementation of
+  versioneer
+* [versioningit](https://github.com/jwodder/versioningit) - a PEP 518-based setuptools
+  plugin
+
+## License
+
+To make Versioneer easier to embed, all its code is dedicated to the public
+domain. The `_version.py` that it creates is also in the public domain.
+Specifically, both are released under the Creative Commons "Public Domain
+Dedication" license (CC0-1.0), as described in
+https://creativecommons.org/publicdomain/zero/1.0/ .
+
+[pypi-image]: https://img.shields.io/pypi/v/versioneer.svg
+[pypi-url]: https://pypi.python.org/pypi/versioneer/
+[travis-image]:
+https://img.shields.io/travis/com/python-versioneer/python-versioneer.svg
+[travis-url]: https://travis-ci.com/github/python-versioneer/python-versioneer
+
+"""
+
+import configparser
+import errno
+import json
+import os
+import re
+import subprocess
+import sys
+
+
+class VersioneerConfig:  # pylint: disable=too-few-public-methods # noqa
+    """Container for Versioneer configuration parameters."""
+
+
+def get_root():
+    """Get the project root directory.
+
+    We require that all commands are run from the project root, i.e. the
+    directory that contains setup.py, setup.cfg, and versioneer.py .
+    """
+    root = os.path.realpath(os.path.abspath(os.getcwd()))
+    setup_py = os.path.join(root, "setup.py")
+    versioneer_py = os.path.join(root, "versioneer.py")
+    if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)):
+        # allow 'python path/to/setup.py COMMAND'
+        root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
+        setup_py = os.path.join(root, "setup.py")
+        versioneer_py = os.path.join(root, "versioneer.py")
+    if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)):
+        err = ("Versioneer was unable to run the project root directory. "
+               "Versioneer requires setup.py to be executed from "
+               "its immediate directory (like 'python setup.py COMMAND'), "
+               "or in a way that lets it use sys.argv[0] to find the root "
+               "(like 'python path/to/setup.py COMMAND').")
+        raise VersioneerBadRootError(err)
+    try:
+        # Certain runtime workflows (setup.py install/develop in a setuptools
+        # tree) execute all dependencies in a single python process, so
+        # "versioneer" may be imported multiple times, and python's shared
+        # module-import table will cache the first one. So we can't use
+        # os.path.dirname(__file__), as that will find whichever
+        # versioneer.py was first imported, even in later projects.
+        my_path = os.path.realpath(os.path.abspath(__file__))
+        me_dir = os.path.normcase(os.path.splitext(my_path)[0])
+        vsr_dir = os.path.normcase(os.path.splitext(versioneer_py)[0])
+        if me_dir != vsr_dir:
+            print("Warning: build in %s is using versioneer.py from %s"
+                  % (os.path.dirname(my_path), versioneer_py))
+    except NameError:
+        pass
+    return root
+
+
+def get_config_from_root(root):
+    """Read the project setup.cfg file to determine Versioneer config."""
+    # This might raise EnvironmentError (if setup.cfg is missing), or
+    # configparser.NoSectionError (if it lacks a [versioneer] section), or
+    # configparser.NoOptionError (if it lacks "VCS="). See the docstring at
+    # the top of versioneer.py for instructions on writing your setup.cfg .
+    setup_cfg = os.path.join(root, "setup.cfg")
+    parser = configparser.ConfigParser()
+    with open(setup_cfg, "r") as cfg_file:
+        parser.read_file(cfg_file)
+    VCS = parser.get("versioneer", "VCS")  # mandatory
+
+    # Dict-like interface for non-mandatory entries
+    section = parser["versioneer"]
+
+    # pylint:disable=attribute-defined-outside-init # noqa
+    cfg = VersioneerConfig()
+    cfg.VCS = VCS
+    cfg.style = section.get("style", "")
+    cfg.versionfile_source = section.get("versionfile_source")
+    cfg.versionfile_build = section.get("versionfile_build")
+    cfg.tag_prefix = section.get("tag_prefix")
+    if cfg.tag_prefix in ("''", '""'):
+        cfg.tag_prefix = ""
+    cfg.parentdir_prefix = section.get("parentdir_prefix")
+    cfg.verbose = section.get("verbose")
+    return cfg
+
+
+class NotThisMethod(Exception):
+    """Exception raised if a method is not valid for the current scenario."""
+
+
+# these dictionaries contain VCS-specific tools
+LONG_VERSION_PY = {}
+HANDLERS = {}
+
+
+def register_vcs_handler(vcs, method):  # decorator
+    """Create decorator to mark a method as the handler of a VCS."""
+    def decorate(f):
+        """Store f in HANDLERS[vcs][method]."""
+        HANDLERS.setdefault(vcs, {})[method] = f
+        return f
+    return decorate
+
+
+# pylint:disable=too-many-arguments,consider-using-with # noqa
+def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
+                env=None):
+    """Call the given command(s)."""
+    assert isinstance(commands, list)
+    process = None
+    for command in commands:
+        try:
+            dispcmd = str([command] + args)
+            # remember shell=False, so use git.cmd on windows, not just git
+            process = subprocess.Popen([command] + args, cwd=cwd, env=env,
+                                       stdout=subprocess.PIPE,
+                                       stderr=(subprocess.PIPE if hide_stderr
+                                               else None))
+            break
+        except EnvironmentError:
+            e = sys.exc_info()[1]
+            if e.errno == errno.ENOENT:
+                continue
+            if verbose:
+                print("unable to run %s" % dispcmd)
+                print(e)
+            return None, None
+    else:
+        if verbose:
+            print("unable to find command, tried %s" % (commands,))
+        return None, None
+    stdout = process.communicate()[0].strip().decode()
+    if process.returncode != 0:
+        if verbose:
+            print("unable to run %s (error)" % dispcmd)
+            print("stdout was %s" % stdout)
+        return None, process.returncode
+    return stdout, process.returncode
+
+
+LONG_VERSION_PY['git'] = r'''
+# This file helps to compute a version number in source trees obtained from
+# git-archive tarball (such as those provided by githubs download-from-tag
+# feature). Distribution tarballs (built by setup.py sdist) and build
+# directories (produced by setup.py build) will contain a much shorter file
+# that just contains the computed version number.
+
+# This file is released into the public domain. Generated by
+# versioneer-0.20 (https://github.com/python-versioneer/python-versioneer)
+
+"""Git implementation of _version.py."""
+
+import errno
+import os
+import re
+import subprocess
+import sys
+
+
+def get_keywords():
+    """Get the keywords needed to look up the version information."""
+    # these strings will be replaced by git during git-archive.
+    # setup.py/versioneer.py will grep for the variable names, so they must
+    # each be defined on a line of their own. _version.py will just call
+    # get_keywords().
+    git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s"
+    git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s"
+    git_date = "%(DOLLAR)sFormat:%%ci%(DOLLAR)s"
+    keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
+    return keywords
+
+
+class VersioneerConfig:  # pylint: disable=too-few-public-methods
+    """Container for Versioneer configuration parameters."""
+
+
+def get_config():
+    """Create, populate and return the VersioneerConfig() object."""
+    # these strings are filled in when 'setup.py versioneer' creates
+    # _version.py
+    cfg = VersioneerConfig()
+    cfg.VCS = "git"
+    cfg.style = "%(STYLE)s"
+    cfg.tag_prefix = "%(TAG_PREFIX)s"
+    cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s"
+    cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s"
+    cfg.verbose = False
+    return cfg
+
+
+class NotThisMethod(Exception):
+    """Exception raised if a method is not valid for the current scenario."""
+
+
+LONG_VERSION_PY = {}
+HANDLERS = {}
+
+
+def register_vcs_handler(vcs, method):  # decorator
+    """Create decorator to mark a method as the handler of a VCS."""
+    def decorate(f):
+        """Store f in HANDLERS[vcs][method]."""
+        if vcs not in HANDLERS:
+            HANDLERS[vcs] = {}
+        HANDLERS[vcs][method] = f
+        return f
+    return decorate
+
+
+# pylint:disable=too-many-arguments,consider-using-with # noqa
+def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
+                env=None):
+    """Call the given command(s)."""
+    assert isinstance(commands, list)
+    process = None
+    for command in commands:
+        try:
+            dispcmd = str([command] + args)
+            # remember shell=False, so use git.cmd on windows, not just git
+            process = subprocess.Popen([command] + args, cwd=cwd, env=env,
+                                       stdout=subprocess.PIPE,
+                                       stderr=(subprocess.PIPE if hide_stderr
+                                               else None))
+            break
+        except EnvironmentError:
+            e = sys.exc_info()[1]
+            if e.errno == errno.ENOENT:
+                continue
+            if verbose:
+                print("unable to run %%s" %% dispcmd)
+                print(e)
+            return None, None
+    else:
+        if verbose:
+            print("unable to find command, tried %%s" %% (commands,))
+        return None, None
+    stdout = process.communicate()[0].strip().decode()
+    if process.returncode != 0:
+        if verbose:
+            print("unable to run %%s (error)" %% dispcmd)
+            print("stdout was %%s" %% stdout)
+        return None, process.returncode
+    return stdout, process.returncode
+
+
+def versions_from_parentdir(parentdir_prefix, root, verbose):
+    """Try to determine the version from the parent directory name.
+
+    Source tarballs conventionally unpack into a directory that includes both
+    the project name and a version string. We will also support searching up
+    two directory levels for an appropriately named parent directory
+    """
+    rootdirs = []
+
+    for _ in range(3):
+        dirname = os.path.basename(root)
+        if dirname.startswith(parentdir_prefix):
+            return {"version": dirname[len(parentdir_prefix):],
+                    "full-revisionid": None,
+                    "dirty": False, "error": None, "date": None}
+        rootdirs.append(root)
+        root = os.path.dirname(root)  # up a level
+
+    if verbose:
+        print("Tried directories %%s but none started with prefix %%s" %%
+              (str(rootdirs), parentdir_prefix))
+    raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
+
+
+@register_vcs_handler("git", "get_keywords")
+def git_get_keywords(versionfile_abs):
+    """Extract version information from the given file."""
+    # the code embedded in _version.py can just fetch the value of these
+    # keywords. When used from setup.py, we don't want to import _version.py,
+    # so we do it with a regexp instead. This function is not used from
+    # _version.py.
+    keywords = {}
+    try:
+        with open(versionfile_abs, "r") as fobj:
+            for line in fobj:
+                if line.strip().startswith("git_refnames ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["refnames"] = mo.group(1)
+                if line.strip().startswith("git_full ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["full"] = mo.group(1)
+                if line.strip().startswith("git_date ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["date"] = mo.group(1)
+    except EnvironmentError:
+        pass
+    return keywords
+
+
+@register_vcs_handler("git", "keywords")
+def git_versions_from_keywords(keywords, tag_prefix, verbose):
+    """Get version information from git keywords."""
+    if "refnames" not in keywords:
+        raise NotThisMethod("Short version file found")
+    date = keywords.get("date")
+    if date is not None:
+        # Use only the last line.  Previous lines may contain GPG signature
+        # information.
+        date = date.splitlines()[-1]
+
+        # git-2.2.0 added "%%cI", which expands to an ISO-8601 -compliant
+        # datestamp. However we prefer "%%ci" (which expands to an "ISO-8601
+        # -like" string, which we must then edit to make compliant), because
+        # it's been around since git-1.5.3, and it's too difficult to
+        # discover which version we're using, or to work around using an
+        # older one.
+        date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+    refnames = keywords["refnames"].strip()
+    if refnames.startswith("$Format"):
+        if verbose:
+            print("keywords are unexpanded, not using")
+        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
+    refs = {r.strip() for r in refnames.strip("()").split(",")}
+    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
+    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
+    TAG = "tag: "
+    tags = {r[len(TAG):] for r in refs if r.startswith(TAG)}
+    if not tags:
+        # Either we're using git < 1.8.3, or there really are no tags. We use
+        # a heuristic: assume all version tags have a digit. The old git %%d
+        # expansion behaves like git log --decorate=short and strips out the
+        # refs/heads/ and refs/tags/ prefixes that would let us distinguish
+        # between branches and tags. By ignoring refnames without digits, we
+        # filter out many common branch names like "release" and
+        # "stabilization", as well as "HEAD" and "master".
+        tags = {r for r in refs if re.search(r'\d', r)}
+        if verbose:
+            print("discarding '%%s', no digits" %% ",".join(refs - tags))
+    if verbose:
+        print("likely tags: %%s" %% ",".join(sorted(tags)))
+    for ref in sorted(tags):
+        # sorting will prefer e.g. "2.0" over "2.0rc1"
+        if ref.startswith(tag_prefix):
+            r = ref[len(tag_prefix):]
+            # Filter out refs that exactly match prefix or that don't start
+            # with a number once the prefix is stripped (mostly a concern
+            # when prefix is '')
+            if not re.match(r'\d', r):
+                continue
+            if verbose:
+                print("picking %%s" %% r)
+            return {"version": r,
+                    "full-revisionid": keywords["full"].strip(),
+                    "dirty": False, "error": None,
+                    "date": date}
+    # no suitable tags, so version is "0+unknown", but full hex is still there
+    if verbose:
+        print("no suitable tags, using unknown + full revision id")
+    return {"version": "0+unknown",
+            "full-revisionid": keywords["full"].strip(),
+            "dirty": False, "error": "no suitable tags", "date": None}
+
+
+@register_vcs_handler("git", "pieces_from_vcs")
+def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
+    """Get version from 'git describe' in the root of the source tree.
+
+    This only gets called if the git-archive 'subst' keywords were *not*
+    expanded, and _version.py hasn't already been rewritten with a short
+    version string, meaning we're inside a checked out source tree.
+    """
+    GITS = ["git"]
+    if sys.platform == "win32":
+        GITS = ["git.cmd", "git.exe"]
+
+    _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
+                   hide_stderr=True)
+    if rc != 0:
+        if verbose:
+            print("Directory %%s not under git control" %% root)
+        raise NotThisMethod("'git rev-parse --git-dir' returned error")
+
+    # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
+    # if there isn't one, this yields HEX[-dirty] (no NUM)
+    describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
+                                     "--always", "--long",
+                                     "--match", "%%s*" %% tag_prefix],
+                              cwd=root)
+    # --long was added in git-1.5.5
+    if describe_out is None:
+        raise NotThisMethod("'git describe' failed")
+    describe_out = describe_out.strip()
+    full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root)
+    if full_out is None:
+        raise NotThisMethod("'git rev-parse' failed")
+    full_out = full_out.strip()
+
+    pieces = {}
+    pieces["long"] = full_out
+    pieces["short"] = full_out[:7]  # maybe improved later
+    pieces["error"] = None
+
+    branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
+                             cwd=root)
+    # --abbrev-ref was added in git-1.6.3
+    if rc != 0 or branch_name is None:
+        raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
+    branch_name = branch_name.strip()
+
+    if branch_name == "HEAD":
+        # If we aren't exactly on a branch, pick a branch which represents
+        # the current commit. If all else fails, we are on a branchless
+        # commit.
+        branches, rc = runner(GITS, ["branch", "--contains"], cwd=root)
+        # --contains was added in git-1.5.4
+        if rc != 0 or branches is None:
+            raise NotThisMethod("'git branch --contains' returned error")
+        branches = branches.split("\n")
+
+        # Remove the first line if we're running detached
+        if "(" in branches[0]:
+            branches.pop(0)
+
+        # Strip off the leading "* " from the list of branches.
+        branches = [branch[2:] for branch in branches]
+        if "master" in branches:
+            branch_name = "master"
+        elif not branches:
+            branch_name = None
+        else:
+            # Pick the first branch that is returned. Good or bad.
+            branch_name = branches[0]
+
+    pieces["branch"] = branch_name
+
+    # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
+    # TAG might have hyphens.
+    git_describe = describe_out
+
+    # look for -dirty suffix
+    dirty = git_describe.endswith("-dirty")
+    pieces["dirty"] = dirty
+    if dirty:
+        git_describe = git_describe[:git_describe.rindex("-dirty")]
+
+    # now we have TAG-NUM-gHEX or HEX
+
+    if "-" in git_describe:
+        # TAG-NUM-gHEX
+        mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
+        if not mo:
+            # unparseable. Maybe git-describe is misbehaving?
+            pieces["error"] = ("unable to parse git-describe output: '%%s'"
+                               %% describe_out)
+            return pieces
+
+        # tag
+        full_tag = mo.group(1)
+        if not full_tag.startswith(tag_prefix):
+            if verbose:
+                fmt = "tag '%%s' doesn't start with prefix '%%s'"
+                print(fmt %% (full_tag, tag_prefix))
+            pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'"
+                               %% (full_tag, tag_prefix))
+            return pieces
+        pieces["closest-tag"] = full_tag[len(tag_prefix):]
+
+        # distance: number of commits since tag
+        pieces["distance"] = int(mo.group(2))
+
+        # commit: short hex revision ID
+        pieces["short"] = mo.group(3)
+
+    else:
+        # HEX: no tags
+        pieces["closest-tag"] = None
+        count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
+        pieces["distance"] = int(count_out)  # total number of commits
+
+    # commit date: see ISO-8601 comment in git_versions_from_keywords()
+    date = runner(GITS, ["show", "-s", "--format=%%ci", "HEAD"], cwd=root)[0].strip()
+    # Use only the last line.  Previous lines may contain GPG signature
+    # information.
+    date = date.splitlines()[-1]
+    pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+
+    return pieces
+
+
+def plus_or_dot(pieces):
+    """Return a + if we don't already have one, else return a ."""
+    if "+" in pieces.get("closest-tag", ""):
+        return "."
+    return "+"
+
+
+def render_pep440(pieces):
+    """Build up version string, with post-release "local version identifier".
+
+    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
+    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+
+    Exceptions:
+    1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += plus_or_dot(pieces)
+            rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_branch(pieces):
+    """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .
+
+    The ".dev0" means not master branch. Note that .dev0 sorts backwards
+    (a feature branch will appear "older" than the master branch).
+
+    Exceptions:
+    1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0"
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+untagged.%%d.g%%s" %% (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_pre(pieces):
+    """TAG[.post0.devDISTANCE] -- No -dirty.
+
+    Exceptions:
+    1: no tags. 0.post0.devDISTANCE
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += ".post0.dev%%d" %% pieces["distance"]
+    else:
+        # exception #1
+        rendered = "0.post0.dev%%d" %% pieces["distance"]
+    return rendered
+
+
+def render_pep440_post(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX] .
+
+    The ".dev0" means dirty. Note that .dev0 sorts backwards
+    (a dirty tree will appear "older" than the corresponding clean one),
+    but you shouldn't be releasing software with -dirty anyways.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%%d" %% pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%%s" %% pieces["short"]
+    else:
+        # exception #1
+        rendered = "0.post%%d" %% pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+        rendered += "+g%%s" %% pieces["short"]
+    return rendered
+
+
+def render_pep440_post_branch(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .
+
+    The ".dev0" means not master branch.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%%d" %% pieces["distance"]
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%%s" %% pieces["short"]
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0.post%%d" %% pieces["distance"]
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+g%%s" %% pieces["short"]
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_old(pieces):
+    """TAG[.postDISTANCE[.dev0]] .
+
+    The ".dev0" means dirty.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%%d" %% pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+    else:
+        # exception #1
+        rendered = "0.post%%d" %% pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+    return rendered
+
+
+def render_git_describe(pieces):
+    """TAG[-DISTANCE-gHEX][-dirty].
+
+    Like 'git describe --tags --dirty --always'.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render_git_describe_long(pieces):
+    """TAG-DISTANCE-gHEX[-dirty].
+
+    Like 'git describe --tags --dirty --always -long'.
+    The distance/hash is unconditional.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render(pieces, style):
+    """Render the given version pieces into the requested style."""
+    if pieces["error"]:
+        return {"version": "unknown",
+                "full-revisionid": pieces.get("long"),
+                "dirty": None,
+                "error": pieces["error"],
+                "date": None}
+
+    if not style or style == "default":
+        style = "pep440"  # the default
+
+    if style == "pep440":
+        rendered = render_pep440(pieces)
+    elif style == "pep440-branch":
+        rendered = render_pep440_branch(pieces)
+    elif style == "pep440-pre":
+        rendered = render_pep440_pre(pieces)
+    elif style == "pep440-post":
+        rendered = render_pep440_post(pieces)
+    elif style == "pep440-post-branch":
+        rendered = render_pep440_post_branch(pieces)
+    elif style == "pep440-old":
+        rendered = render_pep440_old(pieces)
+    elif style == "git-describe":
+        rendered = render_git_describe(pieces)
+    elif style == "git-describe-long":
+        rendered = render_git_describe_long(pieces)
+    else:
+        raise ValueError("unknown style '%%s'" %% style)
+
+    return {"version": rendered, "full-revisionid": pieces["long"],
+            "dirty": pieces["dirty"], "error": None,
+            "date": pieces.get("date")}
+
+
+def get_versions():
+    """Get version information or return default if unable to do so."""
+    # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
+    # __file__, we can work backwards from there to the root. Some
+    # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
+    # case we can only use expanded keywords.
+
+    cfg = get_config()
+    verbose = cfg.verbose
+
+    try:
+        return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
+                                          verbose)
+    except NotThisMethod:
+        pass
+
+    try:
+        root = os.path.realpath(__file__)
+        # versionfile_source is the relative path from the top of the source
+        # tree (where the .git directory might live) to this file. Invert
+        # this to find the root from __file__.
+        for _ in cfg.versionfile_source.split('/'):
+            root = os.path.dirname(root)
+    except NameError:
+        return {"version": "0+unknown", "full-revisionid": None,
+                "dirty": None,
+                "error": "unable to find root of source tree",
+                "date": None}
+
+    try:
+        pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+        return render(pieces, cfg.style)
+    except NotThisMethod:
+        pass
+
+    try:
+        if cfg.parentdir_prefix:
+            return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
+    except NotThisMethod:
+        pass
+
+    return {"version": "0+unknown", "full-revisionid": None,
+            "dirty": None,
+            "error": "unable to compute version", "date": None}
+'''
+
+
+@register_vcs_handler("git", "get_keywords")
+def git_get_keywords(versionfile_abs):
+    """Extract version information from the given file."""
+    # the code embedded in _version.py can just fetch the value of these
+    # keywords. When used from setup.py, we don't want to import _version.py,
+    # so we do it with a regexp instead. This function is not used from
+    # _version.py.
+    keywords = {}
+    try:
+        with open(versionfile_abs, "r") as fobj:
+            for line in fobj:
+                if line.strip().startswith("git_refnames ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["refnames"] = mo.group(1)
+                if line.strip().startswith("git_full ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["full"] = mo.group(1)
+                if line.strip().startswith("git_date ="):
+                    mo = re.search(r'=\s*"(.*)"', line)
+                    if mo:
+                        keywords["date"] = mo.group(1)
+    except EnvironmentError:
+        pass
+    return keywords
+
+
+@register_vcs_handler("git", "keywords")
+def git_versions_from_keywords(keywords, tag_prefix, verbose):
+    """Get version information from git keywords."""
+    if "refnames" not in keywords:
+        raise NotThisMethod("Short version file found")
+    date = keywords.get("date")
+    if date is not None:
+        # Use only the last line.  Previous lines may contain GPG signature
+        # information.
+        date = date.splitlines()[-1]
+
+        # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
+        # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
+        # -like" string, which we must then edit to make compliant), because
+        # it's been around since git-1.5.3, and it's too difficult to
+        # discover which version we're using, or to work around using an
+        # older one.
+        date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+    refnames = keywords["refnames"].strip()
+    if refnames.startswith("$Format"):
+        if verbose:
+            print("keywords are unexpanded, not using")
+        raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
+    refs = {r.strip() for r in refnames.strip("()").split(",")}
+    # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
+    # just "foo-1.0". If we see a "tag: " prefix, prefer those.
+    TAG = "tag: "
+    tags = {r[len(TAG):] for r in refs if r.startswith(TAG)}
+    if not tags:
+        # Either we're using git < 1.8.3, or there really are no tags. We use
+        # a heuristic: assume all version tags have a digit. The old git %d
+        # expansion behaves like git log --decorate=short and strips out the
+        # refs/heads/ and refs/tags/ prefixes that would let us distinguish
+        # between branches and tags. By ignoring refnames without digits, we
+        # filter out many common branch names like "release" and
+        # "stabilization", as well as "HEAD" and "master".
+        tags = {r for r in refs if re.search(r'\d', r)}
+        if verbose:
+            print("discarding '%s', no digits" % ",".join(refs - tags))
+    if verbose:
+        print("likely tags: %s" % ",".join(sorted(tags)))
+    for ref in sorted(tags):
+        # sorting will prefer e.g. "2.0" over "2.0rc1"
+        if ref.startswith(tag_prefix):
+            r = ref[len(tag_prefix):]
+            # Filter out refs that exactly match prefix or that don't start
+            # with a number once the prefix is stripped (mostly a concern
+            # when prefix is '')
+            if not re.match(r'\d', r):
+                continue
+            if verbose:
+                print("picking %s" % r)
+            return {"version": r,
+                    "full-revisionid": keywords["full"].strip(),
+                    "dirty": False, "error": None,
+                    "date": date}
+    # no suitable tags, so version is "0+unknown", but full hex is still there
+    if verbose:
+        print("no suitable tags, using unknown + full revision id")
+    return {"version": "0+unknown",
+            "full-revisionid": keywords["full"].strip(),
+            "dirty": False, "error": "no suitable tags", "date": None}
+
+
+@register_vcs_handler("git", "pieces_from_vcs")
+def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
+    """Get version from 'git describe' in the root of the source tree.
+
+    This only gets called if the git-archive 'subst' keywords were *not*
+    expanded, and _version.py hasn't already been rewritten with a short
+    version string, meaning we're inside a checked out source tree.
+    """
+    GITS = ["git"]
+    if sys.platform == "win32":
+        GITS = ["git.cmd", "git.exe"]
+
+    _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
+                   hide_stderr=True)
+    if rc != 0:
+        if verbose:
+            print("Directory %s not under git control" % root)
+        raise NotThisMethod("'git rev-parse --git-dir' returned error")
+
+    # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
+    # if there isn't one, this yields HEX[-dirty] (no NUM)
+    describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty",
+                                     "--always", "--long",
+                                     "--match", "%s*" % tag_prefix],
+                              cwd=root)
+    # --long was added in git-1.5.5
+    if describe_out is None:
+        raise NotThisMethod("'git describe' failed")
+    describe_out = describe_out.strip()
+    full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root)
+    if full_out is None:
+        raise NotThisMethod("'git rev-parse' failed")
+    full_out = full_out.strip()
+
+    pieces = {}
+    pieces["long"] = full_out
+    pieces["short"] = full_out[:7]  # maybe improved later
+    pieces["error"] = None
+
+    branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"],
+                             cwd=root)
+    # --abbrev-ref was added in git-1.6.3
+    if rc != 0 or branch_name is None:
+        raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
+    branch_name = branch_name.strip()
+
+    if branch_name == "HEAD":
+        # If we aren't exactly on a branch, pick a branch which represents
+        # the current commit. If all else fails, we are on a branchless
+        # commit.
+        branches, rc = runner(GITS, ["branch", "--contains"], cwd=root)
+        # --contains was added in git-1.5.4
+        if rc != 0 or branches is None:
+            raise NotThisMethod("'git branch --contains' returned error")
+        branches = branches.split("\n")
+
+        # Remove the first line if we're running detached
+        if "(" in branches[0]:
+            branches.pop(0)
+
+        # Strip off the leading "* " from the list of branches.
+        branches = [branch[2:] for branch in branches]
+        if "master" in branches:
+            branch_name = "master"
+        elif not branches:
+            branch_name = None
+        else:
+            # Pick the first branch that is returned. Good or bad.
+            branch_name = branches[0]
+
+    pieces["branch"] = branch_name
+
+    # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
+    # TAG might have hyphens.
+    git_describe = describe_out
+
+    # look for -dirty suffix
+    dirty = git_describe.endswith("-dirty")
+    pieces["dirty"] = dirty
+    if dirty:
+        git_describe = git_describe[:git_describe.rindex("-dirty")]
+
+    # now we have TAG-NUM-gHEX or HEX
+
+    if "-" in git_describe:
+        # TAG-NUM-gHEX
+        mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
+        if not mo:
+            # unparseable. Maybe git-describe is misbehaving?
+            pieces["error"] = ("unable to parse git-describe output: '%s'"
+                               % describe_out)
+            return pieces
+
+        # tag
+        full_tag = mo.group(1)
+        if not full_tag.startswith(tag_prefix):
+            if verbose:
+                fmt = "tag '%s' doesn't start with prefix '%s'"
+                print(fmt % (full_tag, tag_prefix))
+            pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
+                               % (full_tag, tag_prefix))
+            return pieces
+        pieces["closest-tag"] = full_tag[len(tag_prefix):]
+
+        # distance: number of commits since tag
+        pieces["distance"] = int(mo.group(2))
+
+        # commit: short hex revision ID
+        pieces["short"] = mo.group(3)
+
+    else:
+        # HEX: no tags
+        pieces["closest-tag"] = None
+        count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root)
+        pieces["distance"] = int(count_out)  # total number of commits
+
+    # commit date: see ISO-8601 comment in git_versions_from_keywords()
+    date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
+    # Use only the last line.  Previous lines may contain GPG signature
+    # information.
+    date = date.splitlines()[-1]
+    pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+
+    return pieces
+
+
+def do_vcs_install(manifest_in, versionfile_source, ipy):
+    """Git-specific installation logic for Versioneer.
+
+    For Git, this means creating/changing .gitattributes to mark _version.py
+    for export-subst keyword substitution.
+    """
+    GITS = ["git"]
+    if sys.platform == "win32":
+        GITS = ["git.cmd", "git.exe"]
+    files = [manifest_in, versionfile_source]
+    if ipy:
+        files.append(ipy)
+    try:
+        my_path = __file__
+        if my_path.endswith(".pyc") or my_path.endswith(".pyo"):
+            my_path = os.path.splitext(my_path)[0] + ".py"
+        versioneer_file = os.path.relpath(my_path)
+    except NameError:
+        versioneer_file = "versioneer.py"
+    files.append(versioneer_file)
+    present = False
+    try:
+        with open(".gitattributes", "r") as fobj:
+            for line in fobj:
+                if line.strip().startswith(versionfile_source):
+                    if "export-subst" in line.strip().split()[1:]:
+                        present = True
+                        break
+    except EnvironmentError:
+        pass
+    if not present:
+        with open(".gitattributes", "a+") as fobj:
+            fobj.write(f"{versionfile_source} export-subst\n")
+        files.append(".gitattributes")
+    run_command(GITS, ["add", "--"] + files)
+
+
+def versions_from_parentdir(parentdir_prefix, root, verbose):
+    """Try to determine the version from the parent directory name.
+
+    Source tarballs conventionally unpack into a directory that includes both
+    the project name and a version string. We will also support searching up
+    two directory levels for an appropriately named parent directory
+    """
+    rootdirs = []
+
+    for _ in range(3):
+        dirname = os.path.basename(root)
+        if dirname.startswith(parentdir_prefix):
+            return {"version": dirname[len(parentdir_prefix):],
+                    "full-revisionid": None,
+                    "dirty": False, "error": None, "date": None}
+        rootdirs.append(root)
+        root = os.path.dirname(root)  # up a level
+
+    if verbose:
+        print("Tried directories %s but none started with prefix %s" %
+              (str(rootdirs), parentdir_prefix))
+    raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
+
+
+SHORT_VERSION_PY = """
+# This file was generated by 'versioneer.py' (0.20) from
+# revision-control system data, or from the parent directory name of an
+# unpacked source archive. Distribution tarballs contain a pre-generated copy
+# of this file.
+
+import json
+
+version_json = '''
+%s
+'''  # END VERSION_JSON
+
+
+def get_versions():
+    return json.loads(version_json)
+"""
+
+
+def versions_from_file(filename):
+    """Try to determine the version from _version.py if present."""
+    try:
+        with open(filename) as f:
+            contents = f.read()
+    except EnvironmentError:
+        raise NotThisMethod("unable to read _version.py")
+    mo = re.search(r"version_json = '''\n(.*)'''  # END VERSION_JSON",
+                   contents, re.M | re.S)
+    if not mo:
+        mo = re.search(r"version_json = '''\r\n(.*)'''  # END VERSION_JSON",
+                       contents, re.M | re.S)
+    if not mo:
+        raise NotThisMethod("no version_json in _version.py")
+    return json.loads(mo.group(1))
+
+
+def write_to_version_file(filename, versions):
+    """Write the given version number to the given _version.py file."""
+    os.unlink(filename)
+    contents = json.dumps(versions, sort_keys=True,
+                          indent=1, separators=(",", ": "))
+    with open(filename, "w") as f:
+        f.write(SHORT_VERSION_PY % contents)
+
+    print("set %s to '%s'" % (filename, versions["version"]))
+
+
+def plus_or_dot(pieces):
+    """Return a + if we don't already have one, else return a ."""
+    if "+" in pieces.get("closest-tag", ""):
+        return "."
+    return "+"
+
+
+def render_pep440(pieces):
+    """Build up version string, with post-release "local version identifier".
+
+    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
+    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+
+    Exceptions:
+    1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += plus_or_dot(pieces)
+            rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0+untagged.%d.g%s" % (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_branch(pieces):
+    """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .
+
+    The ".dev0" means not master branch. Note that .dev0 sorts backwards
+    (a feature branch will appear "older" than the master branch).
+
+    Exceptions:
+    1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0"
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+untagged.%d.g%s" % (pieces["distance"],
+                                          pieces["short"])
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_pre(pieces):
+    """TAG[.post0.devDISTANCE] -- No -dirty.
+
+    Exceptions:
+    1: no tags. 0.post0.devDISTANCE
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += ".post0.dev%d" % pieces["distance"]
+    else:
+        # exception #1
+        rendered = "0.post0.dev%d" % pieces["distance"]
+    return rendered
+
+
+def render_pep440_post(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX] .
+
+    The ".dev0" means dirty. Note that .dev0 sorts backwards
+    (a dirty tree will appear "older" than the corresponding clean one),
+    but you shouldn't be releasing software with -dirty anyways.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%s" % pieces["short"]
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+        rendered += "+g%s" % pieces["short"]
+    return rendered
+
+
+def render_pep440_post_branch(pieces):
+    """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .
+
+    The ".dev0" means not master branch.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["branch"] != "master":
+                rendered += ".dev0"
+            rendered += plus_or_dot(pieces)
+            rendered += "g%s" % pieces["short"]
+            if pieces["dirty"]:
+                rendered += ".dirty"
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["branch"] != "master":
+            rendered += ".dev0"
+        rendered += "+g%s" % pieces["short"]
+        if pieces["dirty"]:
+            rendered += ".dirty"
+    return rendered
+
+
+def render_pep440_old(pieces):
+    """TAG[.postDISTANCE[.dev0]] .
+
+    The ".dev0" means dirty.
+
+    Exceptions:
+    1: no tags. 0.postDISTANCE[.dev0]
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"] or pieces["dirty"]:
+            rendered += ".post%d" % pieces["distance"]
+            if pieces["dirty"]:
+                rendered += ".dev0"
+    else:
+        # exception #1
+        rendered = "0.post%d" % pieces["distance"]
+        if pieces["dirty"]:
+            rendered += ".dev0"
+    return rendered
+
+
+def render_git_describe(pieces):
+    """TAG[-DISTANCE-gHEX][-dirty].
+
+    Like 'git describe --tags --dirty --always'.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        if pieces["distance"]:
+            rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render_git_describe_long(pieces):
+    """TAG-DISTANCE-gHEX[-dirty].
+
+    Like 'git describe --tags --dirty --always -long'.
+    The distance/hash is unconditional.
+
+    Exceptions:
+    1: no tags. HEX[-dirty]  (note: no 'g' prefix)
+    """
+    if pieces["closest-tag"]:
+        rendered = pieces["closest-tag"]
+        rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+    else:
+        # exception #1
+        rendered = pieces["short"]
+    if pieces["dirty"]:
+        rendered += "-dirty"
+    return rendered
+
+
+def render(pieces, style):
+    """Render the given version pieces into the requested style."""
+    if pieces["error"]:
+        return {"version": "unknown",
+                "full-revisionid": pieces.get("long"),
+                "dirty": None,
+                "error": pieces["error"],
+                "date": None}
+
+    if not style or style == "default":
+        style = "pep440"  # the default
+
+    if style == "pep440":
+        rendered = render_pep440(pieces)
+    elif style == "pep440-branch":
+        rendered = render_pep440_branch(pieces)
+    elif style == "pep440-pre":
+        rendered = render_pep440_pre(pieces)
+    elif style == "pep440-post":
+        rendered = render_pep440_post(pieces)
+    elif style == "pep440-post-branch":
+        rendered = render_pep440_post_branch(pieces)
+    elif style == "pep440-old":
+        rendered = render_pep440_old(pieces)
+    elif style == "git-describe":
+        rendered = render_git_describe(pieces)
+    elif style == "git-describe-long":
+        rendered = render_git_describe_long(pieces)
+    else:
+        raise ValueError("unknown style '%s'" % style)
+
+    return {"version": rendered, "full-revisionid": pieces["long"],
+            "dirty": pieces["dirty"], "error": None,
+            "date": pieces.get("date")}
+
+
+class VersioneerBadRootError(Exception):
+    """The project root directory is unknown or missing key files."""
+
+
+def get_versions(verbose=False):
+    """Get the project version from whatever source is available.
+
+    Returns dict with two keys: 'version' and 'full'.
+    """
+    if "versioneer" in sys.modules:
+        # see the discussion in cmdclass.py:get_cmdclass()
+        del sys.modules["versioneer"]
+
+    root = get_root()
+    cfg = get_config_from_root(root)
+
+    assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg"
+    handlers = HANDLERS.get(cfg.VCS)
+    assert handlers, "unrecognized VCS '%s'" % cfg.VCS
+    verbose = verbose or cfg.verbose
+    assert cfg.versionfile_source is not None, \
+        "please set versioneer.versionfile_source"
+    assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix"
+
+    versionfile_abs = os.path.join(root, cfg.versionfile_source)
+
+    # extract version from first of: _version.py, VCS command (e.g. 'git
+    # describe'), parentdir. This is meant to work for developers using a
+    # source checkout, for users of a tarball created by 'setup.py sdist',
+    # and for users of a tarball/zipball created by 'git archive' or github's
+    # download-from-tag feature or the equivalent in other VCSes.
+
+    get_keywords_f = handlers.get("get_keywords")
+    from_keywords_f = handlers.get("keywords")
+    if get_keywords_f and from_keywords_f:
+        try:
+            keywords = get_keywords_f(versionfile_abs)
+            ver = from_keywords_f(keywords, cfg.tag_prefix, verbose)
+            if verbose:
+                print("got version from expanded keyword %s" % ver)
+            return ver
+        except NotThisMethod:
+            pass
+
+    try:
+        ver = versions_from_file(versionfile_abs)
+        if verbose:
+            print("got version from file %s %s" % (versionfile_abs, ver))
+        return ver
+    except NotThisMethod:
+        pass
+
+    from_vcs_f = handlers.get("pieces_from_vcs")
+    if from_vcs_f:
+        try:
+            pieces = from_vcs_f(cfg.tag_prefix, root, verbose)
+            ver = render(pieces, cfg.style)
+            if verbose:
+                print("got version from VCS %s" % ver)
+            return ver
+        except NotThisMethod:
+            pass
+
+    try:
+        if cfg.parentdir_prefix:
+            ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
+            if verbose:
+                print("got version from parentdir %s" % ver)
+            return ver
+    except NotThisMethod:
+        pass
+
+    if verbose:
+        print("unable to compute version")
+
+    return {"version": "0+unknown", "full-revisionid": None,
+            "dirty": None, "error": "unable to compute version",
+            "date": None}
+
+
+def get_version():
+    """Get the short version string for this project."""
+    return get_versions()["version"]
+
+
+def get_cmdclass(cmdclass=None):
+    """Get the custom setuptools/distutils subclasses used by Versioneer.
+
+    If the package uses a different cmdclass (e.g. one from numpy), it
+    should be provide as an argument.
+    """
+    if "versioneer" in sys.modules:
+        del sys.modules["versioneer"]
+        # this fixes the "python setup.py develop" case (also 'install' and
+        # 'easy_install .'), in which subdependencies of the main project are
+        # built (using setup.py bdist_egg) in the same python process. Assume
+        # a main project A and a dependency B, which use different versions
+        # of Versioneer. A's setup.py imports A's Versioneer, leaving it in
+        # sys.modules by the time B's setup.py is executed, causing B to run
+        # with the wrong versioneer. Setuptools wraps the sub-dep builds in a
+        # sandbox that restores sys.modules to it's pre-build state, so the
+        # parent is protected against the child's "import versioneer". By
+        # removing ourselves from sys.modules here, before the child build
+        # happens, we protect the child from the parent's versioneer too.
+        # Also see https://github.com/python-versioneer/python-versioneer/issues/52
+
+    cmds = {} if cmdclass is None else cmdclass.copy()
+
+    # we add "version" to both distutils and setuptools
+    from distutils.core import Command
+
+    class cmd_version(Command):
+        description = "report generated version string"
+        user_options = []
+        boolean_options = []
+
+        def initialize_options(self):
+            pass
+
+        def finalize_options(self):
+            pass
+
+        def run(self):
+            vers = get_versions(verbose=True)
+            print("Version: %s" % vers["version"])
+            print(" full-revisionid: %s" % vers.get("full-revisionid"))
+            print(" dirty: %s" % vers.get("dirty"))
+            print(" date: %s" % vers.get("date"))
+            if vers["error"]:
+                print(" error: %s" % vers["error"])
+    cmds["version"] = cmd_version
+
+    # we override "build_py" in both distutils and setuptools
+    #
+    # most invocation pathways end up running build_py:
+    #  distutils/build -> build_py
+    #  distutils/install -> distutils/build ->..
+    #  setuptools/bdist_wheel -> distutils/install ->..
+    #  setuptools/bdist_egg -> distutils/install_lib -> build_py
+    #  setuptools/install -> bdist_egg ->..
+    #  setuptools/develop -> ?
+    #  pip install:
+    #   copies source tree to a tempdir before running egg_info/etc
+    #   if .git isn't copied too, 'git describe' will fail
+    #   then does setup.py bdist_wheel, or sometimes setup.py install
+    #  setup.py egg_info -> ?
+
+    # we override different "build_py" commands for both environments
+    if 'build_py' in cmds:
+        _build_py = cmds['build_py']
+    elif "setuptools" in sys.modules:
+        from setuptools.command.build_py import build_py as _build_py
+    else:
+        from distutils.command.build_py import build_py as _build_py
+
+    class cmd_build_py(_build_py):
+        def run(self):
+            root = get_root()
+            cfg = get_config_from_root(root)
+            versions = get_versions()
+            _build_py.run(self)
+            # now locate _version.py in the new build/ directory and replace
+            # it with an updated value
+            if cfg.versionfile_build:
+                target_versionfile = os.path.join(self.build_lib,
+                                                  cfg.versionfile_build)
+                print("UPDATING %s" % target_versionfile)
+                write_to_version_file(target_versionfile, versions)
+    cmds["build_py"] = cmd_build_py
+
+    if 'build_ext' in cmds:
+        _build_ext = cmds['build_ext']
+    elif "setuptools" in sys.modules:
+        from setuptools.command.build_ext import build_ext as _build_ext
+    else:
+        from distutils.command.build_ext import build_ext as _build_ext
+
+    class cmd_build_ext(_build_ext):
+        def run(self):
+            root = get_root()
+            cfg = get_config_from_root(root)
+            versions = get_versions()
+            _build_ext.run(self)
+            if self.inplace:
+                # build_ext --inplace will only build extensions in
+                # build/lib<..> dir with no _version.py to write to.
+                # As in place builds will already have a _version.py
+                # in the module dir, we do not need to write one.
+                return
+            # now locate _version.py in the new build/ directory and replace
+            # it with an updated value
+            target_versionfile = os.path.join(self.build_lib,
+                                              cfg.versionfile_build)
+            print("UPDATING %s" % target_versionfile)
+            write_to_version_file(target_versionfile, versions)
+    cmds["build_ext"] = cmd_build_ext
+
+    if "cx_Freeze" in sys.modules:  # cx_freeze enabled?
+        from cx_Freeze.dist import build_exe as _build_exe
+        # nczeczulin reports that py2exe won't like the pep440-style string
+        # as FILEVERSION, but it can be used for PRODUCTVERSION, e.g.
+        # setup(console=[{
+        #   "version": versioneer.get_version().split("+", 1)[0], # FILEVERSION
+        #   "product_version": versioneer.get_version(),
+        #   ...
+
+        class cmd_build_exe(_build_exe):
+            def run(self):
+                root = get_root()
+                cfg = get_config_from_root(root)
+                versions = get_versions()
+                target_versionfile = cfg.versionfile_source
+                print("UPDATING %s" % target_versionfile)
+                write_to_version_file(target_versionfile, versions)
+
+                _build_exe.run(self)
+                os.unlink(target_versionfile)
+                with open(cfg.versionfile_source, "w") as f:
+                    LONG = LONG_VERSION_PY[cfg.VCS]
+                    f.write(LONG %
+                            {"DOLLAR": "$",
+                             "STYLE": cfg.style,
+                             "TAG_PREFIX": cfg.tag_prefix,
+                             "PARENTDIR_PREFIX": cfg.parentdir_prefix,
+                             "VERSIONFILE_SOURCE": cfg.versionfile_source,
+                             })
+        cmds["build_exe"] = cmd_build_exe
+        del cmds["build_py"]
+
+    if 'py2exe' in sys.modules:  # py2exe enabled?
+        from py2exe.distutils_buildexe import py2exe as _py2exe
+
+        class cmd_py2exe(_py2exe):
+            def run(self):
+                root = get_root()
+                cfg = get_config_from_root(root)
+                versions = get_versions()
+                target_versionfile = cfg.versionfile_source
+                print("UPDATING %s" % target_versionfile)
+                write_to_version_file(target_versionfile, versions)
+
+                _py2exe.run(self)
+                os.unlink(target_versionfile)
+                with open(cfg.versionfile_source, "w") as f:
+                    LONG = LONG_VERSION_PY[cfg.VCS]
+                    f.write(LONG %
+                            {"DOLLAR": "$",
+                             "STYLE": cfg.style,
+                             "TAG_PREFIX": cfg.tag_prefix,
+                             "PARENTDIR_PREFIX": cfg.parentdir_prefix,
+                             "VERSIONFILE_SOURCE": cfg.versionfile_source,
+                             })
+        cmds["py2exe"] = cmd_py2exe
+
+    # we override different "sdist" commands for both environments
+    if 'sdist' in cmds:
+        _sdist = cmds['sdist']
+    elif "setuptools" in sys.modules:
+        from setuptools.command.sdist import sdist as _sdist
+    else:
+        from distutils.command.sdist import sdist as _sdist
+
+    class cmd_sdist(_sdist):
+        def run(self):
+            versions = get_versions()
+            # pylint:disable=attribute-defined-outside-init # noqa
+            self._versioneer_generated_versions = versions
+            # unless we update this, the command will keep using the old
+            # version
+            self.distribution.metadata.version = versions["version"]
+            return _sdist.run(self)
+
+        def make_release_tree(self, base_dir, files):
+            root = get_root()
+            cfg = get_config_from_root(root)
+            _sdist.make_release_tree(self, base_dir, files)
+            # now locate _version.py in the new base_dir directory
+            # (remembering that it may be a hardlink) and replace it with an
+            # updated value
+            target_versionfile = os.path.join(base_dir, cfg.versionfile_source)
+            print("UPDATING %s" % target_versionfile)
+            write_to_version_file(target_versionfile,
+                                  self._versioneer_generated_versions)
+    cmds["sdist"] = cmd_sdist
+
+    return cmds
+
+
+CONFIG_ERROR = """
+setup.cfg is missing the necessary Versioneer configuration. You need
+a section like:
+
+ [versioneer]
+ VCS = git
+ style = pep440
+ versionfile_source = src/myproject/_version.py
+ versionfile_build = myproject/_version.py
+ tag_prefix =
+ parentdir_prefix = myproject-
+
+You will also need to edit your setup.py to use the results:
+
+ import versioneer
+ setup(version=versioneer.get_version(),
+       cmdclass=versioneer.get_cmdclass(), ...)
+
+Please read the docstring in ./versioneer.py for configuration instructions,
+edit setup.cfg, and re-run the installer or 'python versioneer.py setup'.
+"""
+
+SAMPLE_CONFIG = """
+# See the docstring in versioneer.py for instructions. Note that you must
+# re-run 'versioneer.py setup' after changing this section, and commit the
+# resulting files.
+
+[versioneer]
+#VCS = git
+#style = pep440
+#versionfile_source =
+#versionfile_build =
+#tag_prefix =
+#parentdir_prefix =
+
+"""
+
+OLD_SNIPPET = """
+from ._version import get_versions
+__version__ = get_versions()['version']
+del get_versions
+"""
+
+INIT_PY_SNIPPET = """
+from . import {0}
+__version__ = {0}.get_versions()['version']
+"""
+
+
+def do_setup():
+    """Do main VCS-independent setup function for installing Versioneer."""
+    root = get_root()
+    try:
+        cfg = get_config_from_root(root)
+    except (EnvironmentError, configparser.NoSectionError,
+            configparser.NoOptionError) as e:
+        if isinstance(e, (EnvironmentError, configparser.NoSectionError)):
+            print("Adding sample versioneer config to setup.cfg",
+                  file=sys.stderr)
+            with open(os.path.join(root, "setup.cfg"), "a") as f:
+                f.write(SAMPLE_CONFIG)
+        print(CONFIG_ERROR, file=sys.stderr)
+        return 1
+
+    print(" creating %s" % cfg.versionfile_source)
+    with open(cfg.versionfile_source, "w") as f:
+        LONG = LONG_VERSION_PY[cfg.VCS]
+        f.write(LONG % {"DOLLAR": "$",
+                        "STYLE": cfg.style,
+                        "TAG_PREFIX": cfg.tag_prefix,
+                        "PARENTDIR_PREFIX": cfg.parentdir_prefix,
+                        "VERSIONFILE_SOURCE": cfg.versionfile_source,
+                        })
+
+    ipy = os.path.join(os.path.dirname(cfg.versionfile_source),
+                       "__init__.py")
+    if os.path.exists(ipy):
+        try:
+            with open(ipy, "r") as f:
+                old = f.read()
+        except EnvironmentError:
+            old = ""
+        module = os.path.splitext(os.path.basename(cfg.versionfile_source))[0]
+        snippet = INIT_PY_SNIPPET.format(module)
+        if OLD_SNIPPET in old:
+            print(" replacing boilerplate in %s" % ipy)
+            with open(ipy, "w") as f:
+                f.write(old.replace(OLD_SNIPPET, snippet))
+        elif snippet not in old:
+            print(" appending to %s" % ipy)
+            with open(ipy, "a") as f:
+                f.write(snippet)
+        else:
+            print(" %s unmodified" % ipy)
+    else:
+        print(" %s doesn't exist, ok" % ipy)
+        ipy = None
+
+    # Make sure both the top-level "versioneer.py" and versionfile_source
+    # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so
+    # they'll be copied into source distributions. Pip won't be able to
+    # install the package without this.
+    manifest_in = os.path.join(root, "MANIFEST.in")
+    simple_includes = set()
+    try:
+        with open(manifest_in, "r") as f:
+            for line in f:
+                if line.startswith("include "):
+                    for include in line.split()[1:]:
+                        simple_includes.add(include)
+    except EnvironmentError:
+        pass
+    # That doesn't cover everything MANIFEST.in can do
+    # (http://docs.python.org/2/distutils/sourcedist.html#commands), so
+    # it might give some false negatives. Appending redundant 'include'
+    # lines is safe, though.
+    if "versioneer.py" not in simple_includes:
+        print(" appending 'versioneer.py' to MANIFEST.in")
+        with open(manifest_in, "a") as f:
+            f.write("include versioneer.py\n")
+    else:
+        print(" 'versioneer.py' already in MANIFEST.in")
+    if cfg.versionfile_source not in simple_includes:
+        print(" appending versionfile_source ('%s') to MANIFEST.in" %
+              cfg.versionfile_source)
+        with open(manifest_in, "a") as f:
+            f.write("include %s\n" % cfg.versionfile_source)
+    else:
+        print(" versionfile_source already in MANIFEST.in")
+
+    # Make VCS-specific changes. For git, this means creating/changing
+    # .gitattributes to mark _version.py for export-subst keyword
+    # substitution.
+    do_vcs_install(manifest_in, cfg.versionfile_source, ipy)
+    return 0
+
+
+def scan_setup_py():
+    """Validate the contents of setup.py against Versioneer's expectations."""
+    found = set()
+    setters = False
+    errors = 0
+    with open("setup.py", "r") as f:
+        for line in f.readlines():
+            if "import versioneer" in line:
+                found.add("import")
+            if "versioneer.get_cmdclass()" in line:
+                found.add("cmdclass")
+            if "versioneer.get_version()" in line:
+                found.add("get_version")
+            if "versioneer.VCS" in line:
+                setters = True
+            if "versioneer.versionfile_source" in line:
+                setters = True
+    if len(found) != 3:
+        print("")
+        print("Your setup.py appears to be missing some important items")
+        print("(but I might be wrong). Please make sure it has something")
+        print("roughly like the following:")
+        print("")
+        print(" import versioneer")
+        print(" setup( version=versioneer.get_version(),")
+        print("        cmdclass=versioneer.get_cmdclass(),  ...)")
+        print("")
+        errors += 1
+    if setters:
+        print("You should remove lines like 'versioneer.VCS = ' and")
+        print("'versioneer.versionfile_source = ' . This configuration")
+        print("now lives in setup.cfg, and should be removed from setup.py")
+        print("")
+        errors += 1
+    return errors
+
+
+if __name__ == "__main__":
+    cmd = sys.argv[1]
+    if cmd == "setup":
+        errors = do_setup()
+        errors += scan_setup_py()
+        if errors:
+            sys.exit(1)


Test patch:
diff --git a/geosnap/tests/test_datastore.py b/geosnap/tests/test_datastore.py
index d51874ff..2fd9160f 100644
--- a/geosnap/tests/test_datastore.py
+++ b/geosnap/tests/test_datastore.py
@@ -1,6 +1,11 @@
 from geosnap import datasets
 
 
+def test_data_dir():
+    loc = datasets.show_data_dir()
+    assert len(loc) > 5
+
+
 def test_acs():
     df = datasets.acs(year=2012, states=["11"])
     assert df.shape == (179, 104)
diff --git a/geosnap/tests/test_harmonize.py b/geosnap/tests/test_harmonize.py
index ab850d73..37196c91 100644
--- a/geosnap/tests/test_harmonize.py
+++ b/geosnap/tests/test_harmonize.py
@@ -16,7 +16,6 @@ def test_harmonize_area():
         2000,
         extensive_variables=["n_total_housing_units"],
         intensive_variables=["p_vacant_housing_units"],
-        raster=local_raster
     )
 
     assert_allclose(