diff --git a/nbformat/sign.py b/nbformat/sign.py index 06b1abe..42c9072 100644 --- a/nbformat/sign.py +++ b/nbformat/sign.py @@ -14,8 +14,6 @@ from hmac import HMAC from pathlib import Path -from jupyter_core.paths import jupyter_data_dir - try: import sqlite3 @@ -41,7 +39,7 @@ def convert_datetime(val): from jupyter_core.application import JupyterApp, base_flags from traitlets import Any, Bool, Bytes, Callable, Enum, Instance, Integer, Unicode, default, observe -from traitlets.config import LoggingConfigurable +from traitlets.config import LoggingConfigurable, MultipleInstanceError from . import NO_CONVERT, __version__, read, reads @@ -343,7 +341,17 @@ class NotebookNotary(LoggingConfigurable): @default("data_dir") def _data_dir_default(self): - return jupyter_data_dir() + app = None + try: + if JupyterApp.initialized(): + app = JupyterApp.instance() + except MultipleInstanceError: + pass + if app is None: + # create an app, without the global instance + app = JupyterApp() + app.initialize(argv=[]) + return app.data_dir store_factory = Callable( help="""A callable returning the storage backend for notebook signatures. diff --git a/package.json b/package.json index ef03fc9..7e07b3f 100644 --- a/package.json +++ b/package.json @@ -1,25 +1,25 @@ { - "name": "nbformat-schema", - "version": "5.10.2", - "description": "JSON schemata for Jupyter notebook formats", - "main": "index.js", - "files": [ - "nbformat/v3/nbformat.v3.schema.json", - "nbformat/v4/nbformat.v4.schema.json" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/jupyter/nbformat.git" - }, - "keywords": [ - "jupyter", - "notebook", - "json-schema" - ], - "author": "Project Jupyter Contributors", - "license": "BSD-3-Clause", - "bugs": { - "url": "https://github.com/jupyter/nbformat/issues" - }, - "homepage": "https://nbformat.readthedocs.io" + "name": "nbformat-schema", + "version": "5.10.2", + "description": "JSON schemata for Jupyter notebook formats", + "main": "index.js", + "files": [ + "nbformat/v3/nbformat.v3.schema.json", + "nbformat/v4/nbformat.v4.schema.json" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/jupyter/nbformat.git" + }, + "keywords": [ + "jupyter", + "notebook", + "json-schema" + ], + "author": "Project Jupyter Contributors", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/jupyter/nbformat/issues" + }, + "homepage": "https://nbformat.readthedocs.io" }