Skip to content

Commit

Permalink
#12: add __version__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
codeforkjeff committed Dec 8, 2021
1 parent 0391af7 commit 7d084f1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Because I forget...
workon dbt-sqlite-devel
vi setup.py # update version
vi dbt/adapters/sqlite/__version__.py # update version
# start clean
rm -rf dist/ build/ *.egg-info
Expand Down
1 change: 1 addition & 0 deletions dbt/adapters/sqlite/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = '0.2.2'
28 changes: 27 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
#!/usr/bin/env python
import os
import re
from setuptools import find_packages
from setuptools import setup

# bits for pulling version from __version__.py taken from dbt snowflake plugin

this_directory = os.path.abspath(os.path.dirname(__file__))

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


def _get_plugin_version():
parts = _get_plugin_version_dict()
return "{major}.{minor}.{patch}{prekind}{pre}".format(**parts)


package_name = "dbt-sqlite"
package_version = "0.2.2"
package_version = _get_plugin_version()
description = """A SQLite adapter plugin for dbt (data build tool)"""
long_description = "Please see the github repository for detailed information"

Expand Down

0 comments on commit 7d084f1

Please sign in to comment.