From 342c0ae1ffd28a73988ebea8efa3287fea4b5348 Mon Sep 17 00:00:00 2001 From: "thomas.woehlke" <thomas.woehlke@rub.de> Date: Thu, 25 Feb 2021 11:52:20 +0100 Subject: [PATCH] Default task --- etc/TODO.md | 11 ++++++++++- requirements/build.in | 4 +++- requirements/build.txt | 6 ++++-- requirements/dev.in | 15 --------------- requirements/dev.txt | 3 +-- requirements/docs.in | 4 ---- requirements/tests.in | 3 +-- setup.py | 7 ++----- src/database.py | 8 +++++++- 9 files changed, 28 insertions(+), 33 deletions(-) diff --git a/etc/TODO.md b/etc/TODO.md index 74e7c4fc..2af000d8 100644 --- a/etc/TODO.md +++ b/etc/TODO.md @@ -46,4 +46,13 @@ * Fixed #41 SQLalchemy instead of SQL: EcdcImport.get_countries_of_continent() * Fixed #107 SQLalchemy instead of SQL in: EcdcImport.get_countries_of_continent * Fixed #109 SQLalchemy instead of SQL in: EcdcImport.get_date_rep -* Fixed #110 SQLalchemy instead of SQL in: EcdcImport.get_continent \ No newline at end of file +* Fixed #110 SQLalchemy instead of SQL in: EcdcImport.get_continent + +### Research +* add Flask-Caching https://pypi.org/project/Flask-Caching/ +* add Flask-Monitoring https://pypi.org/project/Flask-Monitoring/ +* add Flask-Redisboard https://pypi.org/project/Flask-Redisboard/ +* add Flask-Babel https://pypi.org/project/Flask-Babel/ +* add flask-resources https://pypi.org/project/flask-resources/ +* add flask-whooshalchemy3 https://pypi.org/project/flask-whooshalchemy3/ https://github.com/blakev/Flask-WhooshAlchemy3 +* add flask-filealchemy https://pypi.org/project/flask-filealchemy/ diff --git a/requirements/build.in b/requirements/build.in index d0bb3a33..55fcc8b3 100644 --- a/requirements/build.in +++ b/requirements/build.in @@ -10,4 +10,6 @@ pytoml==0.1.21 venv-run==0.1.0 six==1.13.0 pbr==3.1.1 -pre-commit==2.10.1 \ No newline at end of file +pre-commit==2.10.1 +chardet==3.0.4 +python-dotenv>=0.15.0 diff --git a/requirements/build.txt b/requirements/build.txt index cbd0a7a2..5c389499 100644 --- a/requirements/build.txt +++ b/requirements/build.txt @@ -14,8 +14,10 @@ certifi==2020.12.5 # requests cfgv==3.2.0 # via pre-commit -chardet==4.0.0 - # via requests +chardet==3.0.4 + # via + # -r requirements\build.in + # requests click==7.1.2 # via pip-tools distlib==0.3.1 diff --git a/requirements/dev.in b/requirements/dev.in index b00b6da4..f086f1a9 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -5,27 +5,17 @@ Flask>=1.1.2 Flask-SQLAlchemy>=2.4.4 Flask-Cors>=3.0.10 Flask-BS4>=4.5.3.0,<5.0.0.0 -flask-resources==0.6.0 -Flask-ResponseBuilder>=2.0.12 Flask-Babel>=2 Flask-Admin>=1.5.7 Flask-Redisboard>=0.2.0 -Flask-Monitoring>=1.1.2 -flask-healthz>=0.0.2 -Flask-Caching>=1.9.0 -Flask-DB>=0.3.0 -Flask-Moment>=0.11.0 flask-whooshalchemy3>=0.2.0 Flask-PluginKit>=3.6.0 -flask-filealchemy>=0.6.1 SQLAlchemy>=1.3.23 celery[redis]>=5.0.5 psycopg2>=2.8.6 wget>=3.2 -aiocronjob>=0.2.0 pyecharts>=1.9.0 pyecharts-extras>=0.0.5 -reactive-pyecharts>=1.0.0 visdom>=0.1.8.9 pynndescent>=0.5.1 torch>=1.7.1 @@ -33,8 +23,3 @@ numpy>=1.20.1 pandas>=1.1.0 scipy>=1.5.0 StatisticalDiagrams>=20.5 -#chardet==3.0.4 -chardet==4.0.0 -pytz==2021.1 -ruamel.yaml==0.1.6.12 -identify==1.5.14 diff --git a/requirements/dev.txt b/requirements/dev.txt index 1f0bbb1a..57aae828 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -45,7 +45,7 @@ cfgv==3.2.0 # via pre-commit chardet==3.0.4 # via - # -r requirements\dev.in + # -r requirements\build.in # requests cleo==0.8.1 # via plantuml2freemind @@ -380,7 +380,6 @@ pytoolbox==14.0.0 # via -r requirements\build.in pytz==2020.5 # via - # -r requirements\dev.in # aiocronjob # apscheduler # babel diff --git a/requirements/docs.in b/requirements/docs.in index 4408c0c1..c12d2abd 100644 --- a/requirements/docs.in +++ b/requirements/docs.in @@ -1,16 +1,12 @@ sphinx>=3.4.3,<3.5.0 -sphinx-tabs==2.0.1 -sphinx-issues==1.2.0 sphinxcontrib-plantuml==0.19 sphinxcontrib-gravizo==0.0.4 sphinxcontrib-log-cabinet==1.0.1 -pallets-sphinx-themes==1.2.3 py2puml>=0.3.1 plantuml-creator==1.0.7 plantuml-markdown==3.4.2 plantuml-wrapper==0.1.0 plantuml2freemind==0.8.2 plantuml-gentools==0.1.2 -manual-sitemap>=19.6.0 speaklater==1.3 tokenize-rt>=4.1.0 diff --git a/requirements/tests.in b/requirements/tests.in index 06e2eddc..0c0b8387 100644 --- a/requirements/tests.in +++ b/requirements/tests.in @@ -1,4 +1,3 @@ -python-dotenv>=0.15.0 pytest>=5.3.2,<6.0.0 pytest-venv>=0.2.1 pytest-runner>=5.3.0 @@ -6,5 +5,5 @@ pytest-postgresql>=2.6.1 pytest-flask>=1.1.0 pytest-flask-sqlalchemy>=1.0.2 pytest-enabler>=1.2.0 -flask-unittest>=0.1.1 Flask-Fixtures>=0.3.8 +Flask-DB>=0.3.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 840b13c3..c34ecbb8 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ requires_build = [ "argparse==1.4.0", "certifi==2020.12.5", "cfgv==3.2.0", - "chardet==4.0.0", + "chardet==3.0.4", "click==7.1.2", "distlib==0.3.1", "filelock==3.0.12", @@ -132,7 +132,6 @@ requires_docs = [ "markupsafe==1.1.1", "more-itertools==8.0.2", "packaging==20.0", - "pallets-sphinx-themes==1.2.3", "pastel==0.2.1", "pbr==5.5.1", "plantuml-creator==1.0.7", @@ -323,8 +322,6 @@ requires_dev = [ "reactive-pyecharts==1.0.0", "redis==3.5.3", "requests==2.25.1", - "ruamel-yaml==0.16.12", - "ruamel.yaml.clib==0.2.2", "scikit-learn==0.24.1", "scipy==1.6.0", "semver==2.13.0", @@ -390,7 +387,7 @@ packages = find_packages() setup( name='covid19python', version=version, - url='ttps://github.com/thomaswoehlke/covid19python.git', + url='https://github.com/thomaswoehlke/covid19python.git', license='GNU General Public License v3 (GPLv3)', author='Thomas Woehlke', author_email='thomas.woehlke@gmail.com', diff --git a/src/database.py b/src/database.py index 74958155..70c2f07a 100644 --- a/src/database.py +++ b/src/database.py @@ -1,6 +1,8 @@ import logging from flask import Flask, logging import flask_monitoringdashboard as dashboard +from flask_caching import Cache +from flask_pluginkit import PluginManager from flask_redisboard import RedisBoardExtension from flask_cors import CORS from flask_bs4 import Bootstrap @@ -11,6 +13,8 @@ from celery import Celery from celery.utils.log import LoggingProxy board = RedisBoardExtension() +pm = PluginManager() +cache = Cache(config={"CACHE_TYPE": "simple"}) def create_app(): my_app = Flask('covid19') @@ -25,8 +29,10 @@ def create_app(): my_app.config['SQLALCHEMY_DATABASE_URI'] = db_url my_app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # silence the deprecation warning my_app.config['FLASK_ADMIN_SWATCH'] = 'superhero' - #dashboard.bind(my_app) + pm.init_app(app) board.init_app(my_app) + cache.init_app(app) + #dashboard.bind(my_app) return my_app -- GitLab