marimo-toml-editor 0.1.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.
- marimo_toml_editor-0.1.0/.github/workflows/publish.yml +27 -0
- marimo_toml_editor-0.1.0/.gitignore +42 -0
- marimo_toml_editor-0.1.0/CHANGELOG.md +20 -0
- marimo_toml_editor-0.1.0/CONTRIBUTING_ANYWIDGET.md +68 -0
- marimo_toml_editor-0.1.0/LICENSE +19 -0
- marimo_toml_editor-0.1.0/PKG-INFO +125 -0
- marimo_toml_editor-0.1.0/README.md +91 -0
- marimo_toml_editor-0.1.0/docs/demo.png +0 -0
- marimo_toml_editor-0.1.0/examples/__marimo__/session/demo.py.json +73 -0
- marimo_toml_editor-0.1.0/examples/demo.py +100 -0
- marimo_toml_editor-0.1.0/examples/demo.toml +32 -0
- marimo_toml_editor-0.1.0/pyproject.toml +43 -0
- marimo_toml_editor-0.1.0/src/marimo_toml_editor/__init__.py +6 -0
- marimo_toml_editor-0.1.0/src/marimo_toml_editor/_widget.py +178 -0
- marimo_toml_editor-0.1.0/src/marimo_toml_editor/static/widget.css +654 -0
- marimo_toml_editor-0.1.0/src/marimo_toml_editor/static/widget.js +911 -0
- marimo_toml_editor-0.1.0/widget_toml.py +869 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Upload release to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment:
|
|
12
|
+
name: pypi
|
|
13
|
+
url: https://pypi.org/p/marimo-toml-editor
|
|
14
|
+
permissions:
|
|
15
|
+
id-token: write # IMPORTANT for Trusted Publishing (OIDC)
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout repository
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
|
|
23
|
+
- name: Build package
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Publish package distributions to PyPI
|
|
27
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
*.pyd
|
|
6
|
+
.Python
|
|
7
|
+
*.egg-info/
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual envs
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
env/
|
|
16
|
+
|
|
17
|
+
# uv
|
|
18
|
+
.uv/
|
|
19
|
+
|
|
20
|
+
# Distribution
|
|
21
|
+
*.whl
|
|
22
|
+
*.tar.gz
|
|
23
|
+
|
|
24
|
+
# Editors
|
|
25
|
+
.DS_Store
|
|
26
|
+
.idea/
|
|
27
|
+
.vscode/
|
|
28
|
+
*.swp
|
|
29
|
+
*.swo
|
|
30
|
+
|
|
31
|
+
# Testing
|
|
32
|
+
.pytest_cache/
|
|
33
|
+
.coverage
|
|
34
|
+
htmlcov/
|
|
35
|
+
|
|
36
|
+
# Marimo cache
|
|
37
|
+
.marimo/
|
|
38
|
+
|
|
39
|
+
# Docs
|
|
40
|
+
docs/_build/
|
|
41
|
+
|
|
42
|
+
*.agent
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `marimo-toml-editor` are documented here.
|
|
4
|
+
|
|
5
|
+
## [0.1.0] — 2026-02-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial release
|
|
9
|
+
- `TomlConfigEditor` anywidget with full TOML load/save
|
|
10
|
+
- Tab-per-table navigation
|
|
11
|
+
- Type-aware scalar editors (string, number, boolean, color)
|
|
12
|
+
- Rich list editor with per-item reorder and delete
|
|
13
|
+
- Inline dict editor for shallow nested objects
|
|
14
|
+
- Type badges for each key
|
|
15
|
+
- Key search / filter
|
|
16
|
+
- Undo / Redo history
|
|
17
|
+
- Dirty indicator on the Save button
|
|
18
|
+
- Keyboard shortcuts (Ctrl/Cmd+S save, Ctrl/Cmd+Z undo)
|
|
19
|
+
- Raw JSON preview tab with copy-to-clipboard
|
|
20
|
+
- Light and dark mode support
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Contributing to the anywidget gallery
|
|
2
|
+
|
|
3
|
+
This document contains everything needed to submit `marimo-toml-editor` to the
|
|
4
|
+
[anywidget community gallery](https://anywidget.dev/en/community/).
|
|
5
|
+
|
|
6
|
+
## PR Target
|
|
7
|
+
|
|
8
|
+
**Repo:** https://github.com/manzt/built-with-anywidget
|
|
9
|
+
**File to edit:** `assets/manifest.json`
|
|
10
|
+
|
|
11
|
+
## Manifest entry to add
|
|
12
|
+
|
|
13
|
+
Add this JSON object to the array in `assets/manifest.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"repo": "javirm3/marimo-toml-editor",
|
|
18
|
+
"description": "Interactive TOML config editor for Jupyter and marimo notebooks. Type-aware inputs, rich list/dict editors, tabs, undo/redo, search, and dark mode.",
|
|
19
|
+
"sourceUrl": "https://raw.githubusercontent.com/javirm3/marimo-toml-editor/main/docs/demo.gif"
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> **Note:** You need to create and upload `docs/demo.gif` (a screen recording of
|
|
24
|
+
> the widget in action) before the PR will show a preview image in the gallery.
|
|
25
|
+
|
|
26
|
+
## Suggested PR title
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
feat: add marimo-toml-editor to gallery
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Suggested PR description
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
Hi! I'd like to add **marimo-toml-editor** to the anywidget community gallery.
|
|
36
|
+
|
|
37
|
+
### What it does
|
|
38
|
+
|
|
39
|
+
An interactive TOML config editor widget for Jupyter and marimo notebooks.
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
- Tab-per-table navigation (each top-level TOML `[table]` is its own tab)
|
|
43
|
+
- Type-aware editors: strings, numbers, booleans, hex color picker
|
|
44
|
+
- Rich list editor: per-item rows with reorder (↑↓) and delete buttons
|
|
45
|
+
- Inline dict editor for shallow nested objects
|
|
46
|
+
- Type badges (`str`, `int`, `bool`, `[]`, `{}`) next to each key
|
|
47
|
+
- Key search / filter
|
|
48
|
+
- Undo / redo history
|
|
49
|
+
- Dirty indicator + keyboard shortcuts (Ctrl/Cmd+S save, Ctrl/Cmd+Z undo)
|
|
50
|
+
- Raw JSON preview with clipboard copy
|
|
51
|
+
- Light + dark mode (follows system preference)
|
|
52
|
+
|
|
53
|
+
### Install
|
|
54
|
+
|
|
55
|
+
pip install marimo-toml-editor
|
|
56
|
+
|
|
57
|
+
### PyPI / GitHub
|
|
58
|
+
|
|
59
|
+
- GitHub: https://github.com/javirm3/marimo-toml-editor
|
|
60
|
+
- PyPI: https://pypi.org/project/marimo-toml-editor
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Before submitting
|
|
64
|
+
|
|
65
|
+
- [ ] Package published to PyPI (`uv build && uv publish`)
|
|
66
|
+
- [ ] `docs/demo.gif` created and committed (screen recording of the widget)
|
|
67
|
+
- [ ] GitHub repo is public
|
|
68
|
+
- [ ] `README.md` has a screenshot / gif at the top
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: marimo-toml-editor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Interactive TOML config editor widget for Jupyter and marimo notebooks
|
|
5
|
+
Project-URL: Homepage, https://github.com/javirm3/marimo-toml-editor
|
|
6
|
+
Project-URL: Repository, https://github.com/javirm3/marimo-toml-editor
|
|
7
|
+
Project-URL: Issues, https://github.com/javirm3/marimo-toml-editor/issues
|
|
8
|
+
Author: Javier Rodríguez Martínez
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: anywidget,config,editor,jupyter,marimo,toml
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Jupyter
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: anywidget>=0.9
|
|
25
|
+
Requires-Dist: tomli>=1.2; python_version < '3.11'
|
|
26
|
+
Requires-Dist: traitlets>=5.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
29
|
+
Requires-Dist: marimo; extra == 'dev'
|
|
30
|
+
Requires-Dist: tomli-w; extra == 'dev'
|
|
31
|
+
Provides-Extra: save
|
|
32
|
+
Requires-Dist: tomli-w>=1.0; extra == 'save'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# marimo-toml-editor
|
|
36
|
+
|
|
37
|
+
> An interactive TOML config editor widget for **Jupyter** and **marimo** notebooks — built with [anywidget](https://anywidget.dev).
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Features
|
|
42
|
+
|
|
43
|
+
- 🗂 **Tab-per-table navigation** — each top-level TOML table is a tab
|
|
44
|
+
- ✏️ **Type-aware editors** — strings, numbers, booleans (toggle), colors (color picker + hex field)
|
|
45
|
+
- 📋 **Rich list editor** — per-item rows with reorder (↑↓) and delete
|
|
46
|
+
- 🪆 **Inline dict editor** — shallow nested tables rendered as compact key-value rows
|
|
47
|
+
- 🏷 **Type badges** — each key shows its type at a glance (`str`, `int`, `bool`, `[]`, `{}`)
|
|
48
|
+
- 🔍 **Search / filter** — filter keys within a tab
|
|
49
|
+
- ↩ **Undo / Redo** — full history
|
|
50
|
+
- 💾 **Save to disk** — requires `tomli-w`
|
|
51
|
+
- 🌗 **Light + dark mode** — follows system preference
|
|
52
|
+
|
|
53
|
+
## Install
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install marimo-toml-editor # read-only
|
|
57
|
+
pip install "marimo-toml-editor[save]" # with save support (tomli-w)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### In marimo
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
import marimo as mo
|
|
66
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
67
|
+
|
|
68
|
+
editor = mo.ui.anywidget(TomlConfigEditor("config.toml"))
|
|
69
|
+
editor
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Access the current data reactively:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
editor.value["data"] # dict with the current TOML contents
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### In Jupyter
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
82
|
+
|
|
83
|
+
w = TomlConfigEditor("config.toml")
|
|
84
|
+
w
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Start from a dict (no file)
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
91
|
+
|
|
92
|
+
w = TomlConfigEditor()
|
|
93
|
+
w.data = {
|
|
94
|
+
"title": "My App",
|
|
95
|
+
"debug": False,
|
|
96
|
+
"server": {"host": "0.0.0.0", "port": 8080},
|
|
97
|
+
"tags": ["web", "api"],
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## API
|
|
102
|
+
|
|
103
|
+
| Attribute | Type | Description |
|
|
104
|
+
|-----------|------|-------------|
|
|
105
|
+
| `data` | `dict` | Current TOML data (synced) |
|
|
106
|
+
| `path` | `str` | File path (synced) |
|
|
107
|
+
| `name` | `str` | Display name (synced) |
|
|
108
|
+
| `status` | `str` | Last operation status message |
|
|
109
|
+
|
|
110
|
+
| Method | Description |
|
|
111
|
+
|--------|-------------|
|
|
112
|
+
| `load(path)` | Load a TOML file |
|
|
113
|
+
| `save(path?)` | Save to disk (requires `tomli-w`) |
|
|
114
|
+
|
|
115
|
+
## Development
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/javirm3/marimo-toml-editor
|
|
119
|
+
cd marimo-toml-editor
|
|
120
|
+
uv run marimo edit examples/demo.py
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# marimo-toml-editor
|
|
2
|
+
|
|
3
|
+
> An interactive TOML config editor widget for **Jupyter** and **marimo** notebooks — built with [anywidget](https://anywidget.dev).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- 🗂 **Tab-per-table navigation** — each top-level TOML table is a tab
|
|
10
|
+
- ✏️ **Type-aware editors** — strings, numbers, booleans (toggle), colors (color picker + hex field)
|
|
11
|
+
- 📋 **Rich list editor** — per-item rows with reorder (↑↓) and delete
|
|
12
|
+
- 🪆 **Inline dict editor** — shallow nested tables rendered as compact key-value rows
|
|
13
|
+
- 🏷 **Type badges** — each key shows its type at a glance (`str`, `int`, `bool`, `[]`, `{}`)
|
|
14
|
+
- 🔍 **Search / filter** — filter keys within a tab
|
|
15
|
+
- ↩ **Undo / Redo** — full history
|
|
16
|
+
- 💾 **Save to disk** — requires `tomli-w`
|
|
17
|
+
- 🌗 **Light + dark mode** — follows system preference
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install marimo-toml-editor # read-only
|
|
23
|
+
pip install "marimo-toml-editor[save]" # with save support (tomli-w)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### In marimo
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
import marimo as mo
|
|
32
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
33
|
+
|
|
34
|
+
editor = mo.ui.anywidget(TomlConfigEditor("config.toml"))
|
|
35
|
+
editor
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Access the current data reactively:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
editor.value["data"] # dict with the current TOML contents
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### In Jupyter
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
48
|
+
|
|
49
|
+
w = TomlConfigEditor("config.toml")
|
|
50
|
+
w
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Start from a dict (no file)
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
57
|
+
|
|
58
|
+
w = TomlConfigEditor()
|
|
59
|
+
w.data = {
|
|
60
|
+
"title": "My App",
|
|
61
|
+
"debug": False,
|
|
62
|
+
"server": {"host": "0.0.0.0", "port": 8080},
|
|
63
|
+
"tags": ["web", "api"],
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## API
|
|
68
|
+
|
|
69
|
+
| Attribute | Type | Description |
|
|
70
|
+
|-----------|------|-------------|
|
|
71
|
+
| `data` | `dict` | Current TOML data (synced) |
|
|
72
|
+
| `path` | `str` | File path (synced) |
|
|
73
|
+
| `name` | `str` | Display name (synced) |
|
|
74
|
+
| `status` | `str` | Last operation status message |
|
|
75
|
+
|
|
76
|
+
| Method | Description |
|
|
77
|
+
|--------|-------------|
|
|
78
|
+
| `load(path)` | Load a TOML file |
|
|
79
|
+
| `save(path?)` | Save to disk (requires `tomli-w`) |
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/javirm3/marimo-toml-editor
|
|
85
|
+
cd marimo-toml-editor
|
|
86
|
+
uv run marimo edit examples/demo.py
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
MIT
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1",
|
|
3
|
+
"metadata": {
|
|
4
|
+
"marimo_version": "0.19.11"
|
|
5
|
+
},
|
|
6
|
+
"cells": [
|
|
7
|
+
{
|
|
8
|
+
"id": "MJUe",
|
|
9
|
+
"code_hash": "9bac4ebf9b43839df654aedbad122c16",
|
|
10
|
+
"outputs": [
|
|
11
|
+
{
|
|
12
|
+
"type": "data",
|
|
13
|
+
"data": {
|
|
14
|
+
"text/markdown": "<span class=\"markdown prose dark:prose-invert contents\"><h1 id=\"marimo-toml-editor-demo\">\ud83d\udcdd marimo-toml-editor demo</h1>\n<span class=\"paragraph\">An interactive TOML config editor widget built with <a href=\"https://anywidget.dev\" rel=\"noopener noreferrer\" target=\"_blank\">anywidget</a>.</span>\n<span class=\"paragraph\"><strong>Features:</strong> tab-per-table, type-aware inputs, rich list/dict editors,\ntype badges, search, undo/redo, dirty indicator, keyboard shortcuts.</span></span>"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"console": []
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "Hbol",
|
|
22
|
+
"code_hash": "077d526e89f1189124e29c3537608cbf",
|
|
23
|
+
"outputs": [
|
|
24
|
+
{
|
|
25
|
+
"type": "data",
|
|
26
|
+
"data": {
|
|
27
|
+
"text/plain": ""
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"console": []
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "vblA",
|
|
35
|
+
"code_hash": "76740d289b9c334b6a01bda376c5e696",
|
|
36
|
+
"outputs": [
|
|
37
|
+
{
|
|
38
|
+
"type": "data",
|
|
39
|
+
"data": {
|
|
40
|
+
"text/plain": ""
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"console": []
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "bkHC",
|
|
48
|
+
"code_hash": "417e21a025eddbf41687b5f3b46a71d1",
|
|
49
|
+
"outputs": [
|
|
50
|
+
{
|
|
51
|
+
"type": "data",
|
|
52
|
+
"data": {
|
|
53
|
+
"text/html": "<marimo-ui-element object-id='bkHC-0' random-id='bb4ab082-2cec-fbb5-be89-b6797ce7f543'><marimo-anywidget data-initial-value='{"model_id":"96705e4251554b689d7a322bd3e65d0a"}' data-label='null' data-js-url='"./@file/39078-2594138-UFiKyG5Y.js"' data-js-hash='"7798eab70a4d201909e8458307516180"'></marimo-anywidget></marimo-ui-element>"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"console": []
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "lEQa",
|
|
61
|
+
"code_hash": "96dadf106cbe1cb6085e8c63fe8c0f50",
|
|
62
|
+
"outputs": [
|
|
63
|
+
{
|
|
64
|
+
"type": "data",
|
|
65
|
+
"data": {
|
|
66
|
+
"text/markdown": "<span class=\"markdown prose dark:prose-invert contents\"><h3 id=\"current-state\">Current state</h3>\n<ul>\n<li><strong>Title:</strong> <code>My Application</code></li>\n<li><strong>Debug:</strong> <code>False</code></li>\n<li><strong>Tags:</strong> <code>['web', 'api', 'production']</code></li>\n<li><strong>Server port:</strong> <code>8080</code></li>\n</ul></span>"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"console": []
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import marimo
|
|
2
|
+
|
|
3
|
+
__generated_with = "0.19.11"
|
|
4
|
+
app = marimo.App(width="medium")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@app.cell
|
|
8
|
+
def _():
|
|
9
|
+
# /// script
|
|
10
|
+
# requires-python = ">=3.9"
|
|
11
|
+
# dependencies = [
|
|
12
|
+
# "marimo",
|
|
13
|
+
# "anywidget>=0.9",
|
|
14
|
+
# "traitlets>=5.0",
|
|
15
|
+
# "tomli-w>=1.0",
|
|
16
|
+
# ]
|
|
17
|
+
# ///
|
|
18
|
+
import marimo as mo
|
|
19
|
+
|
|
20
|
+
return (mo,)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@app.cell
|
|
24
|
+
def _(mo):
|
|
25
|
+
mo.md(r"""
|
|
26
|
+
# 📝 marimo-toml-editor demo
|
|
27
|
+
|
|
28
|
+
An interactive TOML config editor widget built with [anywidget](https://anywidget.dev).
|
|
29
|
+
|
|
30
|
+
**Features:** tab-per-table, type-aware inputs, rich list/dict editors,
|
|
31
|
+
type badges, search, undo/redo, dirty indicator, keyboard shortcuts.
|
|
32
|
+
""")
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@app.cell
|
|
37
|
+
def _():
|
|
38
|
+
import sys
|
|
39
|
+
sys.path.insert(0, "../src") # dev: load from source
|
|
40
|
+
from marimo_toml_editor import TomlConfigEditor
|
|
41
|
+
|
|
42
|
+
return (TomlConfigEditor,)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@app.cell
|
|
46
|
+
def _(TomlConfigEditor, mo):
|
|
47
|
+
# Instantiate with a sample file path.
|
|
48
|
+
# The widget will create / load the file when you click Open or Save.
|
|
49
|
+
editor = mo.ui.anywidget(TomlConfigEditor(name="demo"))
|
|
50
|
+
|
|
51
|
+
# Pre-populate with example data (no file required for the demo)
|
|
52
|
+
editor.widget.data = {
|
|
53
|
+
"title": "My Application",
|
|
54
|
+
"debug": False,
|
|
55
|
+
"version": "1.0.0",
|
|
56
|
+
"primary_color": "#3b82f6",
|
|
57
|
+
"max_retries": 3,
|
|
58
|
+
"tags": ["web", "api", "production"],
|
|
59
|
+
"server": {
|
|
60
|
+
"host": "0.0.0.0",
|
|
61
|
+
"port": 8080,
|
|
62
|
+
"workers": 4,
|
|
63
|
+
},
|
|
64
|
+
"database": {
|
|
65
|
+
"url": "postgresql://localhost/mydb",
|
|
66
|
+
"pool_size": 10,
|
|
67
|
+
"echo": False,
|
|
68
|
+
"options": {
|
|
69
|
+
"timeout": 30,
|
|
70
|
+
"retries": 3,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
"logging": {
|
|
74
|
+
"level": "INFO",
|
|
75
|
+
"format": "json",
|
|
76
|
+
"outputs": ["stdout", "file"],
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
editor
|
|
81
|
+
return (editor,)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@app.cell
|
|
85
|
+
def _(editor, mo):
|
|
86
|
+
# Reactively display the current data as the user edits
|
|
87
|
+
_data = editor.value.get("data", {})
|
|
88
|
+
mo.md(f"""
|
|
89
|
+
### Current state
|
|
90
|
+
|
|
91
|
+
- **Title:** `{_data.get('title', '—')}`
|
|
92
|
+
- **Debug:** `{_data.get('debug', '—')}`
|
|
93
|
+
- **Tags:** `{_data.get('tags', [])}`
|
|
94
|
+
- **Server port:** `{(_data.get('server') or {}).get('port', '—')}`
|
|
95
|
+
""")
|
|
96
|
+
return
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
app.run()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
title = "My Application"
|
|
2
|
+
debug = false
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
primary_color = "#3b82f6"
|
|
5
|
+
max_retries = 3
|
|
6
|
+
tags = [
|
|
7
|
+
"web",
|
|
8
|
+
"api",
|
|
9
|
+
"production",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[server]
|
|
13
|
+
host = "0.0.0.0"
|
|
14
|
+
port = 8080
|
|
15
|
+
workers = 4
|
|
16
|
+
|
|
17
|
+
[database]
|
|
18
|
+
url = "postgresql://localhost/mydb"
|
|
19
|
+
pool_size = 10
|
|
20
|
+
echo = false
|
|
21
|
+
|
|
22
|
+
[database.options]
|
|
23
|
+
timeout = 30
|
|
24
|
+
retries = 3
|
|
25
|
+
|
|
26
|
+
[logging]
|
|
27
|
+
level = "INFO"
|
|
28
|
+
format = "json"
|
|
29
|
+
outputs = [
|
|
30
|
+
"stdout",
|
|
31
|
+
"file",
|
|
32
|
+
]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "marimo-toml-editor"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Interactive TOML config editor widget for Jupyter and marimo notebooks"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
authors = [{ name = "Javier Rodríguez Martínez" }]
|
|
12
|
+
keywords = ["marimo", "jupyter", "anywidget", "toml", "config", "editor"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Intended Audience :: Science/Research",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.9",
|
|
20
|
+
"Programming Language :: Python :: 3.10",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
24
|
+
"Framework :: Jupyter",
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.9"
|
|
27
|
+
dependencies = [
|
|
28
|
+
"anywidget>=0.9",
|
|
29
|
+
"traitlets>=5.0",
|
|
30
|
+
"tomli>=1.2; python_version < '3.11'",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
save = ["tomli-w>=1.0"]
|
|
35
|
+
dev = ["marimo", "tomli-w", "hatch"]
|
|
36
|
+
|
|
37
|
+
[project.urls]
|
|
38
|
+
Homepage = "https://github.com/javirm3/marimo-toml-editor"
|
|
39
|
+
Repository = "https://github.com/javirm3/marimo-toml-editor"
|
|
40
|
+
Issues = "https://github.com/javirm3/marimo-toml-editor/issues"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["src/marimo_toml_editor"]
|