Skip to content

Commit

Permalink
Merge pull request #909 from minrk/magics-example
Browse files Browse the repository at this point in the history
update magics tutorial
  • Loading branch information
minrk authored Nov 4, 2024
2 parents 8b47db8 + a754f4c commit d8f9407
Show file tree
Hide file tree
Showing 17 changed files with 8,484 additions and 2,707 deletions.
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ repos:
- "--fix"
exclude_types:
- jupyter
- id: ruff
name: ruff (notebooks)
args:
- "--fix"
types:
- jupyter
- id: ruff-format
# run via nbqa to handle cell magics
exclude_types:
- jupyter
# run ruff via nbqa, which has better and configurable handling of cell magics
# than ruff itself
# but has trouble with isort rules
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.0
hooks:
- id: nbqa-ruff-format
- id: nbqa-ruff-check
args:
- --fix
# isort rules get confused in the temporary files
- --ignore=I
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
Expand Down
10 changes: 4 additions & 6 deletions docs/source/examples/Futures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -416,7 +414,7 @@
},
"outputs": [],
"source": [
"def task(n):\n",
"def interactive_task(n):\n",
" \"\"\"Generates a 1xN array and computes its 2-norm\"\"\"\n",
" import numpy\n",
" from numpy.linalg import norm\n",
Expand Down Expand Up @@ -542,8 +540,8 @@
}
],
"source": [
"print(\"Local time:\")\n",
"%time ref = list(map(task, sizes))"
"%%time\n",
"ref = list(map(task, sizes))"
]
},
{
Expand Down
273 changes: 197 additions & 76 deletions docs/source/examples/Monte Carlo Options.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit d8f9407

Please sign in to comment.