gradio.themes: get rid of useless re-exports + noqas (#3958)

* gradio.themes.utils: remove star re-exports

* gradio.themes: specify re-exports in __all__

* gradio.themes.app: import create_theme_dropdown from full module path

* Add changelog

* Yeet theme_dropdown CommitOperationAdd

* fixing broken theme path

* version

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
Aarni Koskela 2023-04-25 04:08:55 +03:00 committed by GitHub
parent 1598680376
commit 90f25905d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 24 deletions

View File

@ -29,7 +29,8 @@ No changes to highlight.
## Breaking Changes:
No changes to highlight.
- Some re-exports in `gradio.themes` utilities (introduced in 3.24.0) have been eradicated.
By [@akx](https://github.com/akx) in [PR 3958](https://github.com/gradio-app/gradio/pull/3958)
## Full Changelog:

View File

@ -1,13 +1,27 @@
from gradio.themes import utils # noqa: F401
from gradio.themes.base import Base, ThemeClass # noqa: F401
from gradio.themes.default import Default # noqa: F401
from gradio.themes.glass import Glass # noqa: F401
from gradio.themes.monochrome import Monochrome # noqa: F401
from gradio.themes.soft import Soft # noqa: F401
from gradio.themes.utils import colors, sizes # noqa: F401
from gradio.themes.utils.colors import Color # noqa: F401
from gradio.themes.utils.fonts import Font, GoogleFont # noqa: F401
from gradio.themes.utils.sizes import Size # noqa: F401
from gradio.themes.base import Base, ThemeClass
from gradio.themes.default import Default
from gradio.themes.glass import Glass
from gradio.themes.monochrome import Monochrome
from gradio.themes.soft import Soft
from gradio.themes.utils import colors, sizes
from gradio.themes.utils.colors import Color
from gradio.themes.utils.fonts import Font, GoogleFont
from gradio.themes.utils.sizes import Size
__all__ = [
"Base",
"Color",
"Default",
"Font",
"Glass",
"GoogleFont",
"Monochrome",
"Size",
"Soft",
"ThemeClass",
"colors",
"sizes",
]
def builder(*args, **kwargs):

View File

@ -1,8 +1,7 @@
import time
from theme_dropdown import create_theme_dropdown # noqa: F401
import gradio as gr
from gradio.themes.utils.theme_dropdown import create_theme_dropdown
dropdown, js = create_theme_dropdown()

View File

@ -292,12 +292,6 @@ class ThemeClass:
path_in_repo="README.md", path_or_fileobj=readme_file.name
),
CommitOperationAdd(path_in_repo="app.py", path_or_fileobj=app_file.name),
CommitOperationAdd(
path_in_repo="theme_dropdown.py",
path_or_fileobj=str(
Path(__file__).parent / "utils" / "theme_dropdown.py"
),
),
]
huggingface_hub.create_repo(

View File

@ -1,8 +1,11 @@
from .colors import * # noqa: F401
from .fonts import * # noqa: F401
from .semver_match import ( # noqa: F401
from .semver_match import (
ThemeAsset,
get_matching_version,
get_theme_assets,
)
from .sizes import * # noqa: F401
__all__ = [
"ThemeAsset",
"get_theme_assets",
"get_matching_version",
]

View File

@ -7,7 +7,7 @@ from gradio.themes.utils import ThemeAsset
def create_theme_dropdown():
import gradio as gr
asset_path = pathlib.Path(__file__).parent / "themes"
asset_path = pathlib.Path() / "themes"
themes = []
for theme_asset in os.listdir(str(asset_path)):
themes.append(