diff --git a/.bumpversion-dbt.cfg b/.bumpversion-dbt.cfg new file mode 100644 index 000000000..7de840514 --- /dev/null +++ b/.bumpversion-dbt.cfg @@ -0,0 +1,23 @@ +[bumpversion] +current_version = 0.16.0 +parse = (?P\d+) + \.(?P\d+) + \.(?P\d+) + ((?P[a-z]+)(?P\d+))? +serialize = + {major}.{minor}.{patch}{prerelease}{num} + {major}.{minor}.{patch} +commit = False +tag = False + +[bumpversion:part:prerelease] +first_value = a +values = + a + b + rc + +[bumpversion:part:num] +first_value = 1 + +[bumpversion:file:setup.py] diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 1906574cc..b2084a036 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -3,16 +3,19 @@ current_version = 0.16.0a1 parse = (?P\d+) \.(?P\d+) \.(?P\d+) + (\.(?P\d+))? ((?P[a-z]+)(?P\d+))? -serialize = +serialize = + {major}.{minor}.{patch}.{pluginpatch}{prerelease}{num} {major}.{minor}.{patch}{prerelease}{num} + {major}.{minor}.{patch}.{pluginpatch} {major}.{minor}.{patch} commit = False tag = False [bumpversion:part:prerelease] first_value = a -values = +values = a b rc @@ -20,5 +23,7 @@ values = [bumpversion:part:num] first_value = 1 -[bumpversion:file:setup.py] +[bumpversion:part:pluginpatch] +first_value = 1 +[bumpversion:file:dbt/adapters/spark/__version__.py] diff --git a/dbt/adapters/spark/__version__.py b/dbt/adapters/spark/__version__.py new file mode 100644 index 000000000..e5f9d0eb6 --- /dev/null +++ b/dbt/adapters/spark/__version__.py @@ -0,0 +1 @@ +version = "0.16.0a1" diff --git a/setup.py b/setup.py index f0c459683..344a767ac 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python from setuptools import find_packages, setup import os +import re this_directory = os.path.abspath(os.path.dirname(__file__)) @@ -9,18 +10,31 @@ package_name = "dbt-spark" -package_version = "0.16.0a1" + + +# get this from a separate file +def _dbt_spark_version(): + _version_path = os.path.join( + this_directory, 'dbt', 'adapters', 'spark', '__version__.py' + ) + _version_pattern = r'''version\s*=\s*["'](.+)["']''' + with open(_version_path) as f: + match = re.search(_version_pattern, f.read().strip()) + if match is None: + raise ValueError(f'invalid version at {_version_path}') + return match.group(1) + + +package_version = _dbt_spark_version() description = """The SparkSQL plugin for dbt (data build tool)""" -# evade bumpversion with this fun trick -DBT_VERSION = (0, 16, 0) -dbt_version = '.'.join(map(str, DBT_VERSION)) +dbt_version = '0.16.0' # the package version should be the dbt version, with maybe some things on the # ends of it. (0.16.0 vs 0.16.0a1, 0.16.0.1, ...) if not package_version.startswith(dbt_version): raise ValueError( f'Invalid setup.py: package_version={package_version} must start with ' - f'dbt_version={dbt_version} (from {DBT_VERSION})' + f'dbt_version={dbt_version}' )