analog-daddy 3.0.0b1__tar.gz → 3.0.1.dev2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: analog-daddy
3
- Version: 3.0.0b1
3
+ Version: 3.0.1.dev2
4
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
5
  Author: Siddhant Laddha
6
6
  Author-email: Siddhant Laddha <25705822+siddhantladdha@users.noreply.github.com>
@@ -23,7 +23,7 @@ Requires-Dist: scipy
23
23
  Requires-Dist: xarray
24
24
  Maintainer: Siddhant Laddha
25
25
  Maintainer-email: Siddhant Laddha <25705822+siddhantladdha@users.noreply.github.com>
26
- Requires-Python: >=3.14, <3.15
26
+ Requires-Python: >=3.12
27
27
  Project-URL: bugs, https://github.com/siddhantladdha/analog_daddy/issues
28
28
  Project-URL: changelog, https://github.com/siddhantladdha/analog_daddy/releases
29
29
  Project-URL: documentation, https://siddhantladdha.github.io/analog_daddy/
@@ -0,0 +1,157 @@
1
+ [project]
2
+ name = "analog-daddy"
3
+ version = "3.0.1.dev2"
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
+ "hypothesis",
50
+ "pytest",
51
+ "ruff",
52
+ "ty",
53
+ ]
54
+ docs = [
55
+ "mkdocstrings-python",
56
+ "nbconvert",
57
+ "playwright",
58
+ "zensical",
59
+ ]
60
+ lint = ["pydoclint"]
61
+ notebooks = [
62
+ "marimo[lsp,mcp,recommended]",
63
+ "wigglystuff",
64
+ ]
65
+
66
+ [[dependency-groups.all]]
67
+ include-group = "dev"
68
+
69
+ [[dependency-groups.all]]
70
+ include-group = "docs"
71
+
72
+ [[dependency-groups.all]]
73
+ include-group = "notebooks"
74
+
75
+ [build-system]
76
+ requires = ["uv_build>=0.13.0,<0.14"]
77
+ build-backend = "uv_build"
78
+
79
+ [tool.format_docstring]
80
+ docstring_style = "numpy"
81
+ line_length = 72
82
+ include_arg_types = true
83
+ include_arg_defaults = true
84
+ fix_rst_backticks = true
85
+ exclude = '\.git|\.venv|__pycache__|.*drafts.*\.py'
86
+
87
+ [tool.pydoclint]
88
+ style = "numpy"
89
+ arg-type-hints-in-docstring = true
90
+ arg-type-hints-in-signature = true
91
+ check-return-types = true
92
+ check-arg-defaults = true
93
+ check-style-mismatch = true
94
+ show-filenames-in-every-violation-message = true
95
+ exclude = '\.git|\.tox|\.venv|build|dist|.*drafts.*\.py'
96
+
97
+ [tool.pytest.ini_options]
98
+ addopts = [
99
+ "--doctest-modules",
100
+ "--ignore-glob=*drafts*.py",
101
+ ]
102
+ doctest_optionflags = ["IGNORE_EXCEPTION_DETAIL"]
103
+ testpaths = [
104
+ "src",
105
+ "tests",
106
+ ]
107
+
108
+ [tool.ruff]
109
+ line-length = 79
110
+ extend-exclude = ["*drafts*.py"]
111
+ output-prefer-rule-codes = true
112
+
113
+ [tool.ruff.lint]
114
+ ignore = [
115
+ "D105",
116
+ "D401",
117
+ ]
118
+ extend-select = [
119
+ "NPY",
120
+ "N",
121
+ "PTH",
122
+ "SIM",
123
+ "EXE",
124
+ "FURB110",
125
+ "FURB116",
126
+ "FURB167",
127
+ "FURB177",
128
+ "B903",
129
+ "TRY300",
130
+ "LOG004",
131
+ "LOG007",
132
+ "UP042",
133
+ "PERF403",
134
+ "PERF401",
135
+ "FURB113",
136
+ "FURB152",
137
+ "FURB156",
138
+ ]
139
+ preview = true
140
+ explicit-preview-rules = true
141
+ external = ["DOC105"]
142
+
143
+ [tool.ruff.lint.pydocstyle]
144
+ convention = "numpy"
145
+
146
+ [tool.ruff.format]
147
+ docstring-code-format = true
148
+
149
+ [tool.ty.src]
150
+ exclude = ["**/*drafts*.py"]
151
+
152
+ [tool.ty.terminal]
153
+ output-format = "concise"
154
+
155
+ [tool.uv]
156
+ default-groups = ["all"]
157
+ required-version = ">=0.13.0,<0.14"
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "analog-daddy"
3
- version = "3.0.0b1"
3
+ version = "3.0.1.dev2"
4
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
5
  readme = "README.md"
