revisit 0.0.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ node_modules
2
+ .venv
3
+ dist
4
+ .DS_Store
5
+
6
+ # Python
7
+ __pycache__
8
+ .ipynb_checkpoints
9
+
10
+ src/revisit/static
revisit-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,60 @@
1
+ Metadata-Version: 2.4
2
+ Name: revisit
3
+ Version: 0.0.2
4
+ Requires-Dist: anywidget
5
+ Requires-Dist: ipykernel>=6.29.5
6
+ Requires-Dist: pydantic>=2.10.5
7
+ Provides-Extra: dev
8
+ Requires-Dist: jupyterlab; extra == 'dev'
9
+ Requires-Dist: watchfiles; extra == 'dev'
10
+ Description-Content-Type: text/markdown
11
+
12
+ # revisit
13
+
14
+ ## Installation
15
+
16
+ ```sh
17
+ pip install revisit
18
+ ```
19
+
20
+ or with [uv](https://github.com/astral-sh/uv):
21
+
22
+ ```sh
23
+ uv add revisit
24
+ ```
25
+
26
+ ## Development
27
+
28
+ We recommend using [uv](https://github.com/astral-sh/uv) for development.
29
+ It will automatically manage virtual environments and dependencies for you.
30
+
31
+ ```sh
32
+ uv run jupyter lab example.ipynb
33
+ ```
34
+
35
+ Alternatively, create and manage your own virtual environment:
36
+
37
+ ```sh
38
+ python -m venv .venv
39
+ source .venv/bin/activate
40
+ pip install -e ".[dev]"
41
+ jupyter lab example.ipynb
42
+ ```
43
+
44
+ The widget front-end code bundles it's JavaScript dependencies. After setting up Python,
45
+ make sure to install these dependencies locally:
46
+
47
+ ```sh
48
+ yarn install
49
+ ```
50
+
51
+ While developing, you can run the following in a separate terminal to automatically
52
+ rebuild JavaScript as you make changes:
53
+
54
+ ```sh
55
+ yarn run dev
56
+ ```
57
+
58
+ Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
59
+ to start developing. Changes made in `js/` will be reflected
60
+ in the notebook.
@@ -0,0 +1,49 @@
1
+ # revisit
2
+
3
+ ## Installation
4
+
5
+ ```sh
6
+ pip install revisit
7
+ ```
8
+
9
+ or with [uv](https://github.com/astral-sh/uv):
10
+
11
+ ```sh
12
+ uv add revisit
13
+ ```
14
+
15
+ ## Development
16
+
17
+ We recommend using [uv](https://github.com/astral-sh/uv) for development.
18
+ It will automatically manage virtual environments and dependencies for you.
19
+
20
+ ```sh
21
+ uv run jupyter lab example.ipynb
22
+ ```
23
+
24
+ Alternatively, create and manage your own virtual environment:
25
+
26
+ ```sh
27
+ python -m venv .venv
28
+ source .venv/bin/activate
29
+ pip install -e ".[dev]"
30
+ jupyter lab example.ipynb
31
+ ```
32
+
33
+ The widget front-end code bundles it's JavaScript dependencies. After setting up Python,
34
+ make sure to install these dependencies locally:
35
+
36
+ ```sh
37
+ yarn install
38
+ ```
39
+
40
+ While developing, you can run the following in a separate terminal to automatically
41
+ rebuild JavaScript as you make changes:
42
+
43
+ ```sh
44
+ yarn run dev
45
+ ```
46
+
47
+ Open `example.ipynb` in JupyterLab, VS Code, or your favorite editor
48
+ to start developing. Changes made in `js/` will be reflected
49
+ in the notebook.
@@ -0,0 +1,39 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "revisit"
7
+ version = "0.0.2"
8
+ dependencies = [
9
+ "anywidget",
10
+ "ipykernel>=6.29.5",
11
+ "pydantic>=2.10.5",
12
+ ]
13
+ readme = "README.md"
14
+
15
+ # For projects not using `uv`, you can install these development dependencies with:
16
+ # `pip install -e ".[dev]"`
17
+ # If you're using `uv` for development, feel free to remove this section.
18
+ [project.optional-dependencies]
19
+ dev = ["watchfiles", "jupyterlab"]
20
+
21
+ # Dependency groups (recognized by `uv`). For more details, visit:
22
+ # https://peps.python.org/pep-0735/
23
+ [dependency-groups]
24
+ dev = ["watchfiles", "jupyterlab"]
25
+
26
+
27
+ [tool.hatch.build]
28
+ only-packages = true
29
+ artifacts = ["src/revisit/static/*"]
30
+
31
+ [tool.hatch.build.hooks.jupyter-builder]
32
+ build-function = "hatch_jupyter_builder.npm_builder"
33
+ ensured-targets = ["src/revisit/static/widget.js"]
34
+ skip-if-exists = ["src/revisit/static/widget.js"]
35
+ dependencies = ["hatch-jupyter-builder>=0.5.0"]
36
+
37
+ [tool.hatch.build.hooks.jupyter-builder.build-kwargs]
38
+ npm = "yarn"
39
+ build_cmd = "build"
@@ -0,0 +1,54 @@
1
+ import importlib.metadata
2
+ import pathlib
3
+ import anywidget
4
+ import traitlets
5
+
6
+ try:
7
+ __version__ = importlib.metadata.version("revisit_notebook_widget")
8
+ except importlib.metadata.PackageNotFoundError:
9
+ __version__ = "unknown"
10
+
11
+
12
+
13
+ # class Widget2(anywidget.AnyWidget):
14
+
15
+ class TestWidget(anywidget.AnyWidget):
16
+ _esm = """
17
+ function render({ model, el }) {
18
+ let button = document.createElement("button");
19
+ button.innerHTML = `count is ${model.get("value")}`;
20
+ button.addEventListener("click", () => {
21
+ model.set("value", model.get("value") + 1);
22
+ model.save_changes();
23
+ });
24
+ model.on("change:value", () => {
25
+ button.innerHTML = `count is ${model.get("value")}`;
26
+ });
27
+ el.classList.add("counter-widget");
28
+ el.appendChild(button);
29
+ }
30
+ export default { render };
31
+ """
32
+ _css = """
33
+ .counter-widget button { color: white; font-size: 1.75rem; background-color: #ea580c; padding: 0.5rem 1rem; border: none; border-radius: 0.25rem; }
34
+ .counter-widget button:hover { background-color: #9a3412; }
35
+ """
36
+ value = traitlets.Int(0).tag(sync=True)
37
+
38
+
39
+
40
+ class Widget(anywidget.AnyWidget):
41
+ _esm = pathlib.Path(__file__).parent / "static" / "widget.js"
42
+ _css = pathlib.Path(__file__).parent / "static" / "widget.css"
43
+ # value = traitlets.Int(0).tag(sync=True)
44
+ config = traitlets.Dict({}).tag(sync=True)
45
+ sequence = traitlets.List([]).tag(sync=True)
46
+ internalWidget = TestWidget()
47
+
48
+ @traitlets.observe('sequence')
49
+ def _sequence_changed(self, change):
50
+ self.internalWidget.value += 1
51
+ # internalWidget.value += 1
52
+ # print("{name} changed from {old} to {new}".format(**change))
53
+
54
+