-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Felixoid/actions
Add actions, tests. Fix building
- Loading branch information
Showing
7 changed files
with
86 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Python package | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.5, 3.6, 3.7, 3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
pip install flake8 | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env python | ||
|
||
__version__ = '0.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
#!/usr/bin/env python | ||
|
||
from setuptools import setup, find_packages # type: ignore | ||
|
||
try: | ||
from clickhouse_plantuml import VERSION | ||
except ModuleNotFoundError: | ||
# Dirty hack to allow `pip install .` in virtualenv | ||
VERSION = (0, 1) | ||
pkg_name = 'clickhouse_plantuml' | ||
|
||
with open('{}/version.py'.format(pkg_name)) as f: | ||
for line in f: | ||
if line.startswith('__version__'): | ||
delim = '"' if '"' in line else "'" | ||
__version__ = line.split(delim)[1] | ||
|
||
with open('README.md') as f: | ||
long_description = f.read() | ||
|
||
setup( | ||
name='clickhouse-plantuml', | ||
version='.'.join(str(d) for d in VERSION), | ||
name=pkg_name, | ||
version=__version__, # noqa: F821 from exec | ||
description='Generates PlantUML diagrams for clickhouse databases', | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
url='http://github.com/Felixoid/clickhouse-plantuml', | ||
author='Mikhail f. Shiryaev', | ||
author_email='[email protected]', | ||
license='License :: OSI Approved :: Apache Software License', | ||
install_requires=['clickhouse-driver'], | ||
packages=find_packages(), | ||
classifiers=[ | ||
'Database', | ||
'Development Status :: 4 - Beta', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: Information Technology', | ||
|
@@ -31,15 +35,17 @@ | |
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Scientific/Engineering :: Information Analysis', | ||
'Topic :: Scientific/Engineering :: Visualisatino', | ||
'Topic :: Database', | ||
'Topic :: Scientific/Engineering :: Information Analysis', | ||
'Topic :: Scientific/Engineering :: Visualization', | ||
'Topic :: Software Development :: Documentation', | ||
'Topic :: Software Development :: Libraries', | ||
], | ||
python_requires='>=3', | ||
data_files=[('', ['LICENSE', 'example.png'])], | ||
entry_points={ | ||
'console_scripts': [ | ||
'clickhouse-plantuml = clickhouse_plantuml.__main__:main' | ||
] | ||
} | ||
}, | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import unittest | ||
from clickhouse_plantuml import plantuml | ||
|
||
|
||
class TestPlantuml(unittest.TestCase): | ||
|
||
def test_plantuml_header(self): | ||
assert plantuml.plantuml_header() == '''@startuml | ||
!define Table(x) class x << (T,mistyrose) >> | ||
!define View(x) class x << (V,lightblue) >> | ||
!define MaterializedView(x) class x << (m,orange) >> | ||
!define Distributed(x) class x << (D,violet) >> | ||
hide empty methods | ||
hide stereotypes | ||
skinparam classarrowcolor gray | ||
''' | ||
|
||
def test_plantuml_footer(self): | ||
assert plantuml.plantuml_footer() == '@enduml' | ||
|
||
def test_table_macros(self): | ||
assert plantuml.table_macros('MaterializedView') == 'MaterializedView' | ||
assert plantuml.table_macros('View') == 'View' | ||
assert plantuml.table_macros('Distributed') == 'Distributed' | ||
assert plantuml.table_macros('SomeRandEngine') == 'Table' |