marimo-dev 0.2.6__tar.gz → 0.2.8__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.3
2
2
  Name: marimo-dev
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: Build and publish python packages from marimo notebooks
5
5
  Author: Deufel
6
6
  Author-email: Deufel <MDeufel13@gmail.com>
@@ -18,7 +18,6 @@ Project-URL: Repository, https://github.com/deufel/m-dev
18
18
  Project-URL: PyPI, https://pypi.org/project/marimo-dev/
19
19
  Description-Content-Type: text/markdown
20
20
 
21
-
22
21
  # marimo-dev
23
22
 
24
23
  Build Python packages from Marimo notebooks.
@@ -93,8 +92,19 @@ from .core import greet
93
92
 
94
93
  ## What gets exported
95
94
 
96
- 1. constants in setup cells
97
- 2. [self-contained functions and classes](https://docs.marimo.io/guides/reusing_functions/)
95
+ 1. **Constants in setup cells** — any assignment in a setup cell becomes a constant
96
+ 2. **Decorated functions and classes** — [self-contained functions and classes](https://docs.marimo.io/guides/reusing_functions/) with `@app.function` or `@app.class_definition`
97
+ 3. **Export-named cells** — name a cell `export` (or `export_something`) to export arbitrary code as a blob:
98
+
99
+ ```python
100
+ @app.cell
101
+ def export_main():
102
+ if __name__ == "__main__":
103
+ main()
104
+ return
105
+ ```
106
+
107
+ This is useful for code that isn't a function or class, like `if __name__ == "__main__"` blocks.
98
108
 
99
109
  ## Hash pipe directives
100
110
 
@@ -150,6 +160,8 @@ skip_prefixes = ["XX_", "test_"] # ignore these files
150
160
 
151
161
  ```bash
152
162
  md build # build package from notebooks and make docs
163
+ md bundle # bundle into single file with PEP 723 dependencies
164
+ md bundle app.py # bundle to specific filename at project root
153
165
  md docs # build the static docs (beta)
154
166
  md publish --test # publish to Test PyPI
155
167
  md publish # publish to PyPI
@@ -158,6 +170,25 @@ md nuke # remove all build artifacts (dist, docs, src, temp*)
158
170
  ```
159
171
  *If you make a temp folder it will be explicitly removed when running `md nuke`*
160
172
 
173
+ ## Single-file applications
174
+
175
+ Use `md bundle` to create a standalone Python file with [PEP 723](https://peps.python.org/pep-0723/) inline dependencies:
176
+
177
+ ```bash
178
+ md bundle app.py
179
+ uv run app.py
180
+ ```
181
+
182
+ The generated file includes a dependency header that `uv` reads automatically:
183
+
184
+ ```python
185
+ # /// script
186
+ # dependencies = ["fasthtml", "uvicorn"]
187
+ # ///
188
+ ```
189
+
190
+ This lets you deploy a single `.py` file — anyone with `uv` can run it without manual dependency installation.
191
+
161
192
  ## Dependencies
162
193
 
163
194
  Marimo manages package dependencies automatically through its package tab. You do not need to manually maintain `pyproject.toml` dependencies during development.
@@ -1,4 +1,3 @@
1
-
2
1
  # marimo-dev
3
2
 
4
3
  Build Python packages from Marimo notebooks.
@@ -73,8 +72,19 @@ from .core import greet
73
72
 
74
73
  ## What gets exported
75
74
 
76
- 1. constants in setup cells
77
- 2. [self-contained functions and classes](https://docs.marimo.io/guides/reusing_functions/)
75
+ 1. **Constants in setup cells** — any assignment in a setup cell becomes a constant
76
+ 2. **Decorated functions and classes** — [self-contained functions and classes](https://docs.marimo.io/guides/reusing_functions/) with `@app.function` or `@app.class_definition`
77
+ 3. **Export-named cells** — name a cell `export` (or `export_something`) to export arbitrary code as a blob:
78
+
79
+ ```python
80
+ @app.cell
81
+ def export_main():
82
+ if __name__ == "__main__":
83
+ main()
84
+ return
85
+ ```
86
+
87
+ This is useful for code that isn't a function or class, like `if __name__ == "__main__"` blocks.
78
88
 
79
89
  ## Hash pipe directives
80
90
 
@@ -130,6 +140,8 @@ skip_prefixes = ["XX_", "test_"] # ignore these files
130
140
 
131
141
  ```bash
132
142
  md build # build package from notebooks and make docs
143
+ md bundle # bundle into single file with PEP 723 dependencies
144
+ md bundle app.py # bundle to specific filename at project root
133
145
  md docs # build the static docs (beta)
134
146
  md publish --test # publish to Test PyPI
135
147
  md publish # publish to PyPI
@@ -138,6 +150,25 @@ md nuke # remove all build artifacts (dist, docs, src, temp*)
138
150
  ```
139
151
  *If you make a temp folder it will be explicitly removed when running `md nuke`*
140
152
 
153
+ ## Single-file applications
154
+
155
+ Use `md bundle` to create a standalone Python file with [PEP 723](https://peps.python.org/pep-0723/) inline dependencies:
156
+
157
+ ```bash
158
+ md bundle app.py
159
+ uv run app.py
160
+ ```
161
+
162
+ The generated file includes a dependency header that `uv` reads automatically:
163
+
164
+ ```python
165
+ # /// script
166
+ # dependencies = ["fasthtml", "uvicorn"]
167
+ # ///
168
+ ```
169
+
170
+ This lets you deploy a single `.py` file — anyone with `uv` can run it without manual dependency installation.
171
+
141
172
  ## Dependencies
142
173
 
143
174
  Marimo manages package dependencies automatically through its package tab. You do not need to manually maintain `pyproject.toml` dependencies during development.
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "marimo-dev"
7
- version = "0.2.6"
7
+ version = "0.2.8"
8
8
  description = "Build and publish python packages from marimo notebooks"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -1,5 +1,5 @@
1
1
  """Build and publish python packages from marimo notebooks"""
2
- __version__ = '0.2.6'
2
+ __version__ = '0.2.8'
3
3
  __author__ = 'Deufel'
4
4
  from .core import Config, read_config, Kind, Param, Node
5
5
  from .read import inline_doc, parse_params, parse_hash_pipe, parse_class_params, parse_class_methods, parse_ret, src_with_decs, is_export, parse_import, parse_const, parse_export, parse_node, parse_file, read_meta, nb_name, scan
@@ -108,7 +108,8 @@ def render_node(
108
108
  edit_btn = A(Button(Icon('code', size=16), "Edit", style=btn_style), href=f"{repo_url}/edit/master/{nb}", target="_blank", style=link_style) if repo_url and nb else None
109
109
  blame_btn = A(Button(Icon('info', size=16), "Blame", style=btn_style), href=f"{repo_url}/blame/master/{nb}#L{n.lineno}", target="_blank", style=link_style) if repo_url and nb and n.lineno else None
110
110
  history_btn = A(Button(Icon('calendar', size=16), "History", style=btn_style), href=f"{repo_url}/commits/master/{nb}", target="_blank", style=link_style) if repo_url and nb else None
111
- issue_btn = A(Button(Icon('circle-x', size=16), "Issue", style=btn_style), href=f"{repo_url}/issues/new?title=Issue%20with%20{n.name}&body=Found%20in%20{nb}%23L{n.lineno}", target="_blank", style=link_style) if repo_url and nb else None
111
+ issue_btn = A(Button(Icon('circle-x', size=16), "Issue", style=btn_style), href=f"{repo_url}/issues/new?title=Issue%20with%20{n.name}&body={repo_url}/blob/master/{nb}%23L{n.lineno}", target="_blank", style=link_style) if repo_url and nb else None
112
+
112
113
  header = Div(
113
114
  Div(tag, full_name, style="display: flex; align-items: center;"),
114
115
  Div(copy_btn, source_btn, edit_btn, blame_btn, history_btn, issue_btn, style="display: flex; align-items: center; gap: 0.5rem;"),
@@ -165,6 +166,7 @@ def build_docs(
165
166
  (docs_path / "index.html").write_text(to_xml(render_index_page(meta, mods)))
166
167
  for mod_name, mod_nodes in mods:
167
168
  (docs_path / f"{mod_name}.html").write_text(to_xml(render_module_page(mod_name, mod_nodes, mod_names, meta, root)))
169
+ export_wasm(root)
168
170
  return f"Generated index + {len(mods)} module pages in {docs_path}"
169
171
 
170
172
  def export_wasm(root='.'):