-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hv.util.command and set it as an entry point
- Loading branch information
Showing
3 changed files
with
34 additions
and
18 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
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,29 @@ | ||
""" | ||
python -m holoviews.util.command Conversion_Example.ipynb | ||
OR | ||
holoviews Conversion_Example.ipynb | ||
""" | ||
|
||
from __future__ import absolute_import | ||
|
||
import sys, os | ||
import nbformat, nbconvert | ||
from ..ipython.preprocessors import OptsMagicProcessor, OutputMagicProcessor | ||
from ..ipython.preprocessors import StripMagicsProcessor | ||
|
||
|
||
def main(preprocessors=[OptsMagicProcessor(), | ||
OutputMagicProcessor(), | ||
StripMagicsProcessor()]): | ||
with open(sys.argv[1]) as f: | ||
nb = nbformat.read(f, nbformat.NO_CONVERT) | ||
exporter = nbconvert.PythonExporter() | ||
for preprocessor in preprocessors: | ||
exporter.register_preprocessor(preprocessor) | ||
source, meta = exporter.from_notebook_node(nb) | ||
print(source) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() | ||
|
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