Skip to content

Commit

Permalink
fix: root path
Browse files Browse the repository at this point in the history
fix: bump siibra-python version
  • Loading branch information
xgui3783 committed Dec 17, 2024
1 parent 60599b3 commit e17ef32
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
66 changes: 33 additions & 33 deletions api/server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,39 +67,6 @@
expose_headers=[siibra_version_header]
)


_code_meta = None
@siibra_api.get("/about", include_in_schema=False)
def servicemeta():
global _code_meta
if _code_meta is None:
with open(Path(__file__).parent.parent.parent / "codemeta.json", "r") as fp:
_code_meta = json.load(fp=fp)
if _code_meta is None:
raise Exception("code meta is not found, cannot populate servicemeta")
return {
"@context": "https://gitlab.ebrains.eu/lauramble/servicemeta/-/raw/main/data/contexts/servicemeta.jsonld",
"type": "WebApplication",
"author": _code_meta["author"],
"dateModified": _code_meta["dateModified"],
"documentation": DOCUMENTATION_URL,
"name": _code_meta["name"],
"version": _code_meta["version"],
"inputFormat": INPUT_FORMAT,
"outputFormat": OUTPUT_FORMAT
}

@siibra_api.get("/", include_in_schema=False)
def get_home(request: Request):
"""Return the template for the siibra landing page."""
return templates.TemplateResponse(
"index.html", context={
"request": request,
"api_version": __version__,
"git_hash": GIT_HASH,
"versions": ["v3_0", "v2_0", "v1_0"]
})

# Each middleware function is called before the request is processed
# For FastAPI the order is important.
# The functions are called (perhaps counter-intuitively) from bottom to top.
Expand Down Expand Up @@ -377,6 +344,39 @@ async def exception_other(request: Request, exc: Exception):

# it seems other mounts must be mounted **after** VersionedFastAPI is called
templates = Jinja2Templates(directory="templates/")

_code_meta = None
@siibra_api.get("/about", include_in_schema=False)
def servicemeta():
global _code_meta
if _code_meta is None:
with open(Path(__file__).parent.parent.parent / "codemeta.json", "r") as fp:
_code_meta = json.load(fp=fp)
if _code_meta is None:
raise Exception("code meta is not found, cannot populate servicemeta")
return {
"@context": "https://gitlab.ebrains.eu/lauramble/servicemeta/-/raw/main/data/contexts/servicemeta.jsonld",
"type": "WebApplication",
"author": _code_meta["author"],
"dateModified": _code_meta["dateModified"],
"documentation": DOCUMENTATION_URL,
"name": _code_meta["name"],
"version": _code_meta["version"],
"inputFormat": INPUT_FORMAT,
"outputFormat": OUTPUT_FORMAT
}

@siibra_api.get("/", include_in_schema=False)
def get_home(request: Request):
"""Return the template for the siibra landing page."""
return templates.TemplateResponse(
"index.html", context={
"request": request,
"api_version": __version__,
"git_hash": GIT_HASH,
"versions": ["v3_0", "v2_0", "v1_0"]
})

siibra_api.mount("/static", StaticFiles(directory="static"), name="static")

@siibra_api.get("/metrics", include_in_schema=False)
Expand Down
2 changes: 1 addition & 1 deletion requirements/siibra.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
siibra==0.4a83
siibra==0.4a84
plotly

0 comments on commit e17ef32

Please sign in to comment.