Show More
@@ -0,0 +1,22 b'' | |||||
|
1 | """ | |||
|
2 | Shim to maintain backwards compatibility with old IPython.nbformat imports. | |||
|
3 | """ | |||
|
4 | # Copyright (c) IPython Development Team. | |||
|
5 | # Distributed under the terms of the Modified BSD License. | |||
|
6 | ||||
|
7 | from __future__ import print_function | |||
|
8 | ||||
|
9 | # Stdlib | |||
|
10 | import sys | |||
|
11 | import types | |||
|
12 | from warnings import warn | |||
|
13 | ||||
|
14 | warn("The `IPython.nbformat` package has been deprecated. " | |||
|
15 | "You should import from jupyter_nbformat instead.") | |||
|
16 | ||||
|
17 | from IPython.utils.shimmodule import ShimModule | |||
|
18 | ||||
|
19 | # Unconditionally insert the shim into sys.modules so that further import calls | |||
|
20 | # trigger the custom attribute access above | |||
|
21 | ||||
|
22 | sys.modules['IPython.nbformat'] = ShimModule('nbformat', mirror='jupyter_nbformat') |
@@ -30,13 +30,4 b' class TestsBase(unittest.TestCase):' | |||||
30 |
|
30 | |||
31 |
|
31 | |||
32 | def _get_files_path(self): |
|
32 | def _get_files_path(self): | |
33 |
|
33 | return os.path.dirname(__file__) | ||
34 | #Get the relative path to this module in the IPython directory. |
|
|||
35 | names = self.__module__.split(u'.')[1:-1] |
|
|||
36 |
|
||||
37 | #Build a path using the IPython directory and the relative path we just |
|
|||
38 | #found. |
|
|||
39 | path = IPython.__path__[0] |
|
|||
40 | for name in names: |
|
|||
41 | path = os.path.join(path, name) |
|
|||
42 | return path |
|
@@ -8,7 +8,7 b' from .nbbase import (' | |||||
8 | nbformat, nbformat_minor |
|
8 | nbformat, nbformat_minor | |
9 | ) |
|
9 | ) | |
10 |
|
10 | |||
11 |
from |
|
11 | from jupyter_nbformat import v2 | |
12 |
|
12 | |||
13 | def _unbytes(obj): |
|
13 | def _unbytes(obj): | |
14 | """There should be no bytes objects in a notebook |
|
14 | """There should be no bytes objects in a notebook |
@@ -11,7 +11,7 b' from .nbbase import (' | |||||
11 | NotebookNode, |
|
11 | NotebookNode, | |
12 | ) |
|
12 | ) | |
13 |
|
13 | |||
14 |
from |
|
14 | from jupyter_nbformat import v3 | |
15 | from IPython.utils.log import get_logger |
|
15 | from IPython.utils.log import get_logger | |
16 |
|
16 | |||
17 | def _warn_if_invalid(nb, version): |
|
17 | def _warn_if_invalid(nb, version): |
@@ -196,11 +196,11 b' def find_package_data():' | |||||
196 | 'preprocessors/tests/files/*.*', |
|
196 | 'preprocessors/tests/files/*.*', | |
197 | ], |
|
197 | ], | |
198 | 'IPython.nbconvert.filters' : ['marked.js'], |
|
198 | 'IPython.nbconvert.filters' : ['marked.js'], | |
199 | 'IPython.nbformat' : [ |
|
199 | # 'IPython.nbformat' : [ | |
200 | 'tests/*.ipynb', |
|
200 | # 'tests/*.ipynb', | |
201 | 'v3/nbformat.v3.schema.json', |
|
201 | # 'v3/nbformat.v3.schema.json', | |
202 | 'v4/nbformat.v4.schema.json', |
|
202 | # 'v4/nbformat.v4.schema.json', | |
203 | ], |
|
203 | # ], | |
204 | 'IPython.kernel': ['resources/*.*'], |
|
204 | 'IPython.kernel': ['resources/*.*'], | |
205 | } |
|
205 | } | |
206 |
|
206 |
General Comments 0
You need to be logged in to leave comments.
Login now