Skip to content

Commit

Permalink
Pull in db_facts version while publishing docs (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceatbluelabs authored Jul 13, 2020
1 parent 8313a7a commit 01c87af
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 10 deletions.
2 changes: 2 additions & 0 deletions db_facts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__all__ = [
'__version__',
'db',
'DBFacts',
'UserErrorException'
Expand All @@ -8,3 +9,4 @@
from .db_facts_types import DBFacts
from .runner import Runner # noqa - flake8 false positive
from .db_info import db
from .version import __version__
1 change: 1 addition & 0 deletions db_facts/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '4.0.0'
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import os
import sys
sys.path.insert(0, os.path.abspath('../../db-facts/'))

import db_facts # noqa

# -- Project information -----------------------------------------------------

Expand All @@ -22,7 +22,7 @@
author = 'Vince Broz'

# The full version, including alpha/beta/rc tags
release = '4.0.0'
release = db_facts.version.__version__


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion metrics/bigfiles_high_water_mark
Original file line number Diff line number Diff line change
@@ -1 +1 @@
360
369
2 changes: 1 addition & 1 deletion metrics/coverage_high_water_mark
Original file line number Diff line number Diff line change
@@ -1 +1 @@
97.9400
97.9500
2 changes: 1 addition & 1 deletion metrics/mypy_high_water_mark
Original file line number Diff line number Diff line change
@@ -1 +1 @@
73.1700
73.2400
19 changes: 14 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@
from distutils.cmd import Command
from setuptools import setup, find_packages
from setuptools.command.install import install
from typing import Optional
import os
import sys


VERSION = '4.0.0'
__version__: Optional[str] = None
# Read in and set version variable without the overhead/requirements
# of the rest of the package.
#
# https://milkr.io/kfei/5-common-patterns-to-version-your-Python-package/5
dir_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(dir_path, 'db_facts', 'version.py')) as f:
exec(f.read())
assert __version__ is not None


# From https://circleci.com/blog/continuously-deploying-python-packages-to-pypi-with-circleci/
Expand All @@ -19,11 +28,11 @@ class VerifyVersionCommand(install):

def run(self):
tag = os.getenv('CIRCLE_TAG')
tag_formatted_version = f'v{VERSION}'
tag_formatted_version = f'v{__version__}'

if tag != tag_formatted_version:
info = "Git tag: {0} does not match the version of this app: {1}".format(
tag, VERSION
tag, __version__
)
sys.exit(info)

Expand Down Expand Up @@ -96,10 +105,10 @@ def initialize_options(self) -> None:
long_description = f.read()

setup(name='db_facts',
version=VERSION,
version=__version__, # noqa
description='Database connection configuration manager',
long_description=long_description,
download_url=f'https://github.com/bluelabsio/db-facts/tarball/{VERSION}',
download_url=f'https://github.com/bluelabsio/db-facts/tarball/{__version__}', # noqa
author='Vince Broz',
author_email='[email protected]',
packages=find_packages(),
Expand Down

0 comments on commit 01c87af

Please sign in to comment.