Skip to content

--set-formats fails if old metadata present #163

Closed
@goerz

Description

Consider the notebook at https://raw.githubusercontent.com/qucontrol/krotov/3ff0bc3b9a4d591ec699a6b3e92ba41f7fd10bc3/docs/notebooks/02_example_lambda_system_rwa_complex_pulse.ipynb

It contains a metadata blob that the older version of jupytext added when editing the file in vim with jupytext.vim:

"jupytext": {
   "main_language": "python",
   "text_representation": {
    "extension": ".md",
    "format_name": "markdown",
    "format_version": "1.0",
    "jupytext_version": "0.8.6"
 }

If I run

jupytext --set-formats ipynb,py:light 02_example_lambda_system_rwa_complex_pulse.ipynb`

I get

[jupytext] Reading 02_example_lambda_system_rwa_complex_pulse.ipynb
[jupytext] Updating notebook metadata with {'jupytext': {'formats': 'ipynb,py:light'}}
[jupytext] Error: Notebook path '02_example_lambda_system_rwa_complex_pulse.ipynb' was expected to have extension '.md'

and the notebook file is not updated with new metadata. It works if I remove the 'jupytext metadata from the ipynb file manually, before running the command.

Do I understand the current README correctly, that "jupytext": {"formats": "ipynb,py"}, is the only metadata that jupytext v.1.0.0 will put in the notebook? If so, it should probably remove the legacy metadata from the notebook.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions