Skip to content

Commit

Permalink
Jupytext as a nbserver_extension #176
Browse files Browse the repository at this point in the history
  • Loading branch information
mwouts committed Feb 16, 2019
1 parent 18cb94d commit 965ce7f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 3 additions & 1 deletion jupyter-config/jupyter_notebook_config.d/jupytext.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"NotebookApp": {
"contents_manager_class": "jupytext.TextFileContentsManager"
"nbserver_extensions": {
"jupytext": true
}
}
}
16 changes: 16 additions & 0 deletions jupytext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ def __init__(self):
raise self.err


def load_jupyter_server_extension(app): # pragma: no cover
"""Use Jupytext's contents manager"""
# The server extension call is too late!
# The contents manager was set at NotebookApp.init_configurables

# Let's change the contents manager class
app.contents_manager_class = TextFileContentsManager

# And rerun the init steps from then to now
app.init_configurables()
app.init_components()
app.init_webapp()
app.init_terminals()
app.init_signal()


def _jupyter_nbextension_paths(): # pragma: no cover
"""Allows commands like
jupyter nbextension install --py jupytext
Expand Down
2 changes: 1 addition & 1 deletion jupytext/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Jupytext's version number"""

__version__ = '1.0.0-rc4'
__version__ = '1.0.0-rc4+dev'

0 comments on commit 965ce7f

Please sign in to comment.