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

DX: improve notebook rendering on Google Colab #263

Merged
merged 5 commits into from
Mar 23, 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
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ repos:
- --repo-title=ComPWA Organization
- id: colab-toc-visible
- id: fix-nbformat-version
- id: set-nb-cells

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.2
Expand Down
25 changes: 0 additions & 25 deletions docs/adr/001/operators.ipynb
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"%%capture\n",
"\n",
"%config Completer.use_jedi = False\n",
"%config InlineBackend.figure_formats = ['svg']\n",
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
24 changes: 0 additions & 24 deletions docs/report/000.ipynb
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hideCode": true,
"hideOutput": true,
"hidePrompt": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
24 changes: 0 additions & 24 deletions docs/report/001.ipynb
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hideCode": true,
"hideOutput": true,
"hidePrompt": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
24 changes: 0 additions & 24 deletions docs/report/002.ipynb
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hideCode": true,
"hideOutput": true,
"hidePrompt": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
67 changes: 41 additions & 26 deletions docs/report/003.ipynb
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hideCode": true,
"hideOutput": true,
"hidePrompt": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -111,8 +87,8 @@
"source": [
"%config InlineBackend.figure_formats = ['svg']\n",
"\n",
"%matplotlib widget\n",
"import inspect\n",
"import os\n",
"import warnings\n",
"from functools import partial\n",
"from typing import Any\n",
Expand All @@ -139,7 +115,33 @@
"from tqdm.auto import tqdm\n",
"\n",
"warnings.filterwarnings(\"ignore\")\n",
"PDG = qrules.load_pdg()"
"PDG = qrules.load_pdg()\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"editable": true,
"jupyter": {
"source_hidden": true
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# @title\n",
"if \"COLAB_RELEASE_TAG\" in os.environ:\n",
" import subprocess\n",
"\n",
" from google.colab import output\n",
"\n",
" output.enable_custom_widget_manager()\n",
" subprocess.run(\"pip install -q ipympl\".split(), check=False)"
]
},
{
Expand Down Expand Up @@ -413,6 +415,19 @@
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
75 changes: 38 additions & 37 deletions docs/report/004.ipynb
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hideCode": true,
"hideOutput": true,
"hidePrompt": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": "skip"
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"import os\n",
"\n",
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -81,19 +57,6 @@
"%pip install -q ampform==0.14.10 sympy==1.12"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -126,6 +89,31 @@
"STATIC_WEB_PAGE = {\"EXECUTE_NB\", \"READTHEDOCS\"}.intersection(os.environ)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"editable": true,
"jupyter": {
"source_hidden": true
},
"tags": [
"remove-cell"
]
},
"outputs": [],
"source": [
"# @title\n",
"if \"COLAB_RELEASE_TAG\" in os.environ:\n",
" import subprocess\n",
"\n",
" from google.colab import output\n",
"\n",
" output.enable_custom_widget_manager()\n",
" subprocess.run(\"pip install -q ipympl\".split(), check=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -281,6 +269,19 @@
" display(Image(output_file))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"remove-input"
]
},
"outputs": [],
"source": [
"%matplotlib widget"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading
Loading