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

chore: explicitly re-export components #951

Open
wants to merge 1 commit into
base: 12-23-feat_change_mutation_detection_and_allow_reactive_boolean_defaults
Choose a base branch
from
Open
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
6 changes: 2 additions & 4 deletions solara/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def _using_solara_server():
use_state,
use_state_widget,
)
from reacton.core import Element
from .core import component
from reacton.core import Element as Element
from .core import component as component

try:
import ipyvuetify.components as v # type: ignore
Expand All @@ -57,9 +57,7 @@ def _using_solara_server():
from .cache import memoize
from . import cache

# TODO: components re-exports v, we should use __all__ in components/misc.py
from .components import * # type: ignore
from .components import _component_vue

from .routing import use_route, use_router, use_route_level, find_route, use_pathname, resolve_path
from .autorouting import generate_routes, generate_routes_directory, RenderPage, RoutingProvider, DefaultLayout
Expand Down
211 changes: 163 additions & 48 deletions solara/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,82 @@
# isort: skip_file
from .button import Button # noqa: F401
from .style import Style # noqa: F401 F403
from .misc import * # noqa: F401 F403
from .alert import Warning, Info, Error, Success # noqa: F401 F403
from .checkbox import Checkbox # noqa: F401 F403
from .cross_filter import ( # noqa: F401
from .button import Button
from .style import Style
from .misc import (
Navigator,
GridDraggable,
GridLayout,
ListItem,
ui_dropdown,
ui_text,
ui_checkbox,
ui_slider,
Text,
Div,
Preformatted,
IconButton,
HTML,
VBox,
HBox,
Row,
Column,
GridFixed,
Padding,
FigurePlotly,
Code,
)
from .alert import Warning, Info, Error, Success
from .checkbox import Checkbox
from .cross_filter import (
CrossFilterDataFrame,
CrossFilterReport,
CrossFilterSelect,
CrossFilterSlider,
)
from .datatable import DataTable, DataFrame # noqa: F401 F403
from .details import Details # noqa: F401 F403
from .file_browser import FileBrowser # noqa: F401 F403
from .image import Image # noqa: F401 F403
from .markdown import Markdown, MarkdownIt # noqa: F401 F403
from .slider import ( # noqa: F401 F403
DateSlider, # noqa: F401 F403
FloatSlider, # noqa: F401 F403
IntSlider, # noqa: F401 F403
ValueSlider, # noqa: F401 F403
SliderDate, # noqa: F401 F403
SliderFloat, # noqa: F401 F403
SliderInt, # noqa: F401 F403
SliderValue, # noqa: F401 F403
SliderRangeInt, # noqa: F401 F403
SliderRangeFloat, # noqa: F401 F403
) # noqa: F401 F403
from .sql_code import SqlCode # noqa: F401 F403
from .togglebuttons import ( # noqa: F401 F403
from .datatable import DataTable, DataFrame
from .details import Details
from .file_browser import FileBrowser
from .image import Image
from .markdown import Markdown, MarkdownIt
from .slider import (
DateSlider,
FloatSlider,
IntSlider,
ValueSlider,
SliderDate,
SliderFloat,
SliderInt,
SliderValue,
SliderRangeInt,
SliderRangeFloat,
)
from .sql_code import SqlCode
from .togglebuttons import (
ToggleButtonsMultiple,
ToggleButtonsSingle,
)
from .input import InputText, InputFloat, InputInt # noqa: F401 F403
from .input_text_area import InputTextArea # noqa: F401 F403
from .pivot_table import PivotTableView, PivotTable, PivotTableCard # noqa: F401 F403
from .head import Head # noqa: F401 F403
from .title import Title # noqa: F401 F403
from .link import Link # noqa: F401 F403
from .applayout import AppLayout, Sidebar, AppBar, AppBarTitle # noqa: F401 F403
from .tab_navigation import TabNavigation # noqa: F401 F403
from .markdown_editor import MarkdownEditor # noqa: F401 F403
from .select import Select, SelectMultiple # noqa: F401 F403
from .matplotlib import FigureMatplotlib # noqa: F401 F403
from .echarts import FigureEcharts # noqa: F401 F403
from .figure_altair import FigureAltair, AltairChart # noqa: F401 F403
from .meta import Meta # noqa: F401 F403
from .columns import Columns, ColumnsResponsive # noqa: F401 F403
from .file_drop import FileDrop, FileDropMultiple # noqa: F401 F403
from .file_download import FileDownload # noqa: F401 F403
from .tooltip import Tooltip # noqa: F401 F403
from .card import Card, CardActions # noqa: F401 F403
from .spinner import SpinnerSolara # noqa: F401 F403
from .switch import Switch # noqa: F401 F403
from .progress import ProgressLinear # noqa: F401 F403
from .component_vue import _component_vue, component_vue # noqa: F401 F403
from .input import InputText, InputFloat, InputInt
from .input_text_area import InputTextArea
from .pivot_table import PivotTableView, PivotTable, PivotTableCard
from .head import Head
from .title import Title
from .link import Link
from .applayout import AppLayout, Sidebar, AppBar, AppBarTitle
from .tab_navigation import TabNavigation
from .markdown_editor import MarkdownEditor
from .select import Select, SelectMultiple
from .matplotlib import FigureMatplotlib
from .echarts import FigureEcharts
from .figure_altair import FigureAltair, AltairChart
from .meta import Meta
from .columns import Columns, ColumnsResponsive
from .file_drop import FileDrop, FileDropMultiple
from .file_download import FileDownload
from .tooltip import Tooltip
from .card import Card, CardActions
from .spinner import SpinnerSolara
from .switch import Switch
from .progress import ProgressLinear
from .component_vue import _component_vue, component_vue
import reacton.core

try:
Expand All @@ -65,6 +87,99 @@
import logging
from ..settings import main


__all__ = [
"Button",
"Style",
"Navigator",
"GridDraggable",
"GridLayout",
"ListItem",
"ui_dropdown",
"ui_text",
"ui_checkbox",
"ui_slider",
"Text",
"Div",
"Preformatted",
"IconButton",
"HTML",
"VBox",
"HBox",
"Row",
"Column",
"GridFixed",
"Padding",
"FigurePlotly",
"Code",
"Warning",
"Info",
"Error",
"Success",
"Checkbox",
"CrossFilterDataFrame",
"CrossFilterReport",
"CrossFilterSelect",
"CrossFilterSlider",
"DataTable",
"DataFrame",
"Details",
"FileBrowser",
"Image",
"Markdown",
"MarkdownIt",
"DateSlider",
"FloatSlider",
"IntSlider",
"ValueSlider",
"SliderDate",
"SliderFloat",
"SliderInt",
"SliderValue",
"SliderRangeInt",
"SliderRangeFloat",
"SqlCode",
"ToggleButtonsMultiple",
"ToggleButtonsSingle",
"InputText",
"InputFloat",
"InputInt",
"InputTextArea",
"PivotTableView",
"PivotTable",
"PivotTableCard",
"Head",
"Title",
"Link",
"AppLayout",
"Sidebar",
"AppBar",
"AppBarTitle",
"TabNavigation",
"MarkdownEditor",
"Select",
"SelectMultiple",
"FigureMatplotlib",
"FigureEcharts",
"FigureAltair",
"AltairChart",
"Meta",
"Columns",
"ColumnsResponsive",
"FileDrop",
"FileDropMultiple",
"FileDownload",
"Tooltip",
"Card",
"CardActions",
"SpinnerSolara",
"Switch",
"ProgressLinear",
"_component_vue",
"component_vue",
]


_container = None

if main.default_container in globals():
Expand Down
26 changes: 26 additions & 0 deletions solara/components/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@
GridLayout = GridDraggable


# re-export components for typing to pick them up correctly
__all__ = [
"Navigator",
"GridDraggable",
"GridLayout",
"ListItem",
"ui_dropdown",
"ui_text",
"ui_checkbox",
"ui_slider",
"Text",
"Div",
"Preformatted",
"IconButton",
"HTML",
"VBox",
"HBox",
"Row",
"Column",
"GridFixed",
"Padding",
"FigurePlotly",
"Code",
]


@solara.component
def ListItem(title, icon_name: str = None, children=[], value=None):
if value is None:
Expand Down
53 changes: 48 additions & 5 deletions solara/lab/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,52 @@
# isort: skip_file
from .components import * # noqa: F401, F403
from .utils import cookies, headers # noqa: F401, F403
from ..lifecycle import on_kernel_start # noqa: F401
from ..tasks import task, use_task, Task, TaskResult # noqa: F401, F403
from ..toestand import computed # noqa: F401
from .components import (
ChatBox,
ChatInput,
ChatMessage,
ConfirmationDialog,
InputDate,
InputDateRange,
InputTime,
ClickMenu,
ContextMenu,
Menu,
Tab,
Tabs,
ThemeToggle,
theme,
use_dark_effective,
)
from .utils import cookies, headers
from ..lifecycle import on_kernel_start
from ..tasks import task, use_task, Task, TaskResult
from ..toestand import computed


__all__ = [
"ChatBox",
"ChatInput",
"ChatMessage",
"ConfirmationDialog",
"InputDate",
"InputDateRange",
"InputTime",
"ClickMenu",
"ContextMenu",
"Menu",
"Tab",
"Tabs",
"ThemeToggle",
"theme",
"use_dark_effective",
"cookies",
"headers",
"on_kernel_start",
"task",
"use_task",
"Task",
"TaskResult",
"computed",
]


def __getattr__(name):
Expand Down
31 changes: 25 additions & 6 deletions solara/lab/components/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
from .chat import ChatBox, ChatInput, ChatMessage # noqa: F401
from .confirmation_dialog import ConfirmationDialog # noqa: F401
from .input_date import InputDate, InputDateRange # noqa: F401
from .chat import ChatBox, ChatInput, ChatMessage
from .confirmation_dialog import ConfirmationDialog
from .input_date import InputDate, InputDateRange
from .input_time import InputTime as InputTime
from .menu import ClickMenu, ContextMenu, Menu # noqa: F401 F403
from .tabs import Tab, Tabs # noqa: F401
from .theming import ThemeToggle, theme, use_dark_effective # noqa: F401
from .menu import ClickMenu, ContextMenu, Menu
from .tabs import Tab, Tabs
from .theming import ThemeToggle, theme, use_dark_effective


__all__ = [
"ChatBox",
"ChatInput",
"ChatMessage",
"ConfirmationDialog",
"InputDate",
"InputDateRange",
"InputTime",
"ClickMenu",
"ContextMenu",
"Menu",
"Tab",
"Tabs",
"ThemeToggle",
"theme",
"use_dark_effective",
]
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def run_timer():
if seconds:
solara.Markdown(f"# {seconds} seconds left")
else:
solara.solara.Markdown("# Time's up!")
solara.Markdown("# Time's up!")

solara.v.TextField(type="number", v_model=duration, on_v_model=on_duration, disabled=running)
with solara.Row():
Expand Down
Loading