Skip to content

Commit

Permalink
Optional uvicorn import for Pyodide, refs #1733
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed May 2, 2022
1 parent 7d3cec7 commit fb26057
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,13 +804,23 @@ def _versions(self):
datasette_version = {"version": __version__}
if self.version_note:
datasette_version["note"] = self.version_note

try:
# Optional import to avoid breaking Pyodide
# https://github.com/simonw/datasette/issues/1733#issuecomment-1115268245
import uvicorn

uvicorn_version = uvicorn.__version__
except ImportError:
uvicorn_version = None
info = {
"python": {
"version": ".".join(map(str, sys.version_info[:3])),
"full": sys.version,
},
"datasette": datasette_version,
"asgi": "3.0",
"uvicorn": uvicorn_version,
"sqlite": {
"version": sqlite_version,
"fts_versions": fts_versions,
Expand Down

0 comments on commit fb26057

Please sign in to comment.