Admin: Improve UX when Flask dependencies are missing (#5499)

* Revert "Dependencies - always include Flask"

This reverts commit c1a4d0521203370738c02f6ced23bffb6aa724d6.

* UX - Warn user when missing Flask dependencies
This commit is contained in:
Bert Blommers 2022-09-28 14:12:42 +00:00 committed by GitHub
parent e11e4c3551
commit 76b127bba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -3,8 +3,16 @@ import os
import os.path import os.path
from threading import Lock from threading import Lock
from flask import Flask try:
from flask_cors import CORS from flask import Flask
from flask_cors import CORS
except ImportError:
import warnings
warnings.warn(
"When using MotoServer, ensure that you install moto[server] to have all dependencies!\n"
)
raise
import moto.backends as backends import moto.backends as backends
import moto.backend_index as backend_index import moto.backend_index as backend_index

View File

@ -39,8 +39,6 @@ install_requires = [
"MarkupSafe!=2.0.0a1", # This is a Jinja2 dependency, 2.0.0a1 currently seems broken "MarkupSafe!=2.0.0a1", # This is a Jinja2 dependency, 2.0.0a1 currently seems broken
"Jinja2>=2.10.1", "Jinja2>=2.10.1",
"importlib_metadata ; python_version < '3.8'", "importlib_metadata ; python_version < '3.8'",
"flask<2.2.0", # Required for the ThreadedMotoServer
"flask-cors"
] ]
_dep_PyYAML = "PyYAML>=5.1" _dep_PyYAML = "PyYAML>=5.1"
@ -75,7 +73,7 @@ all_extra_deps = [
_dep_openapi, _dep_openapi,
_setuptools, _setuptools,
] ]
all_server_deps = all_extra_deps all_server_deps = all_extra_deps + ["flask<2.2.0", "flask-cors"]
extras_per_service = {} extras_per_service = {}
for service_name in [ for service_name in [