Skip to content

Commit 8ac3af4

Browse files
authored
⏪ Make notebook colab startable again (#6)
* 🐛 start tutorial on colab via launch button in docs revert changes from previous commit * 📝 reference and second requirements option
1 parent b24e810 commit 8ac3af4

File tree

4 files changed

+91
-3
lines changed

4 files changed

+91
-3
lines changed

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import os
1414
from importlib import metadata
1515

16-
1716
# -- Project information -----------------------------------------------------
1817

1918
project = "mockup"
@@ -57,7 +56,10 @@
5756
nb_merge_streams = True
5857

5958
# https://myst-nb.readthedocs.io/en/latest/authoring/custom-formats.html#write-custom-formats
60-
nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}
59+
# ! if you use it, then you cannot directly execute the notebook in the browser in colab
60+
# (the file needs to be fetched from the repository)
61+
# just keep both syncing it using papermill
62+
# nb_custom_formats = {".py": ["jupytext.reads", {"fmt": "py:percent"}]}
6163

6264
# Add any paths that contain templates here, relative to this directory.
6365
templates_path = ["_templates"]

docs/tutorial/.jupytext

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# all notebooks in this directory are in the percent format
2+
formats = "ipynb,py:percent"

docs/tutorial/tutorial.ipynb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "62cb84c2",
6+
"metadata": {},
7+
"source": [
8+
"# Mockup tutorial"
9+
]
10+
},
11+
{
12+
"cell_type": "code",
13+
"execution_count": null,
14+
"id": "825cc996",
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"from mockup import mockup"
19+
]
20+
},
21+
{
22+
"cell_type": "code",
23+
"execution_count": null,
24+
"id": "d3ac73ba",
25+
"metadata": {},
26+
"outputs": [],
27+
"source": [
28+
"mockup.add_one(-11)"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"id": "f3a3d02a",
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": null,
44+
"id": "9cf7157d",
45+
"metadata": {},
46+
"outputs": [],
47+
"source": [
48+
"c2 = mockup.Circle.from_circumference(100)\n",
49+
"round(c2.radius, 3)"
50+
]
51+
},
52+
{
53+
"cell_type": "code",
54+
"execution_count": null,
55+
"id": "4ae5341c",
56+
"metadata": {},
57+
"outputs": [],
58+
"source": [
59+
"c2 # repr"
60+
]
61+
},
62+
{
63+
"cell_type": "markdown",
64+
"id": "1bc4ca39",
65+
"metadata": {},
66+
"source": []
67+
}
68+
],
69+
"metadata": {
70+
"jupytext": {
71+
"cell_metadata_filter": "-all",
72+
"main_language": "python",
73+
"notebook_metadata_filter": "-all"
74+
}
75+
},
76+
"nbformat": 4,
77+
"nbformat_minor": 5
78+
}

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ref: https://setuptools.pypa.io/en/stable/userguide/pyproject_config.html
12
[project]
23
authors = [
34
{ name = "Jakob Nybo Nissen", email = "[email protected]" },
@@ -17,8 +18,13 @@ classifiers = [
1718
"License :: OSI Approved :: MIT License",
1819
"Operating System :: OS Independent",
1920
]
20-
# # add dependencies here:
21+
# # add dependencies here: (use one of the two)
2122
# dependencies = ["numpy", "pandas", "scipy", "matplotlib", "seaborn"]
23+
# use requirements.txt instead of pyproject.toml for dependencies
24+
# https://stackoverflow.com/a/73600610/9684872
25+
# [tool.setuptools.dynamic]
26+
# dependencies = {file = ["requirements.txt"]}
27+
2228

2329
[project.urls]
2430
"Bug Tracker" = "https://github.com/RasmussenLab/python_package/issues"

0 commit comments

Comments
 (0)