Skip to content

Commit

Permalink
Separate FastAPI and Starlette imports for __all__
Browse files Browse the repository at this point in the history
#20
#32
#33

This commit will refine the imports in inboard/`__init__.py` so that
FastAPI and Starlette are imported separately. This way, if Starlette is
installed but FastAPI is not, the HTTP Basic auth implementation for
Starlette can still be imported and added to `__all__`.
  • Loading branch information
br3ndonland committed Apr 19, 2021
1 parent d5ba52a commit 94879d4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions inboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
https://github.com/br3ndonland/inboard
"""
# FastAPI and Starlette are optional, and will raise ImportErrors if not installed.
try:
# FastAPI and Starlette are optional dependencies
from .app.utilities_fastapi import basic_auth as fastapi_basic_auth
except ImportError: # pragma: no cover
pass
try:
from .app.utilities_starlette import BasicAuth as StarletteBasicAuth
except ImportError: # pragma: no cover
# ImportError exceptions will be raised if optional dependencies are not installed
pass
from .logging_conf import LOGGING_CONFIG, configure_logging

Expand Down

0 comments on commit 94879d4

Please sign in to comment.