You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**_NOTE: Rework this section to describe your Marimo notebook(s)._**
4
-
5
-
This repository is a template for a single, or multiple, Marimo notebooks that will be served and accessed via [marimo-launcher](https://github.com/MITLibraries/marimo-launcher).
6
-
7
-
By default, [marimo-launcher](https://github.com/MITLibraries/marimo-launcher) expects a single file called `notebook.py` at the root of the repository it clones and launches. However, `marimo-launcher` also supports a `--path` CLI arg or `NOTEBOOK_PATH` env var that allows overriding this default behavior, allowing a Marimo notebook repository like this to have multiple notebooks and/or a unique structure. This template exemplifies a default structure of a single [notebook.py](notebook.py) file at the root of the repository.
1
+
# cdps-dashboard
8
2
9
3
## Developing
10
-
11
4
The recommended approach for developing a Marimo notebook is to use the Marimo GUI editor:
12
5
13
6
```shell
14
7
make edit-notebook
15
8
```
16
9
17
-
### Dependencies
18
-
19
-
There are many ways in which [dependencies can be managed](https://docs.marimo.io/guides/package_management/) for a Marimo notebook. For details on [marimo-launcher](https://github.com/MITLibraries/marimo-launcher) handles and expects dependencies, please [click here](https://github.com/MITLibraries/marimo-launcher?tab=readme-ov-file#notebook-dependencies).
20
-
21
10
### Testing
22
-
23
-
Testing is performed on the command line against inlined tests in notebook(s) ([read more here in the Marimo docs](https://docs.marimo.io/guides/testing/pytest/#testing-at-the-command-line)) and any tests discovered in `/tests`.
24
-
25
-
There are two primary ways to add tests:
26
-
27
-
1. Create a cell in a notebook and either manually in the `.py` file, or via the cell action menu, **name** the cell to start with a `test_` prefix.
28
-
2. Add tests to the standalone `/tests` folder. This can be helpful for testing code that may live outside of the notebook itself.
29
-
30
11
To run tests:
31
12
32
13
```shell
33
14
make test
34
15
```
35
16
36
-
Note the use of `*.py` in the Makefile command `test`. Per this greedy test discovery approach, _any_ function that starts with `test_` will be included in the test suite. To avoid this behavior `*.py` can be replaced with more granular, specific filepaths.
37
-
38
17
### Linting
39
-
40
-
`mypy` type and `ruff` general linting are similar to other python projects, but note the relaxed rules in `pyproject.toml` for Marimo notebook files. If multiple notebooks are present, they will need to be added here.
18
+
To run linting:
41
19
42
20
```shell
43
21
make lint
44
22
```
45
23
46
24
## Running
47
-
48
25
Often, notebooks are [served as an "app"](https://docs.marimo.io/guides/apps/). This is the default mode for [marimo-launcher](https://github.com/MITLibraries/marimo-launcher).
49
26
50
27
```shell
@@ -54,13 +31,11 @@ uv run marimo run --sandbox --headless --no-token notebook.py
Copy file name to clipboardExpand all lines: notebook.py
+26-52Lines changed: 26 additions & 52 deletions
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,12 @@
2
2
# requires-python = ">=3.13"
3
3
# dependencies = [
4
4
# "marimo",
5
-
# "tinydb==4.8.2",
6
5
# ]
7
6
# ///
8
7
9
8
importmarimo
10
9
11
-
__generated_with="0.14.17"
10
+
__generated_with="0.16.5"
12
11
app=marimo.App(width="medium")
13
12
14
13
@@ -21,65 +20,40 @@ def _():
21
20
22
21
@app.cell
23
22
def_(mo):
24
-
mo.md(
25
-
"""
26
-
# Hello Marimo Notebook Template World! 👋📓🌍
27
-
28
-
Welcome to the `marimo-notebook-template` repository. You can find more in the template repository [README](https://github.com/MITLibraries/marimo-notebook-template/blob/main/README.md).
29
-
"""
30
-
)
31
-
return
32
-
33
-
34
-
@app.cell
35
-
def_(mo):
36
-
importsys
37
-
38
-
mo.md(f"""Python version: `{sys.version}`""")
39
-
return
40
-
41
-
42
-
@app.cell
43
-
def_(mo):
44
-
mo.md(
45
-
"""This notebook exemplifies using [inline dependencies](https://docs.marimo.io/guides/package_management/inlining_dependencies/). The external package `tinydb` is installed as a dependency via inline dependencies at the top of this `notebook.py` file, then imported and used in the following cell..."""
46
-
)
47
-
return
48
-
49
-
50
-
@app.cell
51
-
def_(mo):
52
-
importtempfile
53
-
54
-
fromtinydbimportTinyDB
55
-
56
-
withtempfile.TemporaryDirectory() astmpdir:
57
-
db=TinyDB(f"{tmpdir}/db.json")
58
-
db.insert({"name": "test"})
59
-
results=db.all()
60
-
61
-
mo.md(
62
-
f"""
63
-
TinyDB loaded: `OK`<br>
64
-
Results: `{results}`
65
-
"""
66
-
)
23
+
mo.md("""# CDPS Dashboard""")
67
24
return
68
25
69
26
70
27
@app.cell
71
28
def_(mo):
72
-
mo.md(
73
-
"""
74
-
The following cell demonstrates a test embedded into the notebook itself. As noted in the template README, tests may also be added to the `/tests` folder.
0 commit comments