streambricks 0.2.20__tar.gz → 0.3.0__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 (42) hide show
  1. {streambricks-0.2.20 → streambricks-0.3.0}/PKG-INFO +32 -37
  2. {streambricks-0.2.20 → streambricks-0.3.0}/README.md +0 -6
  3. streambricks-0.3.0/pyproject.toml +262 -0
  4. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/__init__.py +16 -2
  5. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/auth/decorator.py +2 -6
  6. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/auth/helpers.py +2 -2
  7. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/auth/profile_widget.py +6 -2
  8. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/bind_kwargs.py +4 -8
  9. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/model_widget/main.py +8 -4
  10. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/model_widget/type_renderers.py +6 -2
  11. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/type_helpers.py +1 -1
  12. streambricks-0.2.20/.copier-answers.yml +0 -21
  13. streambricks-0.2.20/.github/FUNDING.yml +0 -3
  14. streambricks-0.2.20/.github/copilot-instructions.md +0 -19
  15. streambricks-0.2.20/.github/dependabot.yml +0 -9
  16. streambricks-0.2.20/.github/workflows/build.yml +0 -88
  17. streambricks-0.2.20/.github/workflows/documentation.yml +0 -57
  18. streambricks-0.2.20/.gitignore +0 -33
  19. streambricks-0.2.20/.pre-commit-config.yaml +0 -48
  20. streambricks-0.2.20/docs/.empty +0 -0
  21. streambricks-0.2.20/docs/profile_widget.md +0 -89
  22. streambricks-0.2.20/duties.py +0 -60
  23. streambricks-0.2.20/mkdocs.yml +0 -92
  24. streambricks-0.2.20/overrides/_dummy.txt +0 -1
  25. streambricks-0.2.20/pyproject.toml +0 -249
  26. streambricks-0.2.20/tests/__init__.py +0 -3
  27. streambricks-0.2.20/tests/conftest.py +0 -1
  28. streambricks-0.2.20/tests/test_widgets.py +0 -7
  29. {streambricks-0.2.20 → streambricks-0.3.0}/LICENSE +0 -0
  30. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/auth/__init__.py +0 -0
  31. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/auth/models.py +0 -0
  32. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/helpers.py +0 -0
  33. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/py.typed +0 -0
  34. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/sidebar.py +0 -0
  35. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/state.py +0 -0
  36. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/__init__.py +0 -0
  37. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/image_capture.py +0 -0
  38. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/model_selector.py +0 -0
  39. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/model_widget/__init__.py +0 -0
  40. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/model_widget/field_metadata_renderers.py +0 -0
  41. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/multi_select.py +0 -0
  42. {streambricks-0.2.20 → streambricks-0.3.0}/src/streambricks/widgets/sequence.py +0 -0
@@ -1,36 +1,32 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.3
2
2
  Name: streambricks
3
- Version: 0.2.20
3
+ Version: 0.3.0
4
4
  Summary: Streamlit widgets and helpers
5
- Project-URL: Documentation, https://phil65.github.io/streambricks/
6
- Project-URL: Source, https://github.com/phil65/streambricks
7
- Project-URL: Issues, https://github.com/phil65/streambricks/issues
8
- Project-URL: Discussions, https://github.com/phil65/streambricks/discussions
9
- Project-URL: Code coverage, https://app.codecov.io/gh/phil65/streambricks
5
+ Keywords:
6
+ Author: Philipp Temminghoff
10
7
  Author-email: Philipp Temminghoff <philipptemminghoff@googlemail.com>
11
8
  License: MIT License
12
-
13
- Copyright (c) 2024, Philipp Temminghoff
14
-
15
- Permission is hereby granted, free of charge, to any person obtaining a copy
16
- of this software and associated documentation files (the "Software"), to deal
17
- in the Software without restriction, including without limitation the rights
18
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
- copies of the Software, and to permit persons to whom the Software is
20
- furnished to do so, subject to the following conditions:
21
-
22
- The above copyright notice and this permission notice shall be included in all
23
- copies or substantial portions of the Software.
24
-
25
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
- SOFTWARE.
32
-
33
- License-File: LICENSE
9
+
10
+ Copyright (c) 2024, Philipp Temminghoff
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
34
30
  Classifier: Development Status :: 4 - Beta
