Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 51d3dda
Author: Felix Zimmermann <[email protected]>
Date:   Sun Jan 12 15:25:48 2025 +0100

    pip install mrpro with notebook option

commit feabab3
Author: Felix Zimmermann <[email protected]>
Date:   Sun Jan 12 15:24:02 2025 +0100

    execute notebooks locally

commit 8a537d4
Author: Felix Zimmermann <[email protected]>
Date:   Sun Jan 12 15:21:48 2025 +0100

    silence jupytext

commit 36785c4
Author: lrlunin <[email protected]>
Date:   Fri Jan 10 13:57:38 2025 +0100

    move cartesion_reconstruction in correct folders

commit d3b0d1b
Author: lrlunin <[email protected]>
Date:   Fri Jan 10 13:54:34 2025 +0100

    run mypy hook as last

commit b66b9b7
Author: Lunin Leonid <[email protected]>
Date:   Thu Jan 9 22:22:38 2025 +0100

    fix notebook_path variable in matrix

commit 8e2cb8e
Merge: f450529 a1873a0
Author: Lunin Leonid <[email protected]>
Date:   Thu Jan 9 22:20:50 2025 +0100

    Merge branch 'main' into notebooks-in-pre-commit

commit f450529
Author: Felix F Zimmermann <[email protected]>
Date:   Thu Jan 9 22:15:20 2025 +0100

    changes to leonids pr (#602)

commit a1873a0
Author: Lunin Leonid <[email protected]>
Date:   Wed Jan 8 09:54:12 2025 +0100

    Add dark and light logo to README (#600)

commit f040c00
Author: Felix F Zimmermann <[email protected]>
Date:   Wed Jan 8 00:07:27 2025 +0100

    Release v0.250107 (#599)

commit 13c4e7e
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 16:24:36 2024 +0100

    fix notebooks_path output

commit 93ef986
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 16:21:23 2024 +0100

    fix matrix element name

commit 7eccf87
Merge: 2d3c3ff 9dc1167
Author: Lunin Leonid <[email protected]>
Date:   Wed Dec 18 16:14:30 2024 +0100

    Merge branch 'main' into notebooks-in-pre-commit

commit 2d3c3ff
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 15:46:10 2024 +0100

    remove space after markdown for colab badge

commit 9a5556d
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 15:45:25 2024 +0100

    add space after markdown for colab badge

commit fba5a6f
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 15:05:55 2024 +0100

    add colab badge for each notebook

commit 159afed
Author: lrlunin <[email protected]>
Date:   Wed Dec 18 14:17:45 2024 +0100

    update jupytext version

commit 34d43f0
Author: lrlunin <[email protected]>
Date:   Tue Dec 10 13:58:43 2024 +0100

    use find for notebook listing in docs

commit f76b236
Author: lrlunin <[email protected]>
Date:   Tue Dec 10 13:23:29 2024 +0100

    one-way conversion from .py to .ipynb, remove preamble from .py representation

commit 865347a
Author: lrlunin <[email protected]>
Date:   Wed Nov 20 22:45:42 2024 +0100

    fixed path for notebooks in examples

commit 1688c70
Author: lrlunin <[email protected]>
Date:   Wed Nov 20 22:44:16 2024 +0100

    fixed trigger for jupytext

commit b9b3a6f
Author: lrlunin <[email protected]>
Date:   Wed Nov 20 22:40:17 2024 +0100

    split scripts and notebooks

commit 279a578
Merge: beddf13 8d24ebb
Author: Lunin Leonid <[email protected]>
Date:   Tue Nov 19 21:10:30 2024 +0100

    Merge branch 'main' into notebooks-in-pre-commit

commit beddf13
Author: lrlunin <[email protected]>
Date:   Tue Nov 19 21:10:03 2024 +0100

    sync .ipynb/.py in pre-commit, add preamble in .py files

commit 0600a53
Author: lrlunin <[email protected]>
Date:   Tue Nov 19 18:42:47 2024 +0100

    moved examples ruff config to examples folder, removed verbose from pre-commit hook

commit 36f3b7a
Author: lrlunin <[email protected]>
Date:   Tue Nov 19 18:25:57 2024 +0100

    fixed missing kernelspec

commit 4d610c6
Author: lrlunin <[email protected]>
Date:   Fri Nov 15 14:23:38 2024 +0100

    also removing metadata.language_info

commit 48e8080
Author: lrlunin <[email protected]>
Date:   Thu Nov 14 22:45:35 2024 +0100

    clean kernel related information from the cells

commit f8aa621
Author: lrlunin <[email protected]>
Date:   Thu Nov 14 20:44:13 2024 +0100

    remove mention of convert steps

commit 534aaa0
Author: lrlunin <[email protected]>
Date:   Thu Nov 14 20:37:43 2024 +0100

    reset cell id

commit 9f5f2da
Merge: 74675d6 38722bf
Author: Lunin Leonid <[email protected]>
Date:   Thu Nov 14 20:36:21 2024 +0100

    Merge branch 'main' into notebooks-in-pre-commit

commit 74675d6
Merge: ae3a613 c268ad2
Author: Lunin Leonid <[email protected]>
Date:   Sun Nov 10 20:50:44 2024 +0100

    Merge branch 'main' into notebooks-in-pre-commit

commit ae3a613
Author: lrlunin <[email protected]>
Date:   Sun Nov 10 20:50:10 2024 +0100

    reset the cells to init states

commit 5d1dba2
Author: lrlunin <[email protected]>
Date:   Fri Nov 8 16:43:47 2024 +0100

    moved notebooks formatting and update to pre-commit
  • Loading branch information
fzimmermann89 committed Jan 12, 2025
1 parent 66a4d4e commit 7cc6587
Show file tree
Hide file tree
Showing 11 changed files with 589 additions and 196 deletions.
33 changes: 20 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,31 @@ repos:
args: [--extra-keys, "metadata.language_info"]
files: examples/notebooks

- repo: https://github.com/mwouts/jupytext
rev: v1.16.6
- repo: local
hooks:
- id: jupytext
name: convert .py to .ipynb
args:
- --update
- --pipe
- "python .precommit/add_notebook_preemble.py {}"
- --to
- "../notebooks//ipynb"
- --update-metadata
- '{"accelerator": "GPU","colab": {"gpuType": "T4","provenance": []},"kernelspec": {"display_name": "Python 3 (ipykernel)","language": "python","name": "python3"}}'
- -q
always_run: false
language: python

additional_dependencies:
- jupytext
entry: >
jupytext
--update
--pipe
"python .precommit/add_notebook_preemble.py {}"
--to
"../notebooks//ipynb"
--update-metadata
'{
"accelerator": "GPU",
"colab": {"gpuType": "T4","provenance": []},
"kernelspec": {"display_name": "Python 3 (ipykernel)","language": "python","name": "python3"}
}'
always_run: true
pass_filenames: true
files: ^examples/scripts/.*py

types_or: [python]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
Expand Down
2 changes: 1 addition & 1 deletion .precommit/add_notebook_preemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import importlib
if not importlib.util.find_spec('mrpro'):
%pip install mrpro
%pip install mrpro[notebook]
"""

# the temp files of jupytext have the header which looks like:
Expand Down
11 changes: 8 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,10 @@ def replace_patterns_in_markdown(app, docname, source):


def sync_notebooks(source_folder, dest_folder):
"""
Synchronize files from the source to the destination folder, copying only new or updated files.
""" Sync notebooks from source to destination folder.
Copy only new or updated files.
Set execution mode to 'force' for all copied files.
"""
dest = Path(dest_folder)
dest.mkdir(parents=True, exist_ok=True)
Expand All @@ -273,7 +275,10 @@ def sync_notebooks(source_folder, dest_folder):
dest_file = dest / src_file.name
if not dest_file.exists() or src_file.stat().st_mtime > dest_file.stat().st_mtime:
shutil.copy2(src_file, dest_file)

print(f"Copied {src_file} to {dest_file}. Setting execution mode to 'force'.")
content = nbformat.read(dest_file, as_version=nbformat.NO_CONVERT)
content.metadata['mystnb'] = {'execution_mode':'force'}
nbformat.write(content, dest_file)

def setup(app):
app.set_html_assets_policy('always') # forces mathjax on all pages
Expand Down
4 changes: 1 addition & 3 deletions examples/notebooks/cartesian_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"import importlib\n",
"\n",
"if not importlib.util.find_spec('mrpro'):\n",
" %pip install mrpro"
" %pip install mrpro[notebook]"
]
},
{
Expand Down Expand Up @@ -322,9 +322,7 @@
"execution_count": null,
"id": "23",
"metadata": {
"inputHidden": true,
"lines_to_next_cell": 0,
"outputHidden": true,
"tags": [
"remove-output"
]
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/direct_reconstruction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"import importlib\n",
"\n",
"if not importlib.util.find_spec('mrpro'):\n",
" %pip install mrpro"
" %pip install mrpro[notebook]"
]
},
{
Expand Down
Loading

0 comments on commit 7cc6587

Please sign in to comment.