streambricks 0.2.0__tar.gz → 0.2.1__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.
Files changed (28) hide show
  1. {streambricks-0.2.0 → streambricks-0.2.1}/PKG-INFO +1 -1
  2. streambricks-0.2.1/src/streambricks/__init__.py +16 -0
  3. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/widgets/model_selector.py +2 -19
  4. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/widgets/model_widget.py +1 -1
  5. streambricks-0.2.0/src/streambricks/__init__.py +0 -8
  6. {streambricks-0.2.0 → streambricks-0.2.1}/.copier-answers.yml +0 -0
  7. {streambricks-0.2.0 → streambricks-0.2.1}/.github/FUNDING.yml +0 -0
  8. {streambricks-0.2.0 → streambricks-0.2.1}/.github/copilot-instructions.md +0 -0
  9. {streambricks-0.2.0 → streambricks-0.2.1}/.github/dependabot.yml +0 -0
  10. {streambricks-0.2.0 → streambricks-0.2.1}/.github/workflows/build.yml +0 -0
  11. {streambricks-0.2.0 → streambricks-0.2.1}/.github/workflows/documentation.yml +0 -0
  12. {streambricks-0.2.0 → streambricks-0.2.1}/.gitignore +0 -0
  13. {streambricks-0.2.0 → streambricks-0.2.1}/.pre-commit-config.yaml +0 -0
  14. {streambricks-0.2.0 → streambricks-0.2.1}/LICENSE +0 -0
  15. {streambricks-0.2.0 → streambricks-0.2.1}/README.md +0 -0
  16. {streambricks-0.2.0 → streambricks-0.2.1}/docs/.empty +0 -0
  17. {streambricks-0.2.0 → streambricks-0.2.1}/duties.py +0 -0
  18. {streambricks-0.2.0 → streambricks-0.2.1}/mkdocs.yml +0 -0
  19. {streambricks-0.2.0 → streambricks-0.2.1}/overrides/_dummy.txt +0 -0
  20. {streambricks-0.2.0 → streambricks-0.2.1}/pyproject.toml +0 -0
  21. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/helpers.py +0 -0
  22. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/py.typed +0 -0
  23. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/widgets/__init__.py +0 -0
  24. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/widgets/multi_select.py +0 -0
  25. {streambricks-0.2.0 → streambricks-0.2.1}/src/streambricks/widgets/type_helpers.py +0 -0
  26. {streambricks-0.2.0 → streambricks-0.2.1}/tests/__init__.py +0 -0
  27. {streambricks-0.2.0 → streambricks-0.2.1}/tests/conftest.py +0 -0
  28. {streambricks-0.2.0 → streambricks-0.2.1}/tests/test_widgets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streambricks
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Streamlit widgets and helpers
5
5
  Project-URL: Documentation, https://phil65.github.io/streambricks/
6
6
  Project-URL: Source, https://github.com/phil65/streambricks
@@ -0,0 +1,16 @@
1
+ __version__ = "0.2.1"
2
+
3
+
4
+ from streambricks.widgets.model_widget import render_model_form, render_model_readonly
5
+ from streambricks.widgets.multi_select import multiselect, MultiSelectItem
6
+ from streambricks.widgets.model_selector import model_selector
7
+ from streambricks.helpers import run
8
+
9
+ __all__ = [
10
+ "MultiSelectItem",
11
+ "model_selector",
12
+ "multiselect",
13
+ "render_model_form",
14
+ "render_model_readonly",
15
+ "run",
16
+ ]
@@ -32,14 +32,9 @@ def model_selector(
32
32
  from tokonomics.model_discovery import get_all_models_sync
33
33
 
34
34
  models = get_all_models_sync(providers=providers)
35
-
36
- # Get unique providers from models
37
35
  available_providers = sorted({model.provider for model in models})
38
-
39
- # Get current model info to set initial selections
40
36
  current_model = None
41
37
  current_provider = None
42
-
43
38
  if initial_model:
44
39
  current_model = next(
45
40
  (m for m in models if m.pydantic_ai_id == initial_model),
@@ -48,7 +43,6 @@ def model_selector(
48
43
  if current_model:
49
44
  current_provider = current_model.provider
50
45
 
51
- # Provider selection
52
46
  if len(available_providers) > 1:
53
47
  default_provider_idx = (
54
48
  available_providers.index(current_provider)
@@ -65,8 +59,6 @@ def model_selector(
65
59
 
66
60
  provider_models = [m for m in models if m.provider == selected_provider]
67
61
  model_names = [m.name for m in provider_models]
68
-
69
- # Determine initial model index
70
62
  default_model_idx = 0
71
63
  if current_model and current_model.provider == selected_provider:
72
64
  try:
@@ -74,17 +66,8 @@ def model_selector(
74
66
  except ValueError:
75
67
  default_model_idx = 0
76
68
 
77
- selected_name = st.selectbox(
78
- "Model",
79
- options=model_names,
80
- index=default_model_idx,
81
- )
82
-
83
- selected_model = next(
84
- (m for m in provider_models if m.name == selected_name),
85
- None,
86
- )
87
-
69
+ selected_name = st.selectbox("Model", options=model_names, index=default_model_idx)
70
+ selected_model = next((m for m in provider_models if m.name == selected_name), None)
88
71
  if selected_model:
89
72
  with st.expander("Model Details", expanded=expanded):
90
73
  st.markdown(selected_model.format())
@@ -599,7 +599,7 @@ def get_field_renderer(field_info: dict[str, Any]) -> WidgetFunc[Any]: # noqa:
599
599
  raise ValueError(error_msg)
600
600
 
601
601
 
602
- def render_model_readonly(model_class, instance):
602
+ def render_model_readonly[T](model_class: type[T], instance: T | None = None):
603
603
  """Render a model in read-only mode using a clean label-based layout."""
604
604
  if instance is None:
605
605
  st.info("No data available")
@@ -1,8 +0,0 @@
1
- __version__ = "0.2.0"
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"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes