Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions optimade/server/routers/landing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

from pathlib import Path

from fastapi import Request
from fastapi import APIRouter, Request
from fastapi.responses import HTMLResponse
from starlette.routing import Route, Router

from optimade import __api_version__
from optimade.server.config import ServerConfig
Expand Down Expand Up @@ -92,11 +91,11 @@ async def landing(request: Request):
)


router = Router(routes=[Route("/", endpoint=landing)])

## This "fix" is taken directly from FastAPI's APIRouter implementation.
# Handle on_startup/on_shutdown locally since Starlette removed support
# Ref: https://github.com/Kludex/starlette/pull/3117
# TODO: deprecate this once the lifespan (or alternative) interface is improved
router.on_startup = []
router.on_shutdown = []
router = APIRouter(redirect_slashes=True)
router.add_api_route(
"/",
landing,
methods=["GET"],
response_class=HTMLResponse,
include_in_schema=False,
)
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ server = [
# Client minded
aiida = ["aiida-core~=2.1"]

http-client = [
"httpx~=0.23",
"rich>=13,<16",
"click~=8.1",
]
http-client = ["httpx~=0.23", "httpx2", "rich>=13,<16", "click~=8.1"]

ase = ["ase~=3.22"]
cif = ["numpy>=1.22,<3.0"]
Expand Down