execnb 0.3.3__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execnb
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: A description of your project
5
5
  Author-email: Jeremy Howard <j@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/execnb/
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/execnb/
9
9
  Keywords: some,keywords
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.7
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=2.2.5
18
+ Requires-Dist: fastcore>=2.2.34
19
19
  Requires-Dist: ipython
20
20
  Provides-Extra: dev
21
21
  Requires-Dist: matplotlib; extra == "dev"
@@ -42,7 +42,7 @@ or if you use conda:
42
42
 
43
43
  ## How to use
44
44
 
45
- Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is async, so `await` the run from a notebook or async code, or wrap it in [`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run) at a sync entry point:
45
+ Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is sync – each shell runs cells on its own private event loop in a background thread, so it works the same from a script, a notebook, or an async server, and cells may use top-level `await`:
46
46
 
47
47
  ``` python
48
48
  from execnb.shell import *
@@ -52,24 +52,24 @@ from fastcore.nbio import *
52
52
 
53
53
  ``` python
54
54
  s = CaptureShell()
55
- await s.run('1+1')
55
+ s.run('1+1')
56
56
  ```
57
57
 
58
58
  [{'data': {'text/plain': ['2']},
59
59
  'metadata': {},
60
60
  'output_type': 'execute_result',
61
- 'execution_count': None}]
61
+ 'execution_count': 1}]
62
62
 
63
63
  To execute a notebook and save it with outputs filled in, use [`CaptureShell.execute`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell.execute):
64
64
 
65
65
  ``` python
66
66
  try:
67
- await s.execute('../tests/clean.ipynb', 'tmp.ipynb')
67
+ s.execute('../tests/clean.ipynb', 'tmp.ipynb')
68
68
  print(read_nb('tmp.ipynb').cells[1].outputs)
69
69
  finally: Path('tmp.ipynb').unlink()
70
70
  ```
71
71
 
