streambricks 0.0.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {streambricks-0.0.1 → streambricks-0.1.2}/PKG-INFO +1 -1
- streambricks-0.1.2/src/streambricks/__init__.py +8 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/src/streambricks/helpers.py +48 -48
- {streambricks-0.0.1 → streambricks-0.1.2}/src/streambricks/widgets/__init__.py +6 -6
- {streambricks-0.0.1 → streambricks-0.1.2}/src/streambricks/widgets/model_widget.py +886 -1123
- {streambricks-0.0.1 → streambricks-0.1.2}/src/streambricks/widgets/multi_select.py +91 -91
- streambricks-0.1.2/src/streambricks/widgets/type_helpers.py +205 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/tests/test_widgets.py +7 -7
- streambricks-0.0.1/src/streambricks/__init__.py +0 -8
- {streambricks-0.0.1 → streambricks-0.1.2}/.copier-answers.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.github/FUNDING.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.github/copilot-instructions.md +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.github/dependabot.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.github/workflows/build.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.github/workflows/documentation.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.gitignore +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/.pre-commit-config.yaml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/LICENSE +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/README.md +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/docs/.empty +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/duties.py +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/mkdocs.yml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/overrides/_dummy.txt +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/pyproject.toml +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/src/streambricks/py.typed +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/tests/__init__.py +0 -0
- {streambricks-0.0.1 → streambricks-0.1.2}/tests/conftest.py +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
__version__ = "0.1.2"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from streambricks.widgets.model_widget import render_model_form
|
|
5
|
+
from streambricks.widgets.multi_select import multiselect, MultiSelectItem
|
|
6
|
+
from streambricks.helpers import run
|
|
7
|
+
|
|
8
|
+
__all__ = ["MultiSelectItem", "multiselect", "render_model_form", "run"]
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"""Utility functions for Streamlit applications."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import asyncio
|
|
6
|
-
import inspect
|
|
7
|
-
import sys
|
|
8
|
-
from typing import TYPE_CHECKING, Any, TypeVar
|
|
9
|
-
|
|
10
|
-
from streamlit import runtime
|
|
11
|
-
from streamlit.web.cli import main
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from collections.abc import Callable, Coroutine
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
T = TypeVar("T")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def run(
|
|
22
|
-
fn: Callable[..., T | Coroutine[Any, Any, T]] | Coroutine[Any, Any, T],
|
|
23
|
-
*args: Any,
|
|
24
|
-
**kwargs: Any,
|
|
25
|
-
) -> None:
|
|
26
|
-
"""Run a function or coroutine with Streamlit.
|
|
27
|
-
|
|
28
|
-
If Streamlit runtime exists, execute the function directly. Otherwise,
|
|
29
|
-
start Streamlit with the current script.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
fn: The function or coroutine to run
|
|
33
|
-
args: Positional arguments to pass to the function
|
|
34
|
-
kwargs: Keyword arguments to pass to the function
|
|
35
|
-
"""
|
|
36
|
-
if runtime.exists():
|
|
37
|
-
if inspect.iscoroutine(fn):
|
|
38
|
-
asyncio.run(fn)
|
|
39
|
-
# Handle coroutine function
|
|
40
|
-
elif inspect.iscoroutinefunction(fn):
|
|
41
|
-
coro = fn(*args, **kwargs)
|
|
42
|
-
asyncio.run(coro)
|
|
43
|
-
# Handle regular function
|
|
44
|
-
else:
|
|
45
|
-
fn(*args, **kwargs) # type: ignore
|
|
46
|
-
else:
|
|
47
|
-
sys.argv = ["streamlit", "run", sys.argv[0]]
|
|
48
|
-
sys.exit(main())
|
|
1
|
+
"""Utility functions for Streamlit applications."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import inspect
|
|
7
|
+
import sys
|
|
8
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
9
|
+
|
|
10
|
+
from streamlit import runtime
|
|
11
|
+
from streamlit.web.cli import main
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from collections.abc import Callable, Coroutine
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
T = TypeVar("T")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def run(
|
|
22
|
+
fn: Callable[..., T | Coroutine[Any, Any, T]] | Coroutine[Any, Any, T],
|
|
23
|
+
*args: Any,
|
|
24
|
+
**kwargs: Any,
|
|
25
|
+
) -> None:
|
|
26
|
+
"""Run a function or coroutine with Streamlit.
|
|
27
|
+
|
|
28
|
+
If Streamlit runtime exists, execute the function directly. Otherwise,
|
|
29
|
+
start Streamlit with the current script.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
fn: The function or coroutine to run
|
|
33
|
+
args: Positional arguments to pass to the function
|
|
34
|
+
kwargs: Keyword arguments to pass to the function
|
|
35
|
+
"""
|
|
36
|
+
if runtime.exists():
|
|
37
|
+
if inspect.iscoroutine(fn):
|
|
38
|
+
asyncio.run(fn)
|
|
39
|
+
# Handle coroutine function
|
|
40
|
+
elif inspect.iscoroutinefunction(fn):
|
|
41
|
+
coro = fn(*args, **kwargs)
|
|
42
|
+
asyncio.run(coro)
|
|
43
|
+
# Handle regular function
|
|
44
|
+
else:
|
|
45
|
+
fn(*args, **kwargs) # type: ignore
|
|
46
|
+
else:
|
|
47
|
+
sys.argv = ["streamlit", "run", sys.argv[0]]
|
|
48
|
+
sys.exit(main())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""Streamlit widgets."""
|
|
2
|
-
|
|
3
|
-
from streambricks.widgets.model_widget import render_model_form
|
|
4
|
-
from streambricks.widgets.multi_select import multiselect
|
|
5
|
-
|
|
6
|
-
__all__ = ["multiselect", "render_model_form"]
|
|
1
|
+
"""Streamlit widgets."""
|
|
2
|
+
|
|
3
|
+
from streambricks.widgets.model_widget import render_model_form
|
|
4
|
+
from streambricks.widgets.multi_select import multiselect
|
|
5
|
+
|
|
6
|
+
__all__ = ["multiselect", "render_model_form"]
|