35
31
  Classifier: Intended Audience :: Developers
36
32
  Classifier: Operating System :: OS Independent
@@ -43,19 +39,22 @@ Classifier: Topic :: Documentation
43
39
  Classifier: Topic :: Software Development
44
40
  Classifier: Topic :: Utilities
45
41
  Classifier: Typing :: Typed
46
- Requires-Python: >=3.12
47
42
  Requires-Dist: fieldz>=0.1.0
48
43
  Requires-Dist: streamlit>=1.43.2
44
+ Requires-Dist: authlib ; extra == 'auth'
45
+ Requires-Python: >=3.12
46
+ Project-URL: Code coverage, https://app.codecov.io/gh/phil65/streambricks
47
+ Project-URL: Discussions, https://github.com/phil65/streambricks/discussions
48
+ Project-URL: Documentation, https://phil65.github.io/streambricks/
49
+ Project-URL: Issues, https://github.com/phil65/streambricks/issues
50
+ Project-URL: Source, https://github.com/phil65/streambricks
49
51
  Provides-Extra: auth
50
- Requires-Dist: authlib; extra == 'auth'
51
52
  Description-Content-Type: text/markdown
52
53
 
53
54
  # StreamBricks
54
55
 
55
56
  [![PyPI License](https://img.shields.io/pypi/l/streambricks.svg)](https://pypi.org/project/streambricks/)
56
57
  [![Package status](https://img.shields.io/pypi/status/streambricks.svg)](https://pypi.org/project/streambricks/)
57
- [![Daily downloads](https://img.shields.io/pypi/dd/streambricks.svg)](https://pypi.org/project/streambricks/)
58
- [![Weekly downloads](https://img.shields.io/pypi/dw/streambricks.svg)](https://pypi.org/project/streambricks/)
59
58
  [![Monthly downloads](https://img.shields.io/pypi/dm/streambricks.svg)](https://pypi.org/project/streambricks/)
60
59
  [![Distribution format](https://img.shields.io/pypi/format/streambricks.svg)](https://pypi.org/project/streambricks/)
61
60
  [![Wheel availability](https://img.shields.io/pypi/wheel/streambricks.svg)](https://pypi.org/project/streambricks/)
@@ -73,12 +72,8 @@ Description-Content-Type: text/markdown
73
72
  [![Github last commit](https://img.shields.io/github/last-commit/phil65/streambricks)](https://github.com/phil65/streambricks/commits)
74
73
  [![Github release date](https://img.shields.io/github/release-date/phil65/streambricks)](https://github.com/phil65/streambricks/releases)
75
74
  [![Github language count](https://img.shields.io/github/languages/count/phil65/streambricks)](https://github.com/phil65/streambricks)
76
- [![Github commits this week](https://img.shields.io/github/commit-activity/w/phil65/streambricks)](https://github.com/phil65/streambricks)
77
75
  [![Github commits this month](https://img.shields.io/github/commit-activity/m/phil65/streambricks)](https://github.com/phil65/streambricks)
78
- [![Github commits this year](https://img.shields.io/github/commit-activity/y/phil65/streambricks)](https://github.com/phil65/streambricks)
79
76
  [![Package status](https://codecov.io/gh/phil65/streambricks/branch/main/graph/badge.svg)](https://codecov.io/gh/phil65/streambricks/)
80
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
81
77
  [![PyUp](https://pyup.io/repos/github/phil65/streambricks/shield.svg)](https://pyup.io/repos/github/phil65/streambricks/)
82
78
 
83
79
  [Read the documentation!](https://phil65.github.io/streambricks/)
84
-
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![PyPI License](https://img.shields.io/pypi/l/streambricks.svg)](https://pypi.org/project/streambricks/)
4
4
  [![Package status](https://img.shields.io/pypi/status/streambricks.svg)](https://pypi.org/project/streambricks/)
5
- [![Daily downloads](https://img.shields.io/pypi/dd/streambricks.svg)](https://pypi.org/project/streambricks/)
6
- [![Weekly downloads](https://img.shields.io/pypi/dw/streambricks.svg)](https://pypi.org/project/streambricks/)
7
5
  [![Monthly downloads](https://img.shields.io/pypi/dm/streambricks.svg)](https://pypi.org/project/streambricks/)
8
6
  [![Distribution format](https://img.shields.io/pypi/format/streambricks.svg)](https://pypi.org/project/streambricks/)
9
7
  [![Wheel availability](https://img.shields.io/pypi/wheel/streambricks.svg)](https://pypi.org/project/streambricks/)
@@ -21,12 +19,8 @@
21
19
  [![Github last commit](https://img.shields.io/github/last-commit/phil65/streambricks)](https://github.com/phil65/streambricks/commits)
22
20
  [![Github release date](https://img.shields.io/github/release-date/phil65/streambricks)](https://github.com/phil65/streambricks/releases)
23
21
  [![Github language count](https://img.shields.io/github/languages/count/phil65/streambricks)](https://github.com/phil65/streambricks)
24
- [![Github commits this week](https://img.shields.io/github/commit-activity/w/phil65/streambricks)](https://github.com/phil65/streambricks)
25
22
  [![Github commits this month](https://img.shields.io/github/commit-activity/m/phil65/streambricks)](https://github.com/phil65/streambricks)
26
- [![Github commits this year](https://img.shields.io/github/commit-activity/y/phil65/streambricks)](https://github.com/phil65/streambricks)
27
23
  [![Package status](https://codecov.io/gh/phil65/streambricks/branch/main/graph/badge.svg)](https://codecov.io/gh/phil65/streambricks/)
28
- [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
29
24
  [![PyUp](https://pyup.io/repos/github/phil65/streambricks/shield.svg)](https://pyup.io/repos/github/phil65/streambricks/)
30
25
 
31
26
  [Read the documentation!](https://phil65.github.io/streambricks/)
32
-
@@ -0,0 +1,262 @@
1
+ [project]
2
+ name = "streambricks"
3
+ version = "0.3.0"
4
+ description = "Streamlit widgets and helpers"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ license = { file = "LICENSE" }
8
+ authors = [
9
+ { name = "Philipp Temminghoff", email = "philipptemminghoff@googlemail.com" },
10
+ ]
11
+ keywords = []
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Topic :: Documentation",
22
+ "Topic :: Software Development",
23
+ "Topic :: Utilities",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = [
27
+ "fieldz>=0.1.0",
28
+ # Only add below (Copier)
29
+ "streamlit>=1.43.2",
30
+ ]
31
+
32
+ [project.urls]
33
+ "Code coverage" = "https://app.codecov.io/gh/phil65/streambricks"
34
+ Discussions = "https://github.com/phil65/streambricks/discussions"
35
+ Documentation = "https://phil65.github.io/streambricks/"
36
+ Issues = "https://github.com/phil65/streambricks/issues"
37
+ Source = "https://github.com/phil65/streambricks"
38
+
39
+ [project.optional-dependencies]
40
+ auth = ["authlib"]
41
+
42
+ [dependency-groups]
43
+ dev = [
44
+ "devtools",
45
+ "pyreadline3",
46
+ "pytest",
47
+ "pytest-cov",
48
+ # Only add below (Copier)
49
+ ]
50
+ benchmark = ["pyinstrument"]
51
+ docs = [
52
+ "mkdocs-material",
53
+ "mkdocs-mknodes",
54
+ # Only add below (Copier)
55
+ ]
56
+ lint = [
57
+ "mypy; python_version >= '3.14'",
58
+ "mypy[faster-cache]; python_version < '3.14'",
59
+ "ruff",
60
+ # Only add below (Copier)
61
+ ]
62
+
63
+ [build-system]
64
+ requires = ["uv_build>=0.8.22"]
65
+ build-backend = "uv_build"
66
+
67
+ [tool.coverage.report]
68
+ exclude_lines = [
69
+ "pragma: no cover",
70
+ "if TYPE_CHECKING:",
71
+ "@overload",
72
+ "except ImportError",
73
+ 'if __name__ == "__main__":',
74
+ ]
75
+
76
+ [tool.mknodes]
77
+ allowed-commit-types = [
78
+ "fix",
79
+ "feat",
80
+ "refactor",
81
+ "docs",
82
+ "test",
83
+ "build",
84
+ "chore",
85
+ ]
86
+ docstring-style = "google"
87
+
88
+ [tool.mypy]
89
+ python_version = "3.12"
90
+ disable_error_code = ["misc", "import"]
91
+ pretty = true
92
+ check_untyped_defs = true
93
+ exclude = ["venv/", ".venv/", "tests/"]
94
+ plugins = []
95
+
96
+ [tool.pyright]
97
+ venvPath = "."
98
+ venv = ".venv"
99
+ pythonVersion = "3.12"
100
+ pythonPlatform = "All"
101
+ typeCheckingMode = "basic"
102
+ deprecateTypingAliases = true
103
+ reportMissingTypeStubs = false
104
+ reportUnusedCallResult = false
105
+ reportUnknownVariableType = false
106
+ reportAny = false
107
+ reportImplicitOverride = false
108
+ reportUnusedFunction = false
109
+ reportImplicitStringConcatenation = false
110
+ reportIgnoreCommentWithoutRule = false
111
+ reportUnannotatedClassAttribute = false
112
+ reportSelfClsParameterName = false
113
+ reportPrivateImportUsage = false
114
+
115
+ [tool.pytest.ini_options]
116
+ log_cli = true
117
+ log_date_format = "%Y-%m-%d %H:%M:%S"
118
+ log_format = "%(asctime)s %(levelname)s %(message)s"
119
+ testpaths = "tests/"
120
+
121
+ [tool.ruff]
122
+ line-length = 90
123
+ extend-exclude = ["docs"]
124
+ target-version = "py312"
125
+
126
+ [tool.ruff.lint]
127
+ future-annotations = true
128
+ select = [
129
+ "A", # Flake8-builtins
130
+ # "ANN", # Flake8-Annotations
131
+ # "ASYNC", # Flake8-Async
132
+ # "ARG", # # Flake8-Unused-Arguments
133
+ "B", # flake8-bugbear
134
+ "BLE", # Flake8-blind-except
135
+ "C",
136
+ "C4", # flake8-comprehensions
137
+ # "C90", # MCCabe
138
+ "COM", # Flake8-commas
139
+ # "CPY", # Copyright-related rules
140
+ "D", # PyDocStyle
141
+ # "DTZ", # Flake8- Datetimez
142
+ "E", # PyCodeStyle Error
143
+ "EM", # flake8-errmsg
144
+ # "ERA", # Eradicate
145
+ "EXE", # flake8-executable
146
+ "F", # PyFlakes
147
+ "FA", # flake8-future-annotations
148
+ # "FBT", # flake8-boolean-trap
149
+ # "FIX", # flake8-fixme
150
+ "FLY", # flynt
151
+ "G", # flake8-logging-format
152
+ "I", # ISort
153
+ "ICN", # Flake8-import-conventions
154
+ "INP", # flake8-no-pep420
155
+ "INT", # flake8-gettext
156
+ "ISC", # flake8-implicit-str-concat
157
+ "N", # pep8-naming
158
+ # "NPY", # numpy-specific rules
159
+ # "PD", # pandas-vet
160
+ "PERF", # perflint
161
+ # "PGH", # pygrep-hooks
162
+ "PIE", # flake8-pie
163
+ "PLE", # PyLint Error
164
+ "PLC", # PyLint convention
165
+ # "PLW", # PyLint Warning
166
+ "PLR", # PyLint refactor
167
+ "PT", # flake8-pytest-style
168
+ "PTH", # flake8-use-pathlib
169
+ "PYI", # flake8-pyi
170
+ "Q", # flake8-quotes
171
+ "RET", # flake8-return
172
+ "RSE", # flake8-raise
173
+ "RUF", # ruff-specific rules
174
+ # "S", # flake8-bandit
175
+ "SIM", # flake8-simplify
176
+ "SLF", # flake8-self
177
+ "SLOT", # flake8-slots
178
+ # "T",
179
+ # "TD", # flake8-todos
180
+ "T10", # flake8-debugger
181
+ # "T20", # flake8-print
182
+ "TC", # flake8-type-checking
183
+ "TID", # flake8-tidy-imports
184
+ "TRY", # tryceratops
185
+ "UP", # PyUpgrade
186
+ "W", # PyCodeStyle warning
187
+ "YTT", # flake8-2020
188
+ ]
189
+ ignore = [
190
+ "C408", # Unnecessary {obj_type} call (rewrite as a literal)
191
+ "B905", # zip() without an explicit strict= parameter
192
+ "C901", # {name} is too complex ({complexity} > {max_complexity})
193
+ "COM812",
194
+ # "CPY001", # Missing copyright notice at top of file
195
+ "D100", # Missing docstring in public module
196
+ "D101", # Missing docstring in public class
197
+ "D102", # Missing docstring in public method
198
+ "D103", # Missing docstring in public function
199
+ "D104", # Missing docstring in public package
200
+ "D105", # Missing docstring in magic method
201
+ "D106", # Missing docstring in public nested class
202
+ "D107", # Missing docstring in __init__
203
+ "D203", # 1 blank line required before class docstring
204
+ "D204", # 1 blank line required after class docstring
205
+ "D213", # Multi-line docstring summary should start at the second line
206
+ "D215", # Section underline is over-indented ("{name}")
207
+ "D400", # First line should end with a period
208
+ "D401", # First line of docstring should be in imperative mood: "{first_line}"
209
+ "D404", # First word of the docstring should not be "This"
210
+ "D406", # Section name should end with a newline ("{name}")
211
+ "D407", # Missing dashed underline after section ("{name}")
212
+ "D408", # Section underline should be in the line following the section's name ("{name}")
213
+ "D409", # Section underline should match the length of its name ("{name}")
214
+ "D413", # Missing blank line after last section ("{name}")
215
+ "ISC001",
216
+ "PLC0415",
217
+ "PLR0912", # Too many branches
218
+ "PLR0913", # Too many arguments to function call
219
+ "PLR0915", # Too many statements
220
+ # "PLR2004", # Magic values instead of named consts
221
+ "SLF001", # Private member accessed
222
+ "TRY003", # Avoid specifying long messages outside the exception class
223
+ "TC006", # runtime-cast-value
224
+ ]
225
+
226
+ [tool.ruff.lint.flake8-quotes]
227
+ docstring-quotes = "double"
228
+
229
+ [tool.ruff.lint.flake8-type-checking]
230
+ runtime-evaluated-base-classes = [
231
+ "pydantic.BaseModel",
232
+ "sqlalchemy.orm.DeclarativeBase",
233
+ "schemez.Schema",
234
+ ]
235
+ runtime-evaluated-decorators = [
236
+ "pydantic.validate_call",
237
+ "attrs.define",
238
+ "fastapi.FastAPI.get",
239
+ "fastapi.FastAPI.post",
240
+ "fastmcp.FastMCP.tool",
241
+ ]
242
+
243
+ [tool.ruff.lint.isort]
244
+ lines-after-imports = 2
245
+ # lines-between-types = 1
246
+ # atomic = true
247
+ force-sort-within-sections = true
248
+ combine-as-imports = true
249
+
250
+ [tool.ruff.lint.per-file-ignores]
251
+ "__init__.py" = ["E402", "I001"]
252
+ "scripts/*" = ["INP001"]
253
+
254
+ [tool.ruff.format]
255
+ # Enable preview style formatting.
256
+ preview = true
257
+
258
+ [tool.ty.environment]
259
+ python-version = "3.12"
260
+
261
+ [tool.uv]
262
+ default-groups = ["dev", "lint", "docs"]
@@ -1,7 +1,20 @@
1
- """StreamBricks components for Streamlit."""
1
+ """StreamBricks: main package.
2
2
 
3
- __version__ = "0.2.20"
3
+ Streamlit widgets and helpers.
4
+ """
4
5
 
6
+ from __future__ import annotations
7
+
8
+ from importlib.metadata import version
9
+
10
+ __version__ = version("streambricks")
11
+ __title__ = "StreamBricks"
12
+
13
+ __author__ = "Philipp Temminghoff"
14
+ __author_email__ = "philipptemminghoff@googlemail.com"
15
+ __copyright__ = "Copyright (c) 2025 Philipp Temminghoff"
16
+ __license__ = "MIT"
17
+ __url__ = "https://github.com/phil65/streambricks"
5
18
 
6
19
  from streambricks.auth import (
7
20
  GoogleUser,
@@ -32,6 +45,7 @@ __all__ = [
32
45
  "MicrosoftUser",
33
46
  "MultiSelectItem",
34
47
  "State",
48
+ "__version__",
35
49
  "bind_kwargs_as_widget",
36
50
  "get_current_user",
37
51
  "google_login",
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import functools
4
- from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar
4
+ from typing import TYPE_CHECKING, Any
5
5
 
6
6
  import streamlit as st
7
7
 
@@ -10,11 +10,7 @@ if TYPE_CHECKING:
10
10
  from collections.abc import Callable
11
11
 
12
12
 
13
- T = TypeVar("T")
14
- P = ParamSpec("P")
15
-
16
-
17
- def requires_login(
13
+ def requires_login[**P, T](
18
14
  func: Callable[P, T] | None = None,
19
15
  *,
20
16
  unauthorized_handler: str | Callable[[], Any] | None = None,
@@ -75,14 +75,14 @@ def microsoft_login(
75
75
 
76
76
 
77
77
  @overload
78
- def get_current_user(user_class: type[T]) -> T: ...
78
+ def get_current_user[T: (GoogleUser, MicrosoftUser)](user_class: type[T]) -> T: ...
79
79
 
80
80
 
81
81
  @overload
82
82
  def get_current_user() -> GoogleUser | MicrosoftUser | None: ...
83
83
 
84
84
 
85
- def get_current_user(
85
+ def get_current_user[T: (GoogleUser, MicrosoftUser)](
86
86
  user_class: type[T] | None = None,
87
87
  ) -> T | GoogleUser | MicrosoftUser | None:
88
88
  """Get the currently logged in user as a typed object.
@@ -4,12 +4,16 @@ import base64
4
4
  import functools
5
5
  import hashlib
6
6
  from io import BytesIO
7
- from typing import Literal
7
+ from typing import TYPE_CHECKING, Literal
8
8
 
9
9
  from PIL import Image, ImageDraw, ImageFont
10
10
  import streamlit as st
11
11
 
12
- from streambricks.auth.models import GoogleUser, MicrosoftUser
12
+ from streambricks.auth.models import GoogleUser
13
+
14
+
15
+ if TYPE_CHECKING:
16
+ from streambricks.auth.models import MicrosoftUser
13
17
 
14
18
 
15
19
  @st.cache_data(ttl=3600, show_spinner=False)
@@ -4,7 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  from functools import wraps
6
6
  from inspect import Parameter, signature
7
- from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar
7
+ from typing import TYPE_CHECKING, Any
8
8
 
9
9
  from pydantic import Field, create_model
10
10
  import streamlit as st
@@ -16,11 +16,7 @@ if TYPE_CHECKING:
16
16
  from collections.abc import Callable
17
17
 
18
18
 
19
- T = TypeVar("T")
20
- P = ParamSpec("P")
21
-
22
-
23
- def bind_kwargs_as_widget(
19
+ def bind_kwargs_as_widget[**P, T](
24
20
  func: Callable[P, T],
25
21
  *,
26
22
  kwargs_to_bind: list[str],
@@ -113,13 +109,13 @@ def bind_kwargs_as_widget(
113
109
  field_kwargs["description"] = param_docs[name]
114
110
  docstrings[name] = param_docs[name]
115
111
 
116
- fields[name] = (param_type, Field(**field_kwargs)) # pyright: ignore
112
+ fields[name] = (param_type, Field(**field_kwargs)) # type: ignore
117
113
  if default != Parameter.empty:
118
114
  defaults[name] = default
119
115
 
120
116
  # Create a Pydantic model dynamically
121
117
  model_name = f"{func.__name__}Config"
122
- config_model = create_model(model_name, **fields)
118
+ config_model = create_model(model_name, **fields) # type: ignore
123
119
 
124
120
  # Add docstrings as class variables
125
121
  for name, docstring in docstrings.items():
@@ -2,11 +2,11 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from collections.abc import Callable, Sequence
5
+ from collections.abc import Callable
6
6
  from datetime import date, datetime, time
7
7
  from decimal import Decimal
8
8
  from enum import Enum
9
- from typing import Any, Literal, TypeVar, get_args, get_origin, overload
9
+ from typing import TYPE_CHECKING, Any, Literal, TypeVar, get_args, get_origin, overload
10
10
 
11
11
  import fieldz
12
12
  from pydantic import BaseModel, SecretStr
@@ -44,6 +44,10 @@ from streambricks.widgets.type_helpers import (
44
44
  )
45
45
 
46
46
 
47
+ if TYPE_CHECKING:
48
+ from collections.abc import Sequence
49
+
50
+
47
51
  T = TypeVar("T")
48
52
  WidgetFunc = Callable[..., T]
49
53
  TForm = TypeVar("TForm", bound=BaseModel)
@@ -816,7 +820,7 @@ def render_model_field(model_class, field_name, value=None, container=st):
816
820
 
817
821
 
818
822
  @overload
819
- def render_model_form(
823
+ def render_model_form[TForm: BaseModel](
820
824
  model_or_instance: type[TForm],
821
825
  *,
822
826
  readonly: bool = False,
@@ -825,7 +829,7 @@ def render_model_form(
825
829
 
826
830
 
827
831
  @overload
828
- def render_model_form(
832
+ def render_model_form[TForm: BaseModel](
829
833
  model_or_instance: TForm,
830
834
  *,
831
835
  readonly: bool = False,
@@ -3,15 +3,19 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import contextlib
6
- from datetime import date, datetime, time
6
+ from datetime import date, datetime
7
7
  from decimal import Decimal
8
8
  from enum import Enum
9
- from typing import Any, get_args
9
+ from typing import TYPE_CHECKING, Any, get_args
10
10
 
11
11
  from pydantic import SecretStr
12
12
  import streamlit as st
13
13
 
14
14
 
15
+ if TYPE_CHECKING:
16
+ from datetime import time
17
+
18
+
15
19
  def render_str_field(
16
20
  *,
17
21
  key: str,
@@ -216,7 +216,7 @@ def create_default_instance(model_class: type) -> Any:
216
216
  has_default = True
217
217
  elif field.default_factory != fieldz.Field.MISSING:
218
218
  try:
219
- default_values[field_name] = field.default_factory() # pyright: ignore
219
+ default_values[field_name] = field.default_factory() # type: ignore
220
220
  has_default = True
221
221
  except Exception: # noqa: BLE001
222
222
  # If default_factory fails, fall back to type-based defaults
@@ -1,21 +0,0 @@
1
- # Changes here will be overwritten by Copier
2
- _commit: v1.8.4
3
- _src_path: .\copier-phil65\
4
- author_email: philipptemminghoff@googlemail.com
5
- author_fullname: Philipp Temminghoff
6
- author_username: phil65
7
- copyright_date: '2025'
8
- copyright_holder: Philipp Temminghoff
9
- copyright_holder_email: philipptemminghoff@googlemail.com
10
- libraries_use_pydantic: false
11
- libraries_use_qt: false
12
- project_description: Streamlit widgets and helpers
13
- project_name: StreamBricks
14
- python_minimum_version: '3.12'
15
- python_package_command_line_name: streambricks
16
- python_package_distribution_name: streambricks
17
- python_package_import_name: streambricks
18
- repository_name: streambricks
19
- repository_namespace: phil65
20
- repository_provider: github.com
21
-
@@ -1,3 +0,0 @@
1
- github: phil65
2
- custom:
3
- - https://www.paypal.me/phil65
@@ -1,19 +0,0 @@
1
- ## Code style
2
-
3
- You can assume Python 3.12.
4
- Use newest language features if possible
5
- Consider using pattern matching, walrus operators and other new syntax features.
6
- Adhere to pep8.
7
-
8
- ## Tests
9
-
10
- Tests are written using PyTest. Dont put tests into a class.
11
-
12
- ## DocStrings
13
-
14
- DocStrings are written in google-style.
15
- Dont add the types to the "Args" section.
16
- Only add a Return section if a value is returned and the meaning of the returned value
17
- is not obvious.
18
- You can use markdown admonitions with python-markdown syntax if neccessary (!!! info, !!! note, !!! warning).
19
- You can use markdown tables and markdown lists if neccessary.
@@ -1,9 +0,0 @@
1
- # Set update schedule for GitHub Actions
2
-
3
- version: 2
4
- updates:
5
- - package-ecosystem: "github-actions"
6
- directory: "/"
7
- schedule:
8
- # Check for updates to GitHub Actions every week
9
- interval: "weekly"