6
- requires-python = ">= 3.14, < 3.15" # TODO: Review if 3.12 can be supported.
6
+ requires-python = ">= 3.12"
7
7
  license = "MIT"
8
8
  authors = [
9
9
  { name = "Siddhant Laddha", email = "25705822+siddhantladdha@users.noreply.github.com" }
@@ -43,6 +43,8 @@ analog_daddy = "analog_daddy.cli:app"
43
43
 
44
44
  [dependency-groups]
45
45
  dev = [
46
+ "format-docstring",
47
+ "hypothesis",
46
48
  "pytest",
47
49
  "ruff",
48
50
  "ty",
@@ -57,26 +59,50 @@ docs = [
57
59
  "nbconvert", # marimo pdf exports.
58
60
  "playwright", # marimo pdf exports.
59
61
  "zensical",
62
+ # TODO: evaluate vs great-docs for marimo notebooks in docs.
60
63
  ]
64
+ lint = ["pydoclint"]
61
65
  notebooks = [
62
66
  "marimo[lsp,mcp,recommended]",
63
67
  "wigglystuff",
64
68
  ]
65
69
 
66
70
  [build-system]
67
- requires = ["uv_build>=0.11.0,<0.12.0"]
71
+ requires = ["uv_build>=0.13.0,<0.14"]
68
72
  build-backend = "uv_build"
69
73
 
74
+ [tool.format_docstring]
75
+ docstring_style = "numpy"
76
+ line_length = 72
77
+ include_arg_types = true
78
+ include_arg_defaults = true
79
+ fix_rst_backticks = true
80
+ exclude = "\\.git|\\.venv|__pycache__|.*drafts.*\\.py"
81
+
82
+ [tool.pydoclint]
83
+ # issue #313 currently needs # noqa: DOC105
84
+ style = "numpy"
85
+ arg-type-hints-in-docstring = true
86
+ arg-type-hints-in-signature = true
87
+ check-return-types = true
88
+ check-arg-defaults = true
89
+ check-style-mismatch = true
90
+ show-filenames-in-every-violation-message = true
91
+ exclude = '\.git|\.tox|\.venv|build|dist|.*drafts.*\.py'
92
+
70
93
  [tool.pytest.ini_options]
71
- addopts = ["--doctest-modules"]
94
+ addopts = ["--doctest-modules", "--ignore-glob=*drafts*.py"]
95
+ doctest_optionflags = ["IGNORE_EXCEPTION_DETAIL"]
72
96
  testpaths = ["src", "tests"]
73
97
 
74
98
  [tool.ruff]
75
- line-length = 120
76
- extend-exclude = ["archives", "drafts"]
99
+ line-length = 79
100
+ extend-exclude = ["*drafts*.py"]
101
+ output-prefer-rule-codes = true
77
102
 
78
103
  [tool.ruff.lint]
79
104
  ignore = [
105
+ # "DOC", # pydoclint is already handling docstring issues.
80
106
  # "F401", # F401: module imported but unused
81
107
  # "D100", # Missing docstring in public module"
82
108
  # "D103", # undocumented-public-method
@@ -85,7 +111,7 @@ ignore = [
85
111
  ]
86
112
  extend-select = [
87
113
  "NPY", # numpy
88
- "D", # docstring # needs convention
114
+ # "D", # docstring # handled by format-docstring and pydoclint
89
115
  "N", # pep8-naming
90
116
  "PTH", # flake8-use-pathlib
91
117
  "SIM", # flake8-simplify
@@ -116,6 +142,7 @@ extend-select = [
116
142
  # There are certain `preview`/beta rules that I am selectively enabling.
117
143
  preview = true
118
144
  explicit-preview-rules = true
145
+ external = ["DOC105"]
119
146
 
120
147
  [tool.ruff.lint.pydocstyle]
121
148
  convention = "numpy"
@@ -124,10 +151,12 @@ convention = "numpy"
124
151
  docstring-code-format = true
125
152
 
126
153
  [tool.ty]
127
- # All rules are enabled as "error" by default; no need to specify unless overriding.
128
- # Example override: relax a rule for the entire project (uncomment if needed).
129
- # rules.TY015 = "warn" # For invalid-argument-type, warn instead of error.
154
+ [tool.ty.src]
155
+ exclude = ["**/*drafts*.py"]
156
+
157
+ [tool.ty.terminal]
158
+ output-format = "concise"
130
159
 
131
160
  [tool.uv]
132
161
  default-groups = ["all"]
133
- required-version = "==0.11.0"
162
+ required-version = ">=0.13.0,<0.14"
@@ -0,0 +1,5 @@
1
+ """Top-level package for Analog Daddy."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("analog-daddy")
@@ -10,8 +10,12 @@ console = Console()
10
10
  @app.default
11
11
  def main() -> None:
12
12
  """Console script for analog_daddy."""
13
- console.print("Replace this message by putting your code into analog_daddy.cli.main")
14
- console.print("See Cyclopts documentation at https://cyclopts.readthedocs.io/")
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
+ )
15
19
 
16
20
 
17
21
  if __name__ == "__main__":
@@ -0,0 +1,8 @@
1
+ import polars.selectors as cs
2
+ from great_tables import GT
3
+
4
+
5
+ def gt_defaults(gtbl: GT):
6
+ """Preferred defaults for rendering great tables."""
7
+ gtbl = gtbl.fmt_number_si(columns=cs.numeric()).opt_stylize(style=4)
8
+ return gtbl
@@ -0,0 +1,156 @@
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
+ from wigglystuff import CopyToClipboard
18
+
19
+ from analog_daddy.utils import render
20
+
21
+
22
+ def format_mapping_num_to_si(df: pl.DataFrame) -> dict[str, Callable]:
23
+ """
24
+ Build a format mapping that renders numeric columns as SI strings.
25
+
26
+ Intended for the ``format_mapping`` argument of ``mo.ui.table`` and
27
+ ``mo.ui.dataframe``. Columns are matched with ``cs.numeric()`` and
28
+ rendered with :func:`render`.
29
+
30
+ Parameters
31
+ ----------
32
+ df : pl.DataFrame
33
+ DataFrame whose numeric columns to map.
34
+
35
+ Returns
36
+ -------
37
+ dict[str, Callable]
38
+ Column name to formatter mapping.
39
+
40
+ References
41
+ ----------
42
+ - [marimo#9663](https://github.com/marimo-team/marimo/issues/9663)
43
+ - [marimo#7568](https://github.com/marimo-team/marimo/issues/7568)
44
+ """
45
+ return dict.fromkeys(cs.expand_selector(df, cs.numeric()), render)
46
+
47
+
48
+ def mo_table(
49
+ data: pl.DataFrame,
50
+ *,
51
+ selection=None,
52
+ pagination=None,
53
+ page_size=30,
54
+ max_columns=1000,
55
+ **kwargs,
56
+ ) -> mo.ui.table:
57
+ kwargs.setdefault("format_mapping", format_mapping_num_to_si(data))
58
+ return mo.ui.table(
59
+ data,
60
+ selection=selection,
61
+ pagination=pagination,
62
+ page_size=page_size,
63
+ max_columns=max_columns,
64
+ **kwargs,
65
+ )
66
+
67
+
68
+ def rich_md(
69
+ *renderables: RenderableType,
70
+ console_kwargs: dict[str, Any] | None = None,
71
+ print_kwargs: dict[str, Any] | None = None,
72
+ export_html_kwargs: dict[str, Any] | None = None,
73
+ ) -> mo.Html:
74
+ """
75
+ A minimal helper function to utilize rich markup within marimo.
76
+
77
+ Created this for shits-n-giggles. This is in no way complete! I
78
+ don't use this as much as I would like to, however, in case you have
79
+ some text, that you would like to keep consistent with your console
80
+ markup, this might be an option.
81
+
82
+ Parameters
83
+ ----------
84
+ *renderables : RenderableType
85
+ The renderable objects to be printed using rich.
86
+ console_kwargs : dict[str, Any] | None, default=None
87
+ Keyword arguments to customize the rich Console.
88
+ print_kwargs : dict[str, Any] | None, default=None
89
+ Keyword arguments to customize the rich print method.
90
+ export_html_kwargs : dict[str, Any] | None, default=None
91
+ Keyword arguments to customize the rich export_html method.
92
+
93
+ Returns
94
+ -------
95
+ mo.Html
96
+ The HTML representation of the rich renderables.
97
+
98
+ Examples
99
+ --------
100
+ >>> "font-weight: bold" in rich_md("[bold green]Hello[/] World").text
101
+ True
102
+ >>> "font-style: italic" in rich_md(
103
+ ... "[bold]Bold[italic] bold and italic [/bold]italic[/italic]"
104
+ ... ).text
105
+ True
106
+ >>> "⚠️" in rich_md(":warning-emoji: you have been warned!").text
107
+ True
108
+ """
109
+ console_kwargs = {
110
+ "color_system": "truecolor",
111
+ "record": True,
112
+ **(console_kwargs or {}),
113
+ }
114
+ print_kwargs = print_kwargs or {}
115
+ export_html_kwargs = {
116
+ "inline_styles": True,
117
+ "code_format": "{code}",
118
+ **(export_html_kwargs or {}),
119
+ }
120
+
121
+ capture = io.StringIO()
122
+ console = Console(file=capture, **console_kwargs)
123
+ console.print(*renderables, **print_kwargs)
124
+ return mo.Html(console.export_html(**export_html_kwargs))
125
+
126
+
127
+ def df_repr_docstr_clip(
128
+ df: pl.DataFrame, max_rows: int = 3
129
+ ) -> CopyToClipboard:
130
+ """
131
+ Copy the repr of a polars DataFrame to the clipboard.
132
+
133
+ Parameters
134
+ ----------
135
+ df : pl.DataFrame
136
+ The DataFrame to copy the repr of.
137
+ max_rows : int, default=3
138
+ The maximum number of rows to include in the repr.
139
+
140
+ Returns
141
+ -------
142
+ CopyToClipboard
143
+ A CopyToClipboard object containing the repr of the DataFrame.
144
+
145
+ Examples
146
+ --------
147
+ >>> a = pl.DataFrame(
148
+ ... {"x": [9.0, 11.0], "foo": [10.0, 10.0], "bar": [5.0, 5.0]},
149
+ ... )
150
+ >>> df_repr_docstr_clip(a).text_to_copy.startswith("shape: (2, 3)")
151
+ True
152
+ """
153
+
154
+ return CopyToClipboard(
155
+ text_to_copy=df.slice(offset=0, length=max_rows).__repr__(),
156
+ )