diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bb44565..c9d66f781 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ 1.3.4+dev (2020-03-??) ---------------------- +**Fixed** +- Removed leading slash in notebook paths (#444) + **Changed** - The jupyterlab extension (in version 1.2.0) is compatible with JupyterLab 2.0. Many thanks to Jean Helie! (#447) - It is not compatible with JupyterLab 1.x anymore. If you wish, you can install manually the previous version of the extension with `jupyter labextension install jupyterlab-jupytext@1.1.1`. diff --git a/environment.yml b/environment.yml index 8384c1ef8..c981803f5 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - default - conda-forge dependencies: - - python==3.7 + - python - jupyter - jupyterlab - pyyaml diff --git a/jupytext/contentsmanager.py b/jupytext/contentsmanager.py index 8936cfccd..cee9b9ae2 100644 --- a/jupytext/contentsmanager.py +++ b/jupytext/contentsmanager.py @@ -213,6 +213,7 @@ def save(self, model, path=''): if model['type'] != 'notebook': return super(JupytextContentsManager, self).save(model, path) + path = path.strip('/') nbk = model['content'] try: metadata = nbk.get('metadata') @@ -284,7 +285,9 @@ def save(self, model, path=''): def get(self, path, content=True, type=None, format=None, load_alternative_format=True): """ Takes a path for an entity and returns its model""" - os_path = self._get_os_path(path.strip('/')) + path = path.strip('/') + + os_path = self._get_os_path(path) ext = os.path.splitext(path)[1] # Not a notebook? diff --git a/jupytext/version.py b/jupytext/version.py index 267964609..6bb619b7b 100644 --- a/jupytext/version.py +++ b/jupytext/version.py @@ -1,3 +1,3 @@ """Jupytext's version number""" -__version__ = '1.3.4' +__version__ = '1.3.4+dev' diff --git a/tests/test_paired_paths.py b/tests/test_paired_paths.py index 57b4ba6d9..a25ded97d 100644 --- a/tests/test_paired_paths.py +++ b/tests/test_paired_paths.py @@ -67,7 +67,7 @@ def test_prefix_on_root_174(): formats = long_form_multiple_formats(short_formats) assert short_form_multiple_formats(formats) == short_formats - expected_paths = ['/Untitled.ipynb', '/python/Untitled.py'] + expected_paths = ['Untitled.ipynb', 'python/Untitled.py'] for fmt, path in zip(formats, expected_paths): compare(paired_paths(path, fmt, formats), list(zip(expected_paths, formats)))