moutils 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.
- moutils-0.1.0/.github/workflows/build.yml +34 -0
- moutils-0.1.0/.github/workflows/pages.yml +71 -0
- moutils-0.1.0/.gitignore +10 -0
- moutils-0.1.0/.pre-commit-config.yaml +31 -0
- moutils-0.1.0/LICENSE +21 -0
- moutils-0.1.0/PKG-INFO +78 -0
- moutils-0.1.0/README.md +69 -0
- moutils-0.1.0/deno.json +14 -0
- moutils-0.1.0/notebooks/example.py +141 -0
- moutils-0.1.0/pyproject.toml +23 -0
- moutils-0.1.0/releasing.md +37 -0
- moutils-0.1.0/renovate.json +6 -0
- moutils-0.1.0/src/moutils/__init__.py +292 -0
- moutils-0.1.0/src/moutils/static/cookies.js +80 -0
- moutils-0.1.0/src/moutils/static/hash.js +90 -0
- moutils-0.1.0/src/moutils/static/path.js +82 -0
- moutils-0.1.0/src/moutils/static/query.js +93 -0
- moutils-0.1.0/src/moutils/static/slot.js +153 -0
- moutils-0.1.0/src/moutils/static/storage.js +164 -0
- moutils-0.1.0/uv.lock +636 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Build package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- '[0-9]+.[0-9]+.[0-9]+'
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
timeout-minutes: 10
|
|
15
|
+
permissions:
|
|
16
|
+
id-token: write
|
|
17
|
+
contents: write
|
|
18
|
+
env:
|
|
19
|
+
UV_PYTHON: 3.12
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v5
|
|
26
|
+
|
|
27
|
+
- name: Build package
|
|
28
|
+
run: |
|
|
29
|
+
uv build
|
|
30
|
+
|
|
31
|
+
- name: Publish package
|
|
32
|
+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
|
33
|
+
run: |
|
|
34
|
+
uv publish
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Weekly
|
|
5
|
+
schedule:
|
|
6
|
+
- cron: '0 0 * * 0' # Run at midnight UTC on Sunday
|
|
7
|
+
|
|
8
|
+
# Run on pushes to main that affect notebooks or workflow
|
|
9
|
+
push:
|
|
10
|
+
branches: [main]
|
|
11
|
+
paths:
|
|
12
|
+
- 'notebooks/**'
|
|
13
|
+
- 'src/**'
|
|
14
|
+
- '.github/workflows/pages.yml'
|
|
15
|
+
|
|
16
|
+
# Allow manual trigger
|
|
17
|
+
workflow_dispatch: {}
|
|
18
|
+
|
|
19
|
+
# Prevent concurrent deployments
|
|
20
|
+
concurrency:
|
|
21
|
+
group: pages
|
|
22
|
+
cancel-in-progress: true
|
|
23
|
+
|
|
24
|
+
env:
|
|
25
|
+
UV_SYSTEM_PYTHON: 1
|
|
26
|
+
PYTHON_VERSION: '3.12'
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
export-notebooks:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
|
|
32
|
+
permissions:
|
|
33
|
+
pull-requests: write
|
|
34
|
+
contents: write
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- name: 🐍 Setup uv
|
|
40
|
+
uses: astral-sh/setup-uv@v5
|
|
41
|
+
with:
|
|
42
|
+
enable-cache: true
|
|
43
|
+
python-version: ${{ env.PYTHON_VERSION }}
|
|
44
|
+
|
|
45
|
+
- name: 📄 Export notebooks
|
|
46
|
+
run: |
|
|
47
|
+
uvx marimo export html-wasm notebooks/example.py -o _site --mode edit
|
|
48
|
+
|
|
49
|
+
- name: 📦 Upload Pages Artifact
|
|
50
|
+
uses: actions/upload-pages-artifact@v3
|
|
51
|
+
with:
|
|
52
|
+
path: _site
|
|
53
|
+
retention-days: 7
|
|
54
|
+
|
|
55
|
+
deploy:
|
|
56
|
+
needs: export-notebooks
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
environment:
|
|
59
|
+
name: github-pages
|
|
60
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
61
|
+
|
|
62
|
+
permissions:
|
|
63
|
+
pages: write
|
|
64
|
+
id-token: write
|
|
65
|
+
|
|
66
|
+
steps:
|
|
67
|
+
- name: 🌐 Deploy to GitHub Pages
|
|
68
|
+
id: deployment
|
|
69
|
+
uses: actions/deploy-pages@v4
|
|
70
|
+
with:
|
|
71
|
+
artifact_name: github-pages
|
moutils-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
fail_fast: false
|
|
2
|
+
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v5.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/rhysd/actionlint
|
|
10
|
+
rev: v1.7.7
|
|
11
|
+
hooks:
|
|
12
|
+
- id: actionlint
|
|
13
|
+
args: [-ignore, SC]
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
16
|
+
rev: v0.44.0
|
|
17
|
+
hooks:
|
|
18
|
+
- id: markdownlint-fix
|
|
19
|
+
args: [-c, configs/.markdownlint.yaml, --fix, --disable, MD028]
|
|
20
|
+
|
|
21
|
+
- repo: https://github.com/crate-ci/typos
|
|
22
|
+
rev: typos-dict-v0.12.4
|
|
23
|
+
hooks:
|
|
24
|
+
- id: typos
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
27
|
+
rev: v0.9.6
|
|
28
|
+
hooks:
|
|
29
|
+
- id: ruff
|
|
30
|
+
# Run the formatter
|
|
31
|
+
- id: ruff-format
|
moutils-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 marimo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
moutils-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: moutils
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
License-File: LICENSE
|
|
5
|
+
Requires-Dist: anywidget
|
|
6
|
+
Provides-Extra: dev
|
|
7
|
+
Requires-Dist: marimo; extra == 'dev'
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# moutils
|
|
11
|
+
|
|
12
|
+
Utility functions used in [marimo](https://github.com/marimo-team/marimo).
|
|
13
|
+
|
|
14
|
+
> [!NOTE]
|
|
15
|
+
> This is a community led effort and not actively prioritized by the core marimo team.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install moutils
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
uv add moutils
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Included
|
|
30
|
+
|
|
31
|
+
### URLHash
|
|
32
|
+
|
|
33
|
+
Widget for interacting with URL hash. Allows you to get and set the hash portion of the URL.
|
|
34
|
+
|
|
35
|
+
### URLPath
|
|
36
|
+
|
|
37
|
+
Widget for interacting with URL path. Allows you to get and set the current URL path.
|
|
38
|
+
|
|
39
|
+
### DOMQuery
|
|
40
|
+
|
|
41
|
+
Widget for querying DOM elements. Use CSS selectors to find and interact with elements on the page.
|
|
42
|
+
|
|
43
|
+
### CookieManager
|
|
44
|
+
|
|
45
|
+
Widget for managing browser cookies. Get, set, and monitor browser cookies.
|
|
46
|
+
|
|
47
|
+
### StorageItem
|
|
48
|
+
|
|
49
|
+
Widget for interacting with browser storage (local/session). Access and manipulate data in browser's localStorage or sessionStorage.
|
|
50
|
+
|
|
51
|
+
### Slot
|
|
52
|
+
|
|
53
|
+
Widget for creating a slot that can contain HTML and handle DOM events. Supports a wide range of events:
|
|
54
|
+
|
|
55
|
+
- Mouse events (click, hover, etc.)
|
|
56
|
+
- Keyboard events
|
|
57
|
+
- Form events
|
|
58
|
+
- Drag and drop
|
|
59
|
+
- Touch events
|
|
60
|
+
- Pointer events
|
|
61
|
+
- Scroll events
|
|
62
|
+
- Clipboard events
|
|
63
|
+
- Animation and transition events
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
We use [uv](https://github.com/astral-sh/uv) for development.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
uv run marimo notebooks/example.py
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Installing pre-commit
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
uv tool install pre-commit
|
|
77
|
+
pre-commit
|
|
78
|
+
```
|
moutils-0.1.0/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# moutils
|
|
2
|
+
|
|
3
|
+
Utility functions used in [marimo](https://github.com/marimo-team/marimo).
|
|
4
|
+
|
|
5
|
+
> [!NOTE]
|
|
6
|
+
> This is a community led effort and not actively prioritized by the core marimo team.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
pip install moutils
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or with [uv](https://github.com/astral-sh/uv):
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
uv add moutils
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Included
|
|
21
|
+
|
|
22
|
+
### URLHash
|
|
23
|
+
|
|
24
|
+
Widget for interacting with URL hash. Allows you to get and set the hash portion of the URL.
|
|
25
|
+
|
|
26
|
+
### URLPath
|
|
27
|
+
|
|
28
|
+
Widget for interacting with URL path. Allows you to get and set the current URL path.
|
|
29
|
+
|
|
30
|
+
### DOMQuery
|
|
31
|
+
|
|
32
|
+
Widget for querying DOM elements. Use CSS selectors to find and interact with elements on the page.
|
|
33
|
+
|
|
34
|
+
### CookieManager
|
|
35
|
+
|
|
36
|
+
Widget for managing browser cookies. Get, set, and monitor browser cookies.
|
|
37
|
+
|
|
38
|
+
### StorageItem
|
|
39
|
+
|
|
40
|
+
Widget for interacting with browser storage (local/session). Access and manipulate data in browser's localStorage or sessionStorage.
|
|
41
|
+
|
|
42
|
+
### Slot
|
|
43
|
+
|
|
44
|
+
Widget for creating a slot that can contain HTML and handle DOM events. Supports a wide range of events:
|
|
45
|
+
|
|
46
|
+
- Mouse events (click, hover, etc.)
|
|
47
|
+
- Keyboard events
|
|
48
|
+
- Form events
|
|
49
|
+
- Drag and drop
|
|
50
|
+
- Touch events
|
|
51
|
+
- Pointer events
|
|
52
|
+
- Scroll events
|
|
53
|
+
- Clipboard events
|
|
54
|
+
- Animation and transition events
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
We use [uv](https://github.com/astral-sh/uv) for development.
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
uv run marimo notebooks/example.py
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Installing pre-commit
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
uv tool install pre-commit
|
|
68
|
+
pre-commit
|
|
69
|
+
```
|
moutils-0.1.0/deno.json
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import marimo
|
|
2
|
+
|
|
3
|
+
__generated_with = "0.11.26"
|
|
4
|
+
app = marimo.App(width="medium")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@app.cell
|
|
8
|
+
def _():
|
|
9
|
+
import marimo as mo
|
|
10
|
+
from moutils import (
|
|
11
|
+
URLHash,
|
|
12
|
+
URLPath,
|
|
13
|
+
StorageItem,
|
|
14
|
+
CookieManager,
|
|
15
|
+
DOMQuery,
|
|
16
|
+
Slot,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return CookieManager, DOMQuery, Slot, StorageItem, URLHash, URLPath, mo
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@app.cell
|
|
23
|
+
def _(mo):
|
|
24
|
+
mo.md(r"""## `URLPath`""")
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@app.cell
|
|
29
|
+
def _(URLPath):
|
|
30
|
+
url_path = URLPath()
|
|
31
|
+
return (url_path,)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@app.cell
|
|
35
|
+
def _(url_path):
|
|
36
|
+
url_path.path
|
|
37
|
+
return
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@app.cell
|
|
41
|
+
def _(mo):
|
|
42
|
+
mo.md(r"""## `URLHash`""")
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@app.cell
|
|
47
|
+
def _(URLHash):
|
|
48
|
+
url_hash = URLHash()
|
|
49
|
+
return (url_hash,)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@app.cell
|
|
53
|
+
def _(url_hash):
|
|
54
|
+
url_hash.hash
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@app.cell
|
|
59
|
+
def _(mo):
|
|
60
|
+
mo.md(r"""## StorageItem""")
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@app.cell
|
|
65
|
+
def _(StorageItem):
|
|
66
|
+
local_state = StorageItem(key="my_state")
|
|
67
|
+
return (local_state,)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.cell
|
|
71
|
+
def _(local_state):
|
|
72
|
+
local_state.data = 100
|
|
73
|
+
return
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@app.cell
|
|
77
|
+
def _(local_state):
|
|
78
|
+
local_state.data
|
|
79
|
+
return
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@app.cell
|
|
83
|
+
def _(mo):
|
|
84
|
+
mo.md(r"""## Cookies""")
|
|
85
|
+
return
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@app.cell
|
|
89
|
+
def _(CookieManager):
|
|
90
|
+
cookies = CookieManager()
|
|
91
|
+
return (cookies,)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@app.cell
|
|
95
|
+
def _(cookies):
|
|
96
|
+
cookies.cookies
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@app.cell
|
|
101
|
+
def _(mo):
|
|
102
|
+
mo.md(r"""## DOM Query""")
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@app.cell
|
|
107
|
+
def _(DOMQuery):
|
|
108
|
+
query = DOMQuery(selector="#root")
|
|
109
|
+
return (query,)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@app.cell
|
|
113
|
+
def _(query):
|
|
114
|
+
query.result
|
|
115
|
+
return
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@app.cell
|
|
119
|
+
def _(mo):
|
|
120
|
+
mo.md(r"""## Slot""")
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@app.cell
|
|
125
|
+
def _(Slot):
|
|
126
|
+
slot = Slot(
|
|
127
|
+
children="<div>hello</div>",
|
|
128
|
+
on_mouseover=lambda: print("mouse over"),
|
|
129
|
+
on_mouseout=lambda: print("mouse out"),
|
|
130
|
+
)
|
|
131
|
+
return (slot,)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
@app.cell
|
|
135
|
+
def _(slot):
|
|
136
|
+
slot.value
|
|
137
|
+
return
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
if __name__ == "__main__":
|
|
141
|
+
app.run()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
build-backend = "hatchling.build"
|
|
3
|
+
requires = ["hatchling"]
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
dependencies = ["anywidget"]
|
|
7
|
+
name = "moutils"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
version = "0.1.0"
|
|
10
|
+
|
|
11
|
+
# For projects not using `uv`, you can install these development dependencies with:
|
|
12
|
+
# `pip install -e ".[dev]"`
|
|
13
|
+
# If you're using `uv` for development, feel free to remove this section.
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
dev = ["marimo"]
|
|
16
|
+
|
|
17
|
+
# Dependency groups (recognized by `uv`). For more details, visit:
|
|
18
|
+
# https://peps.python.org/pep-0735/
|
|
19
|
+
[dependency-groups]
|
|
20
|
+
dev = ["marimo"]
|
|
21
|
+
|
|
22
|
+
[tool.marimo.runtime]
|
|
23
|
+
pythonpath = ["src"]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This document outlines the process for creating a new release of moutils.
|
|
4
|
+
|
|
5
|
+
## Creating a Release
|
|
6
|
+
|
|
7
|
+
1. Update version in `pyproject.toml`
|
|
8
|
+
2. Commit changes:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
git add pyproject.toml
|
|
12
|
+
git commit -m "Bump version to x.y.z"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
3. Tag the release:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
git tag -a x.y.z -m "Release version x.y.z"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
4. Push changes:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
git push origin main && git push origin x.y.z
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
5. GitHub Actions will automatically build and publish the package to PyPI when the tag is pushed.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
|
|
31
|
+
## Version Numbering
|
|
32
|
+
|
|
33
|
+
We follow [Semantic Versioning](https://semver.org/):
|
|
34
|
+
|
|
35
|
+
- **MAJOR** version for incompatible API changes
|
|
36
|
+
- **MINOR** version for backwards-compatible functionality additions
|
|
37
|
+
- **PATCH** version for backwards-compatible bug fixes
|