nbsync 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl
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.
- nbsync/notebook.py +10 -2
- nbsync/sync.py +3 -1
- {nbsync-0.3.1.dist-info → nbsync-0.3.3.dist-info}/METADATA +1 -1
- {nbsync-0.3.1.dist-info → nbsync-0.3.3.dist-info}/RECORD +6 -6
- {nbsync-0.3.1.dist-info → nbsync-0.3.3.dist-info}/WHEEL +0 -0
- {nbsync-0.3.1.dist-info → nbsync-0.3.3.dist-info}/licenses/LICENSE +0 -0
nbsync/notebook.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
3
|
import copy
|
4
|
+
import os
|
5
|
+
import time
|
4
6
|
from typing import TYPE_CHECKING
|
5
7
|
|
6
8
|
import nbstore.notebook
|
@@ -10,6 +12,9 @@ from nbsync import logger
|
|
10
12
|
if TYPE_CHECKING:
|
11
13
|
from nbformat import NotebookNode
|
12
14
|
|
15
|
+
# DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
|
16
|
+
os.environ.setdefault("JUPYTER_PLATFORM_DIRS", "1")
|
17
|
+
|
13
18
|
|
14
19
|
class Notebook:
|
15
20
|
nb: NotebookNode
|
@@ -36,10 +41,13 @@ class Notebook:
|
|
36
41
|
def equals(self, other: Notebook) -> bool:
|
37
42
|
return nbstore.notebook.equals(self.nb, other.nb)
|
38
43
|
|
39
|
-
def execute(self) ->
|
44
|
+
def execute(self) -> float:
|
40
45
|
try:
|
46
|
+
start_time = time.perf_counter()
|
41
47
|
nbstore.notebook.execute(self.nb)
|
48
|
+
end_time = time.perf_counter()
|
42
49
|
self.execution_needed = False
|
43
|
-
|
50
|
+
return end_time - start_time
|
44
51
|
except ModuleNotFoundError as e: # no cov
|
45
52
|
logger.warning(e.msg)
|
53
|
+
return 0
|
nbsync/sync.py
CHANGED
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
3
3
|
import re
|
4
4
|
import textwrap
|
5
5
|
from dataclasses import dataclass, field
|
6
|
+
from pathlib import Path
|
6
7
|
from typing import TYPE_CHECKING
|
7
8
|
|
8
9
|
import nbformat
|
@@ -47,7 +48,8 @@ class Synchronizer:
|
|
47
48
|
|
48
49
|
path = ".md" if url == ".md" else self.store.find_path(url)
|
49
50
|
logger.info(f"Executing notebook: {path}")
|
50
|
-
notebook.execute()
|
51
|
+
if elapsed := notebook.execute():
|
52
|
+
logger.info(f"{Path(path).name!r} executed in {elapsed:.2f} seconds")
|
51
53
|
|
52
54
|
def convert(self, text: str) -> Iterator[str | Cell]:
|
53
55
|
elems = list(self.parse(text))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nbsync
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.3
|
4
4
|
Summary: A core library to synchronize Jupyter notebooks and Markdown documents, enabling seamless integration and dynamic content execution
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/nbsync/
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/nbsync
|
@@ -2,10 +2,10 @@ nbsync/__init__.py,sha256=3NuWx9D0LcBnXjEKrC-uypNDOz8rLWXI7mIjdN9xSeE,126
|
|
2
2
|
nbsync/cell.py,sha256=C7VqQO3mxZ7Nj4ufywTnaqZAegT7zqA6iN2WV6X5X5c,3786
|
3
3
|
nbsync/logger.py,sha256=snNRqi9xESj4B-Z9GQffCBlgqeVujvuXuBveWAebIWM,736
|
4
4
|
nbsync/markdown.py,sha256=xcPhQKWpFDyVQ_xtZCpFrnR0QED_hYs4PAyaT7dF3t4,3830
|
5
|
-
nbsync/notebook.py,sha256=
|
5
|
+
nbsync/notebook.py,sha256=4F3V1KDHfJnIR5ZSb1xWdN9JGiC6mWUVimXXK1BFsbc,1450
|
6
6
|
nbsync/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
nbsync/sync.py,sha256=
|
8
|
-
nbsync-0.3.
|
9
|
-
nbsync-0.3.
|
10
|
-
nbsync-0.3.
|
11
|
-
nbsync-0.3.
|
7
|
+
nbsync/sync.py,sha256=vISzn8D_Dae-jdJABRnvvD02aL35bYIWx52OinAORVo,3990
|
8
|
+
nbsync-0.3.3.dist-info/METADATA,sha256=d4Qp0dekZlvGHU797Q8NuZdEdl07FTXxh2lUbmveB9Q,6552
|
9
|
+
nbsync-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
nbsync-0.3.3.dist-info/licenses/LICENSE,sha256=wy1pqn52upuo_qYwY-epWmspwE-3UWJso0xodciGXYc,1062
|
11
|
+
nbsync-0.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|