Skip to content

Commit c830510

Browse files
committed
Final QA
1 parent 7b78d48 commit c830510

16 files changed

+124
-121
lines changed

marimo-notebook/README.md

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
The materials contained in this download are designed to complement the Real Python tutorial [Marimo: A Reactive, Reproducible Notebook](https://realpython.com/marimo-notebook-reactive-reproducible/).
1+
# Marimo: A Reactive, Reproducible Notebook
22

3-
You should create a new folder named marimo on your computer and place each of these files inside it. You might also consider creating a [Python virtual environment](https://realpython.com/python-virtual-environments-a-primer/) within this folder.
3+
The materials contained in this download are designed to complement the Real Python tutorial [Marimo: A Reactive, Reproducible Notebook](https://realpython.com/marimo-notebook/).
44

5-
Your download bundle contains the following files:
5+
## Installation
66

7-
hypotenuse_calculator.py - This file contains the original hypotenuse_calculator code
8-
hypotenuse_calculator_before_update.py - This file contains the code before any updating is attempted. The code has been deliberately placed out of order, however it runs cleanly.
9-
hypotenuse_calculator_duplicate_variable.py - This file shows the effect of re-defining a variable. This file produces an error.
10-
hypotenuse_calculator_after_update.py - This file contains the code after the `adjacent` variable was updated to `10`. This file runs cleanly.
11-
hypotenuse_calculator_after_deletion.py - This file contains the code after the `opposite variable` was deleted. This file produces an error.
7+
Create a [Python virtual environment](https://realpython.com/python-virtual-environments-a-primer/), activate it, and install marimo along with its dependencies into it:
128

13-
break_even_analysis_chart_code.py - This file contains the basic chart code. It will produce a break-even analysis for a fixed set of input data.
14-
break_even_analysis_UI_elements.py - This file contains includes the four UI interface elements to allow the plot to be adjusted.
15-
break_even_analysis_solution.py - This file contains a possible solution to the skills test.
9+
```sh
10+
$ python -m venv venv/
11+
$ source venv/bin/activate
12+
(venv) $ python -m pip install -r requirements.txt
13+
```
1614

17-
packages.py - This file contains the code used to demonstrate sandboxing.
18-
quadratic.py - This file contains the marimo notebook version of the quadratic formula example.
19-
equation.py - This file contains the Python script version of quadratic.py.
15+
## Contents
2016

21-
simultaneous_equations.py - This file contains the code used to demonstrate marimo's UI elements.
22-
simultaneous_equations_ui.py - This file contains a possible solution to the challenge skills test.
17+
Your download bundle contains the following files:
2318

24-
hidden_state.ipynb - This file contains a Jupyter Notebook that can be used as a starting point for the investigation of its problems. You should adjust it as instructed in the tutorial.
19+
| Filename | Description |
20+
|--------------------------------------------|-------------------------------------------------------------------------------------------------|
21+
| `hypotenuse_calculator.py` | The original `hypotenuse_calculator` code. |
22+
| `hypotenuse_calculator_before_update.py` | The code before any updating is attempted. The code is out of order but runs cleanly. |
23+
| `hypotenuse_calculator_duplicate_variable.py` | Shows the effect of redefining a variable. This file produces an error. |
24+
| `hypotenuse_calculator_after_update.py` | The code after the `adjacent` variable was updated to `10`. Runs cleanly. |
25+
| `hypotenuse_calculator_after_deletion.py` | The code after the `opposite` variable was deleted. This file produces an error. |
26+
| `break_even_analysis_chart_code.py` | The basic chart code for a break-even analysis with fixed input data. |
27+
| `break_even_analysis_ui_elements.py` | Includes four UI interface elements to allow the plot to be adjusted. |
28+
| `break_even_analysis_solution.py` | A possible solution to the skills test. |
29+
| `packages.py` | The code used to demonstrate sandboxing. |
30+
| `quadratic.py` | The marimo notebook version of the quadratic formula example. |
31+
| `equation.py` | The Python script version of `quadratic.py`. |
32+
| `simultaneous_equations.py` | The code used to demonstrate marimo's UI elements. |
33+
| `simultaneous_equations_ui.py` | A possible solution to the challenge skills test. |
34+
| `hidden_state.ipynb` | This Jupyter Notebook is a starting point for investigating its problems, to be adjusted per tutorial. |

marimo-notebook/break_even_analysis_chart_code.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
import marimo
44

5-
__generated_with = "0.11.0"
5+
__generated_with = "0.13.6"
66
app = marimo.App(width="medium")
77

88

99
@app.cell
1010
def _():
11-
import matplotlib.pyplot as plt
1211
import marimo as mo
12+
import matplotlib.pyplot as plt
1313

14-
return mo, plt
14+
return (plt,)
1515

1616

1717
@app.cell
@@ -24,13 +24,7 @@ def _():
2424

2525

2626
@app.cell
27-
def _(
28-
fixed_cost,
29-
plt,
30-
selling_price,
31-
unit_cost,
32-
upper_production_quantity,
33-
):
27+
def _(fixed_cost, plt, selling_price, unit_cost, upper_production_quantity):
3428
break_even_quantity = fixed_cost / (selling_price - unit_cost)
3529
break_even_income = fixed_cost + break_even_quantity * unit_cost
3630

@@ -52,20 +46,16 @@ def _(
5246
ymax=break_even_income,
5347
linestyles="dashed",
5448
)
49+
5550
plt.text(
5651
x=break_even_quantity + 100,
5752
y=int(break_even_income / 2),
5853
s=int(break_even_quantity),
5954
)
55+
6056
plt.grid()
6157
plt.show()
62-
return (
63-
break_even_income,
64-
break_even_quantity,
65-
sales_income,
66-
unit_costs,
67-
units,
68-
)
58+
return
6959

7060

7161
if __name__ == "__main__":

marimo-notebook/break_even_analysis_solution.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import marimo
44

5-
__generated_with = "0.11.0"
5+
__generated_with = "0.13.6"
66
app = marimo.App(width="medium")
77

88

99
@app.cell
1010
def _():
11-
import matplotlib.pyplot as plt
1211
import marimo as mo
12+
import matplotlib.pyplot as plt
1313

1414
return mo, plt
1515

@@ -64,29 +64,18 @@ def _(
6464

6565
plt.grid()
6666
plt.show()
67-
return (
68-
break_even_income,
69-
break_even_quantity,
70-
sales_income,
71-
total_costs,
72-
units,
73-
)
67+
return
7468

7569

7670
@app.cell
7771
def _(mo):
7872
ui_fixed_cost = mo.ui.radio(options=["40000", "50000"], value="50000")
79-
8073
ui_unit_cost = mo.ui.slider(start=2, stop=5, step=1)
81-
8274
ui_selling_price = mo.ui.text(value="10")
83-
8475
ui_quantity = mo.ui.dropdown(
8576
options={"10000": 10000, "12000": 12000, "15000": 15000}, value="10000"
8677
)
87-
8878
ui_break_even = mo.ui.switch()
89-
9079
ui_plot_color = mo.ui.dropdown(
9180
options={"Red": "red", "Green": "green", "Blue": "blue"}, value="Red"
9281
)

marimo-notebook/break_even_analysis_UI_elements.py renamed to marimo-notebook/break_even_analysis_ui_elements.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import marimo
44

5-
__generated_with = "0.11.0"
5+
__generated_with = "0.13.6"
66
app = marimo.App(width="medium")
77

88

99
@app.cell
1010
def _():
11-
import matplotlib.pyplot as plt
1211
import marimo as mo
12+
import matplotlib.pyplot as plt
1313

1414
return mo, plt
1515

@@ -53,37 +53,28 @@ def _(
5353
ymax=break_even_income,
5454
linestyles="dashed",
5555
)
56+
5657
plt.text(
5758
x=break_even_quantity + 100,
5859
y=int(break_even_income / 2),
5960
s=int(break_even_quantity),
6061
)
62+
6163
plt.grid()
6264
plt.show()
63-
return (
64-
break_even_income,
65-
break_even_quantity,
66-
sales_income,
67-
unit_costs,
68-
units,
69-
)
65+
return
7066

7167

7268
@app.cell
7369
def _(mo):
7470
ui_fixed_cost = mo.ui.radio(options=["40000", "50000"], value="50000")
75-
7671
ui_unit_cost = mo.ui.slider(start=2, stop=5, step=1)
77-
7872
ui_selling_price = mo.ui.text(value="10")
79-
8073
ui_quantity = mo.ui.dropdown(
8174
options={"10000": 10000, "12000": 12000, "15000": 15000},
8275
value="10000",
8376
)
84-
8577
ui_disply_break_even = mo.ui.switch()
86-
8778
ui_color_costs = mo.ui.dropdown(
8879
options={"Red": "red", "Green": "green", "Blue": "blue"}, value="Red"
8980
)
@@ -96,12 +87,15 @@ def _(mo):
9687
9788
Selling Price: {ui_selling_price}
9889
99-
Maximum Production Quantity: {ui_quantity}
90+
Maximum Quantity: {ui_quantity}
91+
92+
Display Break-Even Data: {ui_disply_break_even}
93+
94+
Total Costs Plot Color: {ui_color_costs}
10095
"""
10196
)
10297
return (
10398
ui_color_costs,
104-
ui_disply_break_even,
10599
ui_fixed_cost,
106100
ui_quantity,
107101
ui_selling_price,

marimo-notebook/equation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# flake8: noqa
22

3-
__generated_with = "0.11.0"
3+
__generated_with = "0.13.6"
44

55
# %%
66
import marimo as mo
77

88
# %%
99
mo.md(
1010
r"""
11-
A quadratic equation is one of the form **$ax^2 + bx + c = 0$**, where a, b and c are constants, and a $\neq$ 0.
11+
A quadratic equation is one of the form **$ax^2 + bx + c = 0$**, where a, b and c are constants, and a $\neq$ 0.
1212
13-
You can solve it using the *quadratic formula*:
13+
You can solve it using the *quadratic formula*:
1414
15-
$$x = \frac {-b \pm \sqrt{b^2 -4ac}} {2a}$$
15+
$$x = \frac {-b \pm \sqrt{b^2 -4ac}} {2a}$$
1616
17-
For example, suppose you wanted to solve: **$2x^2 - 3x - 2 = 0$**
18-
"""
17+
For example, suppose you wanted to solve: **$2x^2 - 3x - 2 = 0$**
18+
"""
1919
)
2020

2121
# %%

marimo-notebook/hidden_state.ipynb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -123,22 +123,6 @@
123123
"source": [
124124
"calculate_hypotenuse(opposite, adjacent)"
125125
]
126-
},
127-
{
128-
"cell_type": "code",
129-
"execution_count": null,
130-
"id": "0319e99d-82a1-4c13-9a71-4a9d868dcfe2",
131-
"metadata": {},
132-
"outputs": [],
133-
"source": []
134-
},
135-
{
136-
"cell_type": "code",
137-
"execution_count": null,
138-
"id": "75cbba4e-deeb-42dc-b3da-c69f4e71eb1a",
139-
"metadata": {},
140-
"outputs": [],
141-
"source": []
142126
}
143127
],
144128
"metadata": {
@@ -157,7 +141,7 @@
157141
"name": "python",
158142
"nbconvert_exporter": "python",
159143
"pygments_lexer": "ipython3",
160-
"version": "3.13.1"
144+
"version": "3.13.3"
161145
}
162146
},
163147
"nbformat": 4,

marimo-notebook/hypotenuse_calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import marimo
22

3-
__generated_with = "0.11.0"
3+
__generated_with = "0.13.6"
44
app = marimo.App(width="medium")
55

66

marimo-notebook/hypotenuse_calculator_after_deletion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import marimo
22

3-
__generated_with = "0.11.0"
3+
__generated_with = "0.13.6"
44
app = marimo.App(width="medium")
55

66

marimo-notebook/hypotenuse_calculator_after_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import marimo
22

3-
__generated_with = "0.11.0"
3+
__generated_with = "0.13.6"
44
app = marimo.App(width="medium")
55

66

marimo-notebook/hypotenuse_calculator_before_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import marimo
22

3-
__generated_with = "0.11.0"
3+
__generated_with = "0.13.6"
44
app = marimo.App(width="medium")
55

66

0 commit comments

Comments
 (0)