Skip to content

Commit

Permalink
remove duplicate package version and avoid bumping dbt-core version (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt authored May 15, 2024
1 parent 3ac7f75 commit 87a6e80
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
2 changes: 0 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ first_value = 1

[bumpversion:part:nightly]

[bumpversion:file:setup.py]

[bumpversion:file:dbt/adapters/snowflake/__version__.py]
30 changes: 14 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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):
Expand All @@ -28,28 +29,25 @@
long_description = f.read()


# get this package's version from dbt/adapters/<adapter name>/__version__.py
def _get_plugin_version_dict():
_version_path = os.path.join(this_directory, "dbt", "adapters", "snowflake", "__version__.py")
_semver = r"""(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)"""
_pre = r"""((?P<prekind>a|b|rc)(?P<pre>\d+))?"""
_nightly = r"""(\.(?P<nightly>[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",
Expand Down

0 comments on commit 87a6e80

Please sign in to comment.