diff --git a/setup.py b/setup.py index 9af5df5..ebca5e3 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,21 @@ from setuptools import setup, find_packages +import re # Read the contents of the README file with open('README.md', 'r') as f: long_description = f.read() + +def find_version(): + with open('sqlite2rest/__init__.py', 'r') as f: + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + setup( name='sqlite2rest', - version='1.3.0', + version=find_version(), description='A Python library for creating a RESTful API from an SQLite database using Flask.', author='Denis Laprise', author_email='git@2ni.net', diff --git a/sqlite2rest/__init__.py b/sqlite2rest/__init__.py index aa29884..97aaf81 100644 --- a/sqlite2rest/__init__.py +++ b/sqlite2rest/__init__.py @@ -1,2 +1,3 @@ +__version__ = "0.4.0" from .app import create_app from .database import Database diff --git a/sqlite2rest/openapi.py b/sqlite2rest/openapi.py index 6788398..eeb866d 100644 --- a/sqlite2rest/openapi.py +++ b/sqlite2rest/openapi.py @@ -1,6 +1,7 @@ from flask import current_app from openapi_spec_validator import validate_spec import yaml +from . import __version__ def get_operation_summary(method): return { @@ -90,7 +91,7 @@ def generate_openapi_spec(db): "openapi": "3.0.0", "info": { "title": "SQLite2REST", - "version": "1.0.0" + "version": __version__ }, "paths": {} }