Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⏪ Make notebook colab startable again #6

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
from importlib import metadata


# -- Project information -----------------------------------------------------

project = "mockup"
Expand Down Expand Up @@ -57,7 +56,10 @@
nb_merge_streams = True

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

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/.jupytext
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# all notebooks in this directory are in the percent format
formats = "ipynb,py:percent"
78 changes: 78 additions & 0 deletions docs/tutorial/tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "62cb84c2",
"metadata": {},
"source": [
"# Mockup tutorial"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "825cc996",
"metadata": {},
"outputs": [],
"source": [
"from mockup import mockup"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3ac73ba",
"metadata": {},
"outputs": [],
"source": [
"mockup.add_one(-11)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3a3d02a",
"metadata": {},
"outputs": [],
"source": [
"list(mockup.flatten_ints([[9, 11], [12], [4, 5]]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9cf7157d",
"metadata": {},
"outputs": [],
"source": [
"c2 = mockup.Circle.from_circumference(100)\n",
"round(c2.radius, 3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4ae5341c",
"metadata": {},
"outputs": [],
"source": [
"c2 # repr"
]
},
{
"cell_type": "markdown",
"id": "1bc4ca39",
"metadata": {},
"source": []
}
],
"metadata": {
"jupytext": {
"cell_metadata_filter": "-all",
"main_language": "python",
"notebook_metadata_filter": "-all"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# ref: https://setuptools.pypa.io/en/stable/userguide/pyproject_config.html
[project]
authors = [
{ name = "Jakob Nybo Nissen", email = "[email protected]" },
Expand All @@ -17,8 +18,13 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
# # add dependencies here:
# # add dependencies here: (use one of the two)
# dependencies = ["numpy", "pandas", "scipy", "matplotlib", "seaborn"]
# use requirements.txt instead of pyproject.toml for dependencies
# https://stackoverflow.com/a/73600610/9684872
# [tool.setuptools.dynamic]
# dependencies = {file = ["requirements.txt"]}


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