Skip to content

Commit

Permalink
Use proper version in openapi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
nside committed Jul 28, 2023
1 parent a95ca04 commit 70ad1b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +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=find_version(),
version='1.3.0',
description='A Python library for creating a RESTful API from an SQLite database using Flask.',
author='Denis Laprise',
Expand Down
1 change: 1 addition & 0 deletions sqlite2rest/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__version__ = "0.4.0"
from .app import create_app
from .database import Database
3 changes: 2 additions & 1 deletion sqlite2rest/openapi.py
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -90,7 +91,7 @@ def generate_openapi_spec(db):
"openapi": "3.0.0",
"info": {
"title": "SQLite2REST",
"version": "1.0.0"
"version": __version__
},
"paths": {}
}
Expand Down

0 comments on commit 70ad1b9

Please sign in to comment.