analog-daddy 2.0.1__tar.gz → 3.0.1.dev1__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.
- analog_daddy-3.0.1.dev1/PKG-INFO +36 -0
- analog_daddy-3.0.1.dev1/README.md +4 -0
- analog_daddy-3.0.1.dev1/pyproject.toml +156 -0
- analog_daddy-3.0.1.dev1/pyproject.toml.orig +161 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/__init__.py +1 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/__main__.py +6 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/cli.py +22 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/gtutils.py +8 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/mootils.py +123 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/plexpr.py +464 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/plutils.py +343 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/py.typed +1 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/roles.py +96 -0
- analog_daddy-3.0.1.dev1/src/analog_daddy/utils.py +107 -0
- analog_daddy-2.0.1/LICENSE +0 -661
- analog_daddy-2.0.1/PKG-INFO +0 -272
- analog_daddy-2.0.1/README.md +0 -251
- analog_daddy-2.0.1/analog_daddy/__init__.py +0 -0
- analog_daddy-2.0.1/analog_daddy/conf.py +0 -47
- analog_daddy-2.0.1/analog_daddy/importer.py +0 -315
- analog_daddy-2.0.1/analog_daddy/look_up.py +0 -162
- analog_daddy-2.0.1/analog_daddy/utils.py +0 -198
- analog_daddy-2.0.1/analog_daddy/write_config.py +0 -180
- analog_daddy-2.0.1/analog_daddy.egg-info/PKG-INFO +0 -272
- analog_daddy-2.0.1/analog_daddy.egg-info/SOURCES.txt +0 -18
- analog_daddy-2.0.1/analog_daddy.egg-info/dependency_links.txt +0 -1
- analog_daddy-2.0.1/analog_daddy.egg-info/requires.txt +0 -10
- analog_daddy-2.0.1/analog_daddy.egg-info/top_level.txt +0 -1
- analog_daddy-2.0.1/pyproject.toml +0 -3
- analog_daddy-2.0.1/setup.cfg +0 -39
- analog_daddy-2.0.1/tests/test_importer.py +0 -461
- analog_daddy-2.0.1/tests/test_look_up.py +0 -64
- analog_daddy-2.0.1/tests/test_write_config.py +0 -59
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: analog-daddy
|
|
3
|
+
Version: 3.0.1.dev1
|
|
4
|
+
Summary: This library is an attempt to make transistor sizing for Analog Design less painful. Additionally, provides helper utilities to minimize churn and errors in repetative tasks.
|
|
5
|
+
Author: Siddhant Laddha
|
|
6
|
+
Author-email: Siddhant Laddha <25705822+siddhantladdha@users.noreply.github.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Education
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
|
|
12
|
+
Classifier: Typing :: Typed
|
|
13
|
+
Requires-Dist: boltons
|
|
14
|
+
Requires-Dist: cyclopts ; sys_platform != 'emscripten'
|
|
15
|
+
Requires-Dist: great-tables
|
|
16
|
+
Requires-Dist: plotly
|
|
17
|
+
Requires-Dist: polars
|
|
18
|
+
Requires-Dist: pydantic>=2
|
|
19
|
+
Requires-Dist: pydantic-settings
|
|
20
|
+
Requires-Dist: quantiphy
|
|
21
|
+
Requires-Dist: rich
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Requires-Dist: xarray
|
|
24
|
+
Maintainer: Siddhant Laddha
|
|
25
|
+
Maintainer-email: Siddhant Laddha <25705822+siddhantladdha@users.noreply.github.com>
|
|
26
|
+
Requires-Python: >=3.12
|
|
27
|
+
Project-URL: bugs, https://github.com/siddhantladdha/analog_daddy/issues
|
|
28
|
+
Project-URL: changelog, https://github.com/siddhantladdha/analog_daddy/releases
|
|
29
|
+
Project-URL: documentation, https://siddhantladdha.github.io/analog_daddy/
|
|
30
|
+
Project-URL: homepage, https://github.com/siddhantladdha/analog_daddy
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Analog Daddy
|
|
34
|
+
|
|
35
|
+
This is a dummy README for the dev version. Please refer
|
|
36
|
+
[main](https://github.com/siddhantladdha/analog-daddy)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "analog-daddy"
|
|
3
|
+
version = "3.0.1.dev1"
|
|
4
|
+
description = "This library is an attempt to make transistor sizing for Analog Design less painful. Additionally, provides helper utilities to minimize churn and errors in repetative tasks."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">= 3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 4 - Beta",
|
|
10
|
+
"Intended Audience :: Education",
|
|
11
|
+
"Intended Audience :: Science/Research",
|
|
12
|
+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
13
|
+
"Typing :: Typed",
|
|
14
|
+
]
|
|
15
|
+
dependencies = [
|
|
16
|
+
"boltons",
|
|
17
|
+
"cyclopts; sys_platform != 'emscripten'",
|
|
18
|
+
"great-tables",
|
|
19
|
+
"plotly",
|
|
20
|
+
"polars",
|
|
21
|
+
"pydantic>=2",
|
|
22
|
+
"pydantic-settings",
|
|
23
|
+
"quantiphy",
|
|
24
|
+
"rich",
|
|
25
|
+
"scipy",
|
|
26
|
+
"xarray",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[[project.authors]]
|
|
30
|
+
name = "Siddhant Laddha"
|
|
31
|
+
email = "25705822+siddhantladdha@users.noreply.github.com"
|
|
32
|
+
|
|
33
|
+
[[project.maintainers]]
|
|
34
|
+
name = "Siddhant Laddha"
|
|
35
|
+
email = "25705822+siddhantladdha@users.noreply.github.com"
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
bugs = "https://github.com/siddhantladdha/analog_daddy/issues"
|
|
39
|
+
changelog = "https://github.com/siddhantladdha/analog_daddy/releases"
|
|
40
|
+
documentation = "https://siddhantladdha.github.io/analog_daddy/"
|
|
41
|
+
homepage = "https://github.com/siddhantladdha/analog_daddy"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
analog_daddy = "analog_daddy.cli:app"
|
|
45
|
+
|
|
46
|
+
[dependency-groups]
|
|
47
|
+
dev = [
|
|
48
|
+
"format-docstring",
|
|
49
|
+
"pytest",
|
|
50
|
+
"ruff",
|
|
51
|
+
"ty",
|
|
52
|
+
]
|
|
53
|
+
docs = [
|
|
54
|
+
"mkdocstrings-python",
|
|
55
|
+
"nbconvert",
|
|
56
|
+
"playwright",
|
|
57
|
+
"zensical",
|
|
58
|
+
]
|
|
59
|
+
lint = ["pydoclint"]
|
|
60
|
+
notebooks = [
|
|
61
|
+
"marimo[lsp,mcp,recommended]",
|
|
62
|
+
"wigglystuff",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[[dependency-groups.all]]
|
|
66
|
+
include-group = "dev"
|
|
67
|
+
|
|
68
|
+
[[dependency-groups.all]]
|
|
69
|
+
include-group = "docs"
|
|
70
|
+
|
|
71
|
+
[[dependency-groups.all]]
|
|
72
|
+
include-group = "notebooks"
|
|
73
|
+
|
|
74
|
+
[build-system]
|
|
75
|
+
requires = ["uv_build>=0.13.0,<0.14"]
|
|
76
|
+
build-backend = "uv_build"
|
|
77
|
+
|
|
78
|
+
[tool.format_docstring]
|
|
79
|
+
docstring_style = "numpy"
|
|
80
|
+
line_length = 72
|
|
81
|
+
include_arg_types = true
|
|
82
|
+
include_arg_defaults = true
|
|
83
|
+
fix_rst_backticks = true
|
|
84
|
+
exclude = '\.git|\.venv|__pycache__|.*drafts.*\.py'
|
|
85
|
+
|
|
86
|
+
[tool.pydoclint]
|
|
87
|
+
style = "numpy"
|
|
88
|
+
arg-type-hints-in-docstring = true
|
|
89
|
+
arg-type-hints-in-signature = true
|
|
90
|
+
check-return-types = true
|
|
91
|
+
check-arg-defaults = true
|
|
92
|
+
check-style-mismatch = true
|
|
93
|
+
show-filenames-in-every-violation-message = true
|
|
94
|
+
exclude = '\.git|\.tox|\.venv|build|dist|.*drafts.*\.py'
|
|
95
|
+
|
|
96
|
+
[tool.pytest.ini_options]
|
|
97
|
+
addopts = [
|
|
98
|
+
"--doctest-modules",
|
|
99
|
+
"--ignore-glob=*drafts*.py",
|
|
100
|
+
]
|
|
101
|
+
doctest_optionflags = ["IGNORE_EXCEPTION_DETAIL"]
|
|
102
|
+
testpaths = [
|
|
103
|
+
"src",
|
|
104
|
+
"tests",
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
[tool.ruff]
|
|
108
|
+
line-length = 79
|
|
109
|
+
extend-exclude = ["*drafts*.py"]
|
|
110
|
+
output-prefer-rule-codes = true
|
|
111
|
+
|
|
112
|
+
[tool.ruff.lint]
|
|
113
|
+
ignore = [
|
|
114
|
+
"D105",
|
|
115
|
+
"D401",
|
|
116
|
+
]
|
|
117
|
+
extend-select = [
|
|
118
|
+
"NPY",
|
|
119
|
+
"N",
|
|
120
|
+
"PTH",
|
|
121
|
+
"SIM",
|
|
122
|
+
"EXE",
|
|
123
|
+
"FURB110",
|
|
124
|
+
"FURB116",
|
|
125
|
+
"FURB167",
|
|
126
|
+
"FURB177",
|
|
127
|
+
"B903",
|
|
128
|
+
"TRY300",
|
|
129
|
+
"LOG004",
|
|
130
|
+
"LOG007",
|
|
131
|
+
"UP042",
|
|
132
|
+
"PERF403",
|
|
133
|
+
"PERF401",
|
|
134
|
+
"FURB113",
|
|
135
|
+
"FURB152",
|
|
136
|
+
"FURB156",
|
|
137
|
+
]
|
|
138
|
+
preview = true
|
|
139
|
+
explicit-preview-rules = true
|
|
140
|
+
external = ["DOC105"]
|
|
141
|
+
|
|
142
|
+
[tool.ruff.lint.pydocstyle]
|
|
143
|
+
convention = "numpy"
|
|
144
|
+
|
|
145
|
+
[tool.ruff.format]
|
|
146
|
+
docstring-code-format = true
|
|
147
|
+
|
|
148
|
+
[tool.ty.src]
|
|
149
|
+
exclude = ["**/*drafts*.py"]
|
|
150
|
+
|
|
151
|
+
[tool.ty.terminal]
|
|
152
|
+
output-format = "concise"
|
|
153
|
+
|
|
154
|
+
[tool.uv]
|
|
155
|
+
default-groups = ["all"]
|
|
156
|
+
required-version = ">=0.13.0,<0.14"
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "analog-daddy"
|
|
3
|
+
version = "3.0.1.dev1"
|
|
4
|
+
description = "This library is an attempt to make transistor sizing for Analog Design less painful. Additionally, provides helper utilities to minimize churn and errors in repetative tasks."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">= 3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Siddhant Laddha", email = "25705822+siddhantladdha@users.noreply.github.com" }
|
|
10
|
+
]
|
|
11
|
+
maintainers = [
|
|
12
|
+
{ name = "Siddhant Laddha", email = "25705822+siddhantladdha@users.noreply.github.com" }
|
|
13
|
+
]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Education",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"boltons",
|
|
23
|
+
"cyclopts; sys_platform != 'emscripten'",
|
|
24
|
+
"great-tables",
|
|
25
|
+
"plotly",
|
|
26
|
+
"polars",
|
|
27
|
+
"pydantic>=2",
|
|
28
|
+
"pydantic-settings",
|
|
29
|
+
"quantiphy",
|
|
30
|
+
"rich",
|
|
31
|
+
"scipy",
|
|
32
|
+
"xarray",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
bugs = "https://github.com/siddhantladdha/analog_daddy/issues"
|
|
37
|
+
changelog = "https://github.com/siddhantladdha/analog_daddy/releases"
|
|
38
|
+
documentation = "https://siddhantladdha.github.io/analog_daddy/"
|
|
39
|
+
homepage = "https://github.com/siddhantladdha/analog_daddy"
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
analog_daddy = "analog_daddy.cli:app"
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"format-docstring",
|
|
47
|
+
"pytest",
|
|
48
|
+
"ruff",
|
|
49
|
+
"ty",
|
|
50
|
+
]
|
|
51
|
+
all = [
|
|
52
|
+
{ include-group = "dev" },
|
|
53
|
+
{ include-group = "docs" },
|
|
54
|
+
{ include-group = "notebooks" },
|
|
55
|
+
]
|
|
56
|
+
docs = [
|
|
57
|
+
"mkdocstrings-python",
|
|
58
|
+
"nbconvert", # marimo pdf exports.
|
|
59
|
+
"playwright", # marimo pdf exports.
|
|
60
|
+
"zensical",
|
|
61
|
+
# TODO: evaluate vs great-docs for marimo notebooks in docs.
|
|
62
|
+
]
|
|
63
|
+
lint = ["pydoclint"]
|
|
64
|
+
notebooks = [
|
|
65
|
+
"marimo[lsp,mcp,recommended]",
|
|
66
|
+
"wigglystuff",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[build-system]
|
|
70
|
+
requires = ["uv_build>=0.13.0,<0.14"]
|
|
71
|
+
build-backend = "uv_build"
|
|
72
|
+
|
|
73
|
+
[tool.format_docstring]
|
|
74
|
+
docstring_style = "numpy"
|
|
75
|
+
line_length = 72
|
|
76
|
+
include_arg_types = true
|
|
77
|
+
include_arg_defaults = true
|
|
78
|
+
fix_rst_backticks = true
|
|
79
|
+
exclude = "\\.git|\\.venv|__pycache__|.*drafts.*\\.py"
|
|
80
|
+
|
|
81
|
+
[tool.pydoclint]
|
|
82
|
+
# issue #313 currently needs # noqa: DOC105
|
|
83
|
+
style = "numpy"
|
|
84
|
+
arg-type-hints-in-docstring = true
|
|
85
|
+
arg-type-hints-in-signature = true
|
|
86
|
+
check-return-types = true
|
|
87
|
+
check-arg-defaults = true
|
|
88
|
+
check-style-mismatch = true
|
|
89
|
+
show-filenames-in-every-violation-message = true
|
|
90
|
+
exclude = '\.git|\.tox|\.venv|build|dist|.*drafts.*\.py'
|
|
91
|
+
|
|
92
|
+
[tool.pytest.ini_options]
|
|
93
|
+
addopts = ["--doctest-modules", "--ignore-glob=*drafts*.py"]
|
|
94
|
+
doctest_optionflags = ["IGNORE_EXCEPTION_DETAIL"]
|
|
95
|
+
testpaths = ["src", "tests"]
|
|
96
|
+
|
|
97
|
+
[tool.ruff]
|
|
98
|
+
line-length = 79
|
|
99
|
+
extend-exclude = ["*drafts*.py"]
|
|
100
|
+
output-prefer-rule-codes = true
|
|
101
|
+
|
|
102
|
+
[tool.ruff.lint]
|
|
103
|
+
ignore = [
|
|
104
|
+
# "DOC", # pydoclint is already handling docstring issues.
|
|
105
|
+
# "F401", # F401: module imported but unused
|
|
106
|
+
# "D100", # Missing docstring in public module"
|
|
107
|
+
# "D103", # undocumented-public-method
|
|
108
|
+
"D105", # undocumented-magic-method
|
|
109
|
+
"D401", # non-imperative-mood
|
|
110
|
+
]
|
|
111
|
+
extend-select = [
|
|
112
|
+
"NPY", # numpy
|
|
113
|
+
# "D", # docstring # handled by format-docstring and pydoclint
|
|
114
|
+
"N", # pep8-naming
|
|
115
|
+
"PTH", # flake8-use-pathlib
|
|
116
|
+
"SIM", # flake8-simplify
|
|
117
|
+
"EXE", # flake8-executable
|
|
118
|
+
"FURB110",
|
|
119
|
+
"FURB116",
|
|
120
|
+
"FURB167",
|
|
121
|
+
"FURB177",
|
|
122
|
+
"B903",
|
|
123
|
+
"TRY300",
|
|
124
|
+
"LOG004",
|
|
125
|
+
"LOG007",
|
|
126
|
+
"UP042",
|
|
127
|
+
"PERF403",
|
|
128
|
+
"PERF401",
|
|
129
|
+
#############
|
|
130
|
+
# Preview rules
|
|
131
|
+
"FURB113",
|
|
132
|
+
"FURB152",
|
|
133
|
+
"FURB156",
|
|
134
|
+
#############
|
|
135
|
+
#############
|
|
136
|
+
# Enable the following when working on spaghetti and old code.
|
|
137
|
+
# "FURB",
|
|
138
|
+
# "UP",
|
|
139
|
+
#############
|
|
140
|
+
]
|
|
141
|
+
# There are certain `preview`/beta rules that I am selectively enabling.
|
|
142
|
+
preview = true
|
|
143
|
+
explicit-preview-rules = true
|
|
144
|
+
external = ["DOC105"]
|
|
145
|
+
|
|
146
|
+
[tool.ruff.lint.pydocstyle]
|
|
147
|
+
convention = "numpy"
|
|
148
|
+
|
|
149
|
+
[tool.ruff.format]
|
|
150
|
+
docstring-code-format = true
|
|
151
|
+
|
|
152
|
+
[tool.ty]
|
|
153
|
+
[tool.ty.src]
|
|
154
|
+
exclude = ["**/*drafts*.py"]
|
|
155
|
+
|
|
156
|
+
[tool.ty.terminal]
|
|
157
|
+
output-format = "concise"
|
|
158
|
+
|
|
159
|
+
[tool.uv]
|
|
160
|
+
default-groups = ["all"]
|
|
161
|
+
required-version = ">=0.13.0,<0.14"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Top-level package for Analog Daddy."""
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Console script for analog_daddy."""
|
|
2
|
+
|
|
3
|
+
from cyclopts import App
|
|
4
|
+
from rich.console import Console
|
|
5
|
+
|
|
6
|
+
app = App()
|
|
7
|
+
console = Console()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@app.default
|
|
11
|
+
def main() -> None:
|
|
12
|
+
"""Console script for analog_daddy."""
|
|
13
|
+
console.print(
|
|
14
|
+
"Replace this message by putting your code into analog_daddy.cli.main"
|
|
15
|
+
)
|
|
16
|
+
console.print(
|
|
17
|
+
"See Cyclopts documentation at https://cyclopts.readthedocs.io/"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
app()
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
A collection of marimo utility functions.
|
|
3
|
+
|
|
4
|
+
While marimo is quite feature-rich, these functions are intended to be
|
|
5
|
+
convenience functions for common tasks that are not yet implemented in
|
|
6
|
+
marimo. These might be deprecated if they become available in marimo.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import io
|
|
10
|
+
from collections.abc import Callable
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
import marimo as mo
|
|
14
|
+
import polars as pl
|
|
15
|
+
import polars.selectors as cs
|
|
16
|
+
from rich.console import Console, RenderableType
|
|
17
|
+
|
|
18
|
+
from analog_daddy.utils import render
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def format_mapping_num_to_si(df: pl.DataFrame) -> dict[str, Callable]:
|
|
22
|
+
"""
|
|
23
|
+
Build a format mapping that renders numeric columns as SI strings.
|
|
24
|
+
|
|
25
|
+
Intended for the ``format_mapping`` argument of ``mo.ui.table`` and
|
|
26
|
+
``mo.ui.dataframe``. Columns are matched with ``cs.numeric()`` and
|
|
27
|
+
rendered with :func:`render`.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
df : pl.DataFrame
|
|
32
|
+
DataFrame whose numeric columns to map.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
dict[str, Callable]
|
|
37
|
+
Column name to formatter mapping.
|
|
38
|
+
|
|
39
|
+
References
|
|
40
|
+
----------
|
|
41
|
+
- [marimo#9663](https://github.com/marimo-team/marimo/issues/9663)
|
|
42
|
+
- [marimo#7568](https://github.com/marimo-team/marimo/issues/7568)
|
|
43
|
+
"""
|
|
44
|
+
return dict.fromkeys(cs.expand_selector(df, cs.numeric()), render)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def mo_table(
|
|
48
|
+
data: pl.DataFrame,
|
|
49
|
+
*,
|
|
50
|
+
selection=None,
|
|
51
|
+
pagination=None,
|
|
52
|
+
page_size=30,
|
|
53
|
+
max_columns=1000,
|
|
54
|
+
**kwargs,
|
|
55
|
+
) -> mo.ui.table:
|
|
56
|
+
kwargs.setdefault("format_mapping", format_mapping_num_to_si(data))
|
|
57
|
+
return mo.ui.table(
|
|
58
|
+
data,
|
|
59
|
+
selection=selection,
|
|
60
|
+
pagination=pagination,
|
|
61
|
+
page_size=page_size,
|
|
62
|
+
max_columns=max_columns,
|
|
63
|
+
**kwargs,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def rich_md(
|
|
68
|
+
*renderables: RenderableType,
|
|
69
|
+
console_kwargs: dict[str, Any] | None = None,
|
|
70
|
+
print_kwargs: dict[str, Any] | None = None,
|
|
71
|
+
export_html_kwargs: dict[str, Any] | None = None,
|
|
72
|
+
) -> mo.Html:
|
|
73
|
+
"""
|
|
74
|
+
A minimal helper function to utilize rich markup within marimo.
|
|
75
|
+
|
|
76
|
+
Created this for shits-n-giggles. This is in no way complete! I
|
|
77
|
+
don't use this as much as I would like to, however, in case you have
|
|
78
|
+
some text, that you would like to keep consistent with your console
|
|
79
|
+
markup, this might be an option.
|
|
80
|
+
|
|
81
|
+
Parameters
|
|
82
|
+
----------
|
|
83
|
+
*renderables : RenderableType
|
|
84
|
+
The renderable objects to be printed using rich.
|
|
85
|
+
console_kwargs : dict[str, Any] | None, default=None
|
|
86
|
+
Keyword arguments to customize the rich Console.
|
|
87
|
+
print_kwargs : dict[str, Any] | None, default=None
|
|
88
|
+
Keyword arguments to customize the rich print method.
|
|
89
|
+
export_html_kwargs : dict[str, Any] | None, default=None
|
|
90
|
+
Keyword arguments to customize the rich export_html method.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
mo.Html
|
|
95
|
+
The HTML representation of the rich renderables.
|
|
96
|
+
|
|
97
|
+
Examples
|
|
98
|
+
--------
|
|
99
|
+
>>> "font-weight: bold" in rich_md("[bold green]Hello[/] World").text
|
|
100
|
+
True
|
|
101
|
+
>>> "font-style: italic" in rich_md(
|
|
102
|
+
... "[bold]Bold[italic] bold and italic [/bold]italic[/italic]"
|
|
103
|
+
... ).text
|
|
104
|
+
True
|
|
105
|
+
>>> "⚠️" in rich_md(":warning-emoji: you have been warned!").text
|
|
106
|
+
True
|
|
107
|
+
"""
|
|
108
|
+
console_kwargs = {
|
|
109
|
+
"color_system": "truecolor",
|
|
110
|
+
"record": True,
|
|
111
|
+
**(console_kwargs or {}),
|
|
112
|
+
}
|
|
113
|
+
print_kwargs = print_kwargs or {}
|
|
114
|
+
export_html_kwargs = {
|
|
115
|
+
"inline_styles": True,
|
|
116
|
+
"code_format": "{code}",
|
|
117
|
+
**(export_html_kwargs or {}),
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
capture = io.StringIO()
|
|
121
|
+
console = Console(file=capture, **console_kwargs)
|
|
122
|
+
console.print(*renderables, **print_kwargs)
|
|
123
|
+
return mo.Html(console.export_html(**export_html_kwargs))
|