Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove two dependencies: importlib_resources and urllib3 (if not in Wasm) #9321

Merged
merged 8 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/cute-rules-write.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": minor
---

feat:Remove another dependency: `importlib_resources`
9 changes: 5 additions & 4 deletions gradio/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import asyncio
import contextlib
import hashlib
import importlib
import importlib.resources
import inspect
import json
import math
Expand Down Expand Up @@ -45,7 +47,6 @@
from gradio_client import utils as client_utils
from gradio_client.documentation import document
from gradio_client.utils import ServerMessage
from importlib_resources import files
from jinja2.exceptions import TemplateNotFound
from multipart.multipart import parse_options_header
from starlette.background import BackgroundTask
Expand Down Expand Up @@ -103,15 +104,15 @@

STATIC_TEMPLATE_LIB = cast(
DeveloperPath,
files("gradio").joinpath("templates").as_posix(), # type: ignore
importlib.resources.files("gradio").joinpath("templates").as_posix(), # type: ignore
)
STATIC_PATH_LIB = cast(
DeveloperPath,
files("gradio").joinpath("templates", "frontend", "static").as_posix(), # type: ignore
importlib.resources.files("gradio").joinpath("templates", "frontend", "static").as_posix(), # type: ignore
)
BUILD_PATH_LIB = cast(
DeveloperPath,
files("gradio").joinpath("templates", "frontend", "assets").as_posix(), # type: ignore
importlib.resources.files("gradio").joinpath("templates", "frontend", "assets").as_posix(), # type: ignore
)
VERSION = get_package_version()
XSS_SAFE_MIMETYPES = {
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ffmpy
gradio_client==1.4.0-beta.1
httpx>=0.24.1
huggingface_hub>=0.19.3
importlib_resources>=1.3,<7.0
Jinja2<4.0
markupsafe~=2.0
numpy>=1.0,<3.0
Expand Down
Loading