-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jdranczewski/dev
v0.11.0
- Loading branch information
Showing
14 changed files
with
1,201 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ pyqtgraph==0.13.3 | |
numpy==1.26.2 | ||
sphinx==7.2.5 | ||
sphinx-rtd-theme==1.3.0rc1 | ||
nbsphinx==0.9.5 | ||
ipykernel==6.29.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
puzzlepiece.extras.ipython_shims module | ||
======================================= | ||
|
||
Import this module to get access to useful puzzlepiece-related Magics:: | ||
|
||
from puzzlepiece.extras import ipython_shims | ||
|
||
%%pzp_script | ||
------------ | ||
|
||
Magic for running the cell as puzzlepiece script:: | ||
|
||
%%pzp_script | ||
set:piece_name:param_name:25 | ||
prompt:Param changed | ||
|
||
Assumes the :class:`~puzzlepiece.puzzle.Puzzle` is in the global namespace | ||
as ``puzzle``. A different name can be provided as an argument to the magic: | ||
``%%pzp_script puzzle_variable``. | ||
|
||
See :func:`puzzlepiece.parse.run` for the full scripting syntax. | ||
|
||
%%safe_run | ||
------------ | ||
|
||
Magic for running the cell with a safety function in case of a crash:: | ||
|
||
# Cell 1 | ||
def close_shutter(): | ||
puzzle["shutter"]["open"].set_value(0) | ||
|
||
# Cell 2 | ||
%%safe_run close_shutter | ||
raise Exception | ||
|
||
Running cell 2 will raise an exception, but the magic catches the exception, | ||
closes the shutter, and then the original exception is re-raised. Another | ||
useful usecase is sending a Slack message when a crash occurs. | ||
|
||
This is similar in spirit to :func:`puzzlepiece.puzzle.Puzzle.custom_excepthook`, | ||
but works in Notebooks in constrast to that. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.