Skip to content

Commit 7ada6cc

Browse files
committed
revert to pkg_resources
Signed-off-by: Danny Chiao <danny@tecton.ai>
1 parent 0411e5a commit 7ada6cc

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

sdk/python/feast/ui_server.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import json
22
import threading
3-
from importlib import resources
43
from typing import Callable, Optional
54

5+
import pkg_resources
66
import uvicorn
77
from fastapi import FastAPI, Response
88
from fastapi.middleware.cors import CORSMiddleware
@@ -53,9 +53,9 @@ def shutdown_event():
5353

5454
async_refresh()
5555

56-
ui_dir = resources.files(__package__).joinpath("ui/build/")
56+
ui_dir = pkg_resources.resource_filename(__name__, "ui/build/")
5757
# Initialize with the projects-list.json file
58-
with ui_dir.joinpath("projects-list.json").open(mode="w") as f:
58+
with open(ui_dir + "projects-list.json", mode="w") as f:
5959
projects_dict = {
6060
"projects": [
6161
{
@@ -82,10 +82,9 @@ def catch_all():
8282

8383
return Response(content, media_type="text/html")
8484

85-
with resources.as_file(ui_dir) as react_app_dir:
86-
app.mount(
87-
"/", StaticFiles(directory=react_app_dir, html=True), name="site",
88-
)
85+
app.mount(
86+
"/", StaticFiles(directory=ui_dir, html=True), name="site",
87+
)
8988

9089
return app
9190

0 commit comments

Comments
 (0)