Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proper version in openapi spec #6

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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',
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
Loading