72
- [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': None, 'metadata': {}, 'output_type': 'execute_result'}]
72
+ [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': 3, 'metadata': {}, 'output_type': 'execute_result'}]
73
73
 
74
74
  You can also execute notebooks from the command line with [`exec_nb`](https://AnswerDotAI.github.io/execnb/shell.html#exec_nb):
75
75
 
@@ -77,21 +77,24 @@ You can also execute notebooks from the command line with [`exec_nb`](https://An
77
77
  !exec_nb --help
78
78
  ```
79
79
 
80
- usage: exec_nb [-h] [--dest DEST] [--exc_stop] [--inject_code INJECT_CODE]
81
- [--inject_path INJECT_PATH] [--inject_idx INJECT_IDX] [--verbose]
80
+ usage: exec_nb [-h] [--dest (str)] [--exc-stop] [--inject-code (str)]
81
+ [--inject-path (str)] [--inject-idx (int)] [--verbose]
82
+ [--cell-timeout (int)]
82
83
  src
83
84
 
84
85
  Execute notebook from `src` and save with outputs to `dest`
85
86
 
86
87
  positional arguments:
87
- src Notebook path to read from
88
+ src Notebook path to read from
88
89
 
89
90
  options:
90
- -h, --help show this help message and exit
91
- --dest DEST Notebook path to write to (default: )
92
- --exc_stop Stop on exceptions? (default: False)
93
- --inject_code INJECT_CODE Code to inject into a cell
94
- --inject_path INJECT_PATH Path to file containing code to inject into a cell
95
- --inject_idx INJECT_IDX Cell to replace with `inject_code` (default: 0)
96
- --verbose Show stdout/stderr during execution (default:
97
- False)
91
+ -h, --help show this help message and exit
92
+ --dest (str) Notebook path to write to (default: '')
93
+ --exc-stop Stop on exceptions? (default: False)
94
+ --inject-code (str) Code to inject into a cell
95
+ --inject-path (str) Path to file containing code to inject into a cell
96
+ --inject-idx (int) Cell to replace with `inject_code` (default: 0)
97
+ --verbose Show stdout/stderr during execution (default: False)
98
+ --cell-timeout (int) Seconds before each cell times out (None: no limit)
99
+
100
+ execnb 0.3.4
@@ -17,7 +17,7 @@ or if you use conda:
17
17
 
18
18
  ## How to use
19
19
 
20
- Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is async, so `await` the run from a notebook or async code, or wrap it in [`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run) at a sync entry point:
20
+ Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is sync – each shell runs cells on its own private event loop in a background thread, so it works the same from a script, a notebook, or an async server, and cells may use top-level `await`:
21
21
 
22
22
  ``` python
23
23
  from execnb.shell import *
@@ -27,24 +27,24 @@ from fastcore.nbio import *
27
27
 
28
28
  ``` python
29
29
  s = CaptureShell()
30
- await s.run('1+1')
30
+ s.run('1+1')
31
31
  ```
32
32
 
33
33
  [{'data': {'text/plain': ['2']},
34
34
  'metadata': {},
35
35
  'output_type': 'execute_result',
36
- 'execution_count': None}]
36
+ 'execution_count': 1}]
37
37
 
38
38
  To execute a notebook and save it with outputs filled in, use [`CaptureShell.execute`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell.execute):
39
39
 
40
40
  ``` python
41
41
  try:
42
- await s.execute('../tests/clean.ipynb', 'tmp.ipynb')
42
+ s.execute('../tests/clean.ipynb', 'tmp.ipynb')
43
43
  print(read_nb('tmp.ipynb').cells[1].outputs)
44
44
  finally: Path('tmp.ipynb').unlink()
45
45
  ```
46
46
 
47
- [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': None, 'metadata': {}, 'output_type': 'execute_result'}]
47
+ [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': 3, 'metadata': {}, 'output_type': 'execute_result'}]
48
48
 
49
49
  You can also execute notebooks from the command line with [`exec_nb`](https://AnswerDotAI.github.io/execnb/shell.html#exec_nb):
50
50
 
@@ -52,21 +52,24 @@ You can also execute notebooks from the command line with [`exec_nb`](https://An
52
52
  !exec_nb --help
53
53
  ```
54
54
 
55
- usage: exec_nb [-h] [--dest DEST] [--exc_stop] [--inject_code INJECT_CODE]
56
- [--inject_path INJECT_PATH] [--inject_idx INJECT_IDX] [--verbose]
55
+ usage: exec_nb [-h] [--dest (str)] [--exc-stop] [--inject-code (str)]
56
+ [--inject-path (str)] [--inject-idx (int)] [--verbose]
57
+ [--cell-timeout (int)]
57
58
  src
58
59
 
59
60
  Execute notebook from `src` and save with outputs to `dest`
60
61
 
61
62
  positional arguments:
62
- src Notebook path to read from
63
+ src Notebook path to read from
63
64
 
64
65
  options:
65
- -h, --help show this help message and exit
66
- --dest DEST Notebook path to write to (default: )
67
- --exc_stop Stop on exceptions? (default: False)
68
- --inject_code INJECT_CODE Code to inject into a cell
69
- --inject_path INJECT_PATH Path to file containing code to inject into a cell
70
- --inject_idx INJECT_IDX Cell to replace with `inject_code` (default: 0)
71
- --verbose Show stdout/stderr during execution (default:
72
- False)
66
+ -h, --help show this help message and exit
67
+ --dest (str) Notebook path to write to (default: '')
68
+ --exc-stop Stop on exceptions? (default: False)
69
+ --inject-code (str) Code to inject into a cell
70
+ --inject-path (str) Path to file containing code to inject into a cell
71
+ --inject-idx (int) Cell to replace with `inject_code` (default: 0)
72
+ --verbose Show stdout/stderr during execution (default: False)
73
+ --cell-timeout (int) Seconds before each cell times out (None: no limit)
74
+
75
+ execnb 0.3.4
@@ -0,0 +1 @@
1
+ __version__ = "0.3.4"
@@ -13,6 +13,7 @@ from fastcore.utils import *
13
13
  from fastcore.meta import delegates
14
14
  from fastcore.script import call_parse
15
15
  from fastcore.ansi import strip_ansi
16
+ from fastcore.aio import enable_async_magics
16
17
 
17
18
  import asyncio,io,multiprocessing,threading,types,traceback,builtins
18
19
  from contextlib import contextmanager,suppress
@@ -80,6 +81,7 @@ class CaptureShell(InteractiveShell):
80
81
  cfg = _profile_cfg()[0] if profile else Config()
81
82
  if not history: cfg.HistoryManager.hist_file = ':memory:'
82
83
  super().__init__(config=cfg)
84
+ enable_async_magics(self)
83
85
  self.input_transformers_cleanup.append(leading_comment_lines)
84
86
  self.history_manager.enabled = history
85
87
  self.timeout = timeout
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: execnb
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: A description of your project
5
5
  Author-email: Jeremy Howard <j@fast.ai>
6
- License: Apache-2.0
6
+ License-Expression: Apache-2.0
7
7
  Project-URL: Repository, https://github.com/AnswerDotAI/execnb/
8
8
  Project-URL: Documentation, https://AnswerDotAI.github.io/execnb/
9
9
  Keywords: some,keywords
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
15
15
  Requires-Python: >=3.7
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: fastcore>=2.2.5
18
+ Requires-Dist: fastcore>=2.2.34
19
19
  Requires-Dist: ipython
20
20
  Provides-Extra: dev
21
21
  Requires-Dist: matplotlib; extra == "dev"
@@ -42,7 +42,7 @@ or if you use conda:
42
42
 
43
43
  ## How to use
44
44
 
45
- Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is async, so `await` the run from a notebook or async code, or wrap it in [`asyncio.run`](https://docs.python.org/3/library/asyncio-runner.html#asyncio.run) at a sync entry point:
45
+ Use [`CaptureShell`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell) to run Jupyter code and capture notebook outputs, without running a Jupyter server (or even having it installed). The API is sync – each shell runs cells on its own private event loop in a background thread, so it works the same from a script, a notebook, or an async server, and cells may use top-level `await`:
46
46
 
47
47
  ``` python
48
48
  from execnb.shell import *
@@ -52,24 +52,24 @@ from fastcore.nbio import *
52
52
 
53
53
  ``` python
54
54
  s = CaptureShell()
55
- await s.run('1+1')
55
+ s.run('1+1')
56
56
  ```
57
57
 
58
58
  [{'data': {'text/plain': ['2']},
59
59
  'metadata': {},
60
60
  'output_type': 'execute_result',
61
- 'execution_count': None}]
61
+ 'execution_count': 1}]
62
62
 
63
63
  To execute a notebook and save it with outputs filled in, use [`CaptureShell.execute`](https://AnswerDotAI.github.io/execnb/shell.html#captureshell.execute):
64
64
 
65
65
  ``` python
66
66
  try:
67
- await s.execute('../tests/clean.ipynb', 'tmp.ipynb')
67
+ s.execute('../tests/clean.ipynb', 'tmp.ipynb')
68
68
  print(read_nb('tmp.ipynb').cells[1].outputs)
69
69
  finally: Path('tmp.ipynb').unlink()
70
70
  ```
71
71
 
72
- [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': None, 'metadata': {}, 'output_type': 'execute_result'}]
72
+ [{'name': 'stdout', 'output_type': 'stream', 'text': '1\n'}, {'data': {'text/plain': '2'}, 'execution_count': 3, 'metadata': {}, 'output_type': 'execute_result'}]
73
73
 
74
74
  You can also execute notebooks from the command line with [`exec_nb`](https://AnswerDotAI.github.io/execnb/shell.html#exec_nb):
75
75
 
@@ -77,21 +77,24 @@ You can also execute notebooks from the command line with [`exec_nb`](https://An
77
77
  !exec_nb --help
78
78
  ```
79
79
 
80
- usage: exec_nb [-h] [--dest DEST] [--exc_stop] [--inject_code INJECT_CODE]
81
- [--inject_path INJECT_PATH] [--inject_idx INJECT_IDX] [--verbose]
80
+ usage: exec_nb [-h] [--dest (str)] [--exc-stop] [--inject-code (str)]
81
+ [--inject-path (str)] [--inject-idx (int)] [--verbose]
82
+ [--cell-timeout (int)]
82
83
  src
83
84
 
84
85
  Execute notebook from `src` and save with outputs to `dest`
85
86
 
86
87
  positional arguments:
87
- src Notebook path to read from
88
+ src Notebook path to read from
88
89
 
89
90
  options:
90
- -h, --help show this help message and exit
91
- --dest DEST Notebook path to write to (default: )
92
- --exc_stop Stop on exceptions? (default: False)
93
- --inject_code INJECT_CODE Code to inject into a cell
94
- --inject_path INJECT_PATH Path to file containing code to inject into a cell
95
- --inject_idx INJECT_IDX Cell to replace with `inject_code` (default: 0)
96
- --verbose Show stdout/stderr during execution (default:
97
- False)
91
+ -h, --help show this help message and exit
92
+ --dest (str) Notebook path to write to (default: '')
93
+ --exc-stop Stop on exceptions? (default: False)
94
+ --inject-code (str) Code to inject into a cell
95
+ --inject-path (str) Path to file containing code to inject into a cell
96
+ --inject-idx (int) Cell to replace with `inject_code` (default: 0)
97
+ --verbose Show stdout/stderr during execution (default: False)
98
+ --cell-timeout (int) Seconds before each cell times out (None: no limit)
99
+
100
+ execnb 0.3.4
@@ -1,5 +1,4 @@
1
1
  LICENSE
2
- MANIFEST.in
3
2
  README.md
4
3
  pyproject.toml
5
4
  execnb/__init__.py
@@ -1,4 +1,4 @@
1
- fastcore>=2.2.5
1
+ fastcore>=2.2.34
2
2
  ipython
3
3
 
4
4
  [dev]
@@ -1,5 +1,5 @@
1
1
  [build-system]
2
- requires = ["setuptools>=64"]
2
+ requires = ["setuptools>=77"]
3
3
  build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
@@ -8,11 +8,11 @@ dynamic = ["version"]
8
8
  description = "A description of your project"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
11
- license = {text = "Apache-2.0"}
11
+ license = "Apache-2.0"
12
12
  authors = [{name = "Jeremy Howard", email = "j@fast.ai"}]
13
13
  keywords = ['some', 'keywords']
14
14
  classifiers = ["Natural Language :: English", "Intended Audience :: Developers", "Development Status :: 2 - Pre-Alpha", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only"]
15
- dependencies = ['fastcore>=2.2.5', 'ipython']
15
+ dependencies = ['fastcore>=2.2.34', 'ipython']
16
16
 
17
17
  [project.urls]
18
18
  Repository = "https://github.com/AnswerDotAI/execnb/"
execnb-0.3.3/MANIFEST.in DELETED
@@ -1,5 +0,0 @@
1
- include settings.ini
2
- include LICENSE
3
- include CONTRIBUTING.md
4
- include README.md
5
- recursive-exclude * __pycache__
@@ -1 +0,0 @@
1
- __version__ = "0.3.3"
File without changes
File without changes
File without changes
File without changes