Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

bridgeql: display version page #12

Merged
merged 1 commit into from
Apr 6, 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
19 changes: 19 additions & 0 deletions bridgeql/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# -*- coding: utf-8 -*-
# Copyright © 2023 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

"""
____ _ _ ____ _
| _ \ (_) | | / __ \| |
| |_) |_ __ _ __| | __ _ ___| | | | |
| _ <| '__| |/ _` |/ _` |/ _ \ | | | |
| |_) | | | | (_| | (_| | __/ |__| | |____
|____/|_| |_|\__,_|\__, |\___|\___\_\______|
__/ |
|___/
"""

__title__ = 'BridgeQL'
__version__ = '0.1.12'
__license__ = 'BSD 2-Clause'
__copyright__ = 'Copyright © 2023 VMware, Inc. All rights reserved.'

# VERSION available outside module
VERSION = __version__
4 changes: 3 additions & 1 deletion bridgeql/django/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

from bridgeql.django.bridge import read_django_model
from bridgeql.django.settings import bridgeql_settings
from bridgeql.django.views import index

bridgeql_settings.validate()

urlpatterns = [
path('dj_read/', read_django_model, name='bridgeql_django_read'),
path('^dj_read/', read_django_model, name='bridgeql_django_read'),
path('', index, name='bridgeql_django_index'),
]
17 changes: 17 additions & 0 deletions bridgeql/django/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
# Copyright © 2023 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

from django.shortcuts import render
from bridgeql import __copyright__, __license__, __title__, __version__


def index(request):
return render(request, "bridgeql/index.html",
{
"copyright": __copyright__,
"license": __license__,
"title": __title__,
"version": __version__,
}
)
22 changes: 22 additions & 0 deletions bridgeql/templates/bridgeql/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!--
# -*- coding: utf-8 -*-
# Copyright © 2023 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
-->

<html>
<head>
<title>
{{title}}
</title>
</head>
<body>
<h1>
{{title}}
</h1>
<p>Current version :: {{version}}</p>
<p>Lincese info :: {{license}}</p>
<p>Copyright info :: {{copyright}}</p>
</p>
</body>
</html>
24 changes: 16 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@
# Copyright © 2023 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

import os
import re
import setuptools


with open("README.md", "r") as fh:
long_description = fh.read()
def read(f):
return open(f, 'r').read()


def get_version(package):
init_py = read(os.path.join(package, '__init__.py'))
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)


version = get_version('bridgeql')

setuptools.setup(
name="bridgeql",
version="0.1.11",
version=version,
author="Piyus Kumar",
author_email="[email protected]",
description="Query language to bridge the gap between REST API and ORM capability",
long_description=long_description,
long_description=read("README.md"),
long_description_content_type="text/markdown",
license='BSD-2',
platforms=['Any'],
Expand All @@ -41,9 +51,7 @@
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Libraries :: Python Modules",
},
packages=[
"bridgeql",
"bridgeql.django",
],
packages=setuptools.find_packages(exclude=['tests*']),
package_data={'': ['templates/**/*.html']},
python_requires=">=2.7"
)
6 changes: 5 additions & 1 deletion tests/server/machine/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

from django.test import TestCase, override_settings

from bridgeql.django.exceptions import InvalidBridgeQLSettings, InvalidAppOrModelName, InvalidModelFieldName
from bridgeql.django.exceptions import (
InvalidAppOrModelName,
InvalidBridgeQLSettings,
InvalidModelFieldName
)
from bridgeql.django.settings import bridgeql_settings


Expand Down
18 changes: 18 additions & 0 deletions tests/server/machine/tests/test_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright © 2023 VMware, Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause

from django.urls import reverse
from django.test import TestCase
from django.test.client import Client


class TestViews(TestCase):

def setUp(self):
self.url = reverse('bridgeql_django_index')
self.client = Client()

def test_page_index(self):
resp = self.client.get(self.url)
self.assertEqual(resp.status_code, 200)