From 3ac7f759012423506881ea80e14874c3b841884b Mon Sep 17 00:00:00 2001 From: Jeremy Cohen Date: Wed, 15 May 2024 12:38:48 +0200 Subject: [PATCH 1/2] Bump deps on common, adapters, core (#1039) Co-authored-by: Mike Alfare <13974384+mikealfare@users.noreply.github.com> --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2d631d679..728dcc8c6 100644 --- a/setup.py +++ b/setup.py @@ -59,11 +59,11 @@ def _get_plugin_version_dict(): packages=find_namespace_packages(include=["dbt", "dbt.*"]), include_package_data=True, install_requires=[ - "dbt-common>=0.1.0a1,<2.0", - "dbt-adapters>=1.1.0rc1,<2.0", + "dbt-common>=1.0.4,<2.0", + "dbt-adapters>=1.1.1,<2.0", "snowflake-connector-python[secure-local-storage]~=3.0", # add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency - "dbt-core>=1.8.0a1", + "dbt-core>=1.8.0", # installed via dbt-core but referenced directly; don't pin to avoid version conflicts with dbt-core "agate", ], From 87a6e808dfb025df1eeef3741ad3822635249889 Mon Sep 17 00:00:00 2001 From: Colin Rogers <111200756+colin-rogers-dbt@users.noreply.github.com> Date: Wed, 15 May 2024 14:42:02 -0700 Subject: [PATCH 2/2] remove duplicate package version and avoid bumping dbt-core version (#1044) --- .bumpversion.cfg | 2 -- setup.py | 30 ++++++++++++++---------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 513af867d..0fa84469a 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -32,6 +32,4 @@ first_value = 1 [bumpversion:part:nightly] -[bumpversion:file:setup.py] - [bumpversion:file:dbt/adapters/snowflake/__version__.py] diff --git a/setup.py b/setup.py index 728dcc8c6..f8ff363ed 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ #!/usr/bin/env python import os +from pathlib import Path + import sys -import re # require python 3.8 or newer if sys.version_info < (3, 8): @@ -28,28 +29,25 @@ long_description = f.read() -# get this package's version from dbt/adapters//__version__.py -def _get_plugin_version_dict(): - _version_path = os.path.join(this_directory, "dbt", "adapters", "snowflake", "__version__.py") - _semver = r"""(?P\d+)\.(?P\d+)\.(?P\d+)""" - _pre = r"""((?Pa|b|rc)(?P
\d+))?"""
-    _nightly = r"""(\.(?P[a-z0-9]+)?)?"""
-    _build = r"""(\+build[0-9]+)?"""
-    _version_pattern = rf"""version\s*=\s*["']{_semver}{_pre}{_nightly}{_build}["']"""
-    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.groupdict()
+# used for this adapter's version
+VERSION = Path(__file__).parent / "dbt/adapters/snowflake/__version__.py"
+
+
+def _plugin_version() -> str:
+    """
+    Pull the package version from the main package version file
+    """
+    attributes = {}
+    exec(VERSION.read_text(), attributes)
+    return attributes["version"]
 
 
 package_name = "dbt-snowflake"
-package_version = "1.9.0a1"
 description = """The Snowflake adapter plugin for dbt"""
 
 setup(
     name=package_name,
-    version=package_version,
+    version=_plugin_version(),
     description=description,
     long_description=long_description,
     long_description_content_type="text/markdown",