question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to get rid of jupytext_version in the notebook metadata

See original GitHub issue

Hey there

as the tile has it, my use case would require to get rid of jupytext_version in my notebooks metadata

for some time I have been successfully running in a mode where language_info is stripped from said notebook metadata (actually it’s kind of the same need, differences in the version numbers between the authoring laptop and the runtime testbed creates tend to create headaches 😉

so I have tried to tweak that same setting, but I can’t seem to find the correct wording; I have tried for example this :

notebook_metadata_filter: all,-language_info,-jupyter.jupytext.text_representation.jupytext_version

together with a few variants, but can’t seem to get it right; what am I doing wrong ?

– a jupytext lover 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
parmentelatcommented, Jan 28, 2020

hi @mwouts, thanks for taking care of this

first thing I want to report is there is an extra " in your first snippet; then end should read

jupytext_version"}}'

instead of

jupytext_version"}"}'

now, when I do run this on a sample notebook, which happens to be in .md format, I observe vast changes that are not what I expected; it does add the metadata filter, but otherwise removes a lot of global metadata; was that intended ?

# checking file is unchanged
$ git diff 01-motivation.md

# running your command
$ jupytext 01-motivation.md --update-metadata '{"jupytext":{"notebook_metadata_filter":"-jupytext.text_representation.jupytext_version"}}'
[jupytext] Reading 01-motivation.md
[jupytext] Updating notebook metadata with '{"jupytext": {"notebook_metadata_filter": "-jupytext.text_representation.jupytext_version"}}'
[jupytext] Writing 01-motivation.md in format md (destination file replaced)

# observing changes
$ git diff 01-motivation.md
diff --git a/notebooks/01-motivation.md b/notebooks/01-motivation.md
index 32fb082..d0d7cb2 100644
--- a/notebooks/01-motivation.md
+++ b/notebooks/01-motivation.md
@@ -1,43 +1,17 @@
 ---
 jupyter:
-  celltoolbar: Slideshow
   jupytext:
     cell_metadata_filter: all
     formats: md
-    notebook_metadata_filter: all,-language_info
+    notebook_metadata_filter: -jupytext.text_representation.jupytext_version
     text_representation:
       extension: .md
       format_name: markdown
       format_version: '1.2'
-      jupytext_version: 1.3.2
   kernelspec:
     display_name: Javascript (Node.js)
     language: javascript
     name: javascript
-  notebookname: motivation
-  rise:
-    autolaunch: true
-    slideNumber: c/t
-    start_slideshow_at: selected
-    theme: sky
-    transition: cube
-  toc:
-    base_numbering: 1
-    nav_menu: {}
-    number_sections: false
-    sideBar: false
-    skip_h1_title: false
-    title_cell: Table of Contents
-    title_sidebar: Contents
-    toc_cell: false
-    toc_position:
-      height: 179px
-      left: 25px
-      top: 134px
-      width: 202.391px
-    toc_section_display: true
-    toc_window_display: true
-  version: '1.0'
 ---

 <div class="licence">
(END)
0reactions
parmentelatcommented, Jan 29, 2020

hi; me again 😉

I just realized that I had a setting in ~/.jupyter/notebook_config.py

c.ContentsManager.default_notebook_metadata_filter = "all,-language_info"

because of its name I thought this setting would not affect the notebooks where I had explicitly defined the complete new value ending in -jupytext.text_representation.jupytext_version

so, I cannot yet confirm that this was the root problem, but I did change the default to be in line with what I want, since any impact on all my other notebooks would not matter anyway

hopefully I will be able to confirm in a couple days, I just have too many instances of jupyter servers and notebooks open at that point to be able to be positive

Read more comments on GitHub >

github_iconTop Results From Across the Web

jupytext: how to get rid of jupytext_version in the notebook ...
to get rid of them. This got read of almost all the offending metadata with the exception of: kernelspec: display_name: Python 3 (ipykernel)....
Read more >
Hide or remove content - Jupyter Book
To hide Markdown, use the {toggle} directive. To hide or remove code cells or their outputs, use notebook cell tags. We'll cover each...
Read more >
5. Metadata Tags — ipypublish 0.10.12 documentation
For notebook level: in the Jupyter Notebook Toolbar go to Edit -> Edit Notebook Metadata. For cell level: in the Jupyter Notebook Toolbar...
Read more >
How to Version Control Jupyter Notebooks - Nextjournal
Jupyter notebooks generate files that may contain metadata, source code, ... This removes any binary blobs that have been generated by the notebook....
Read more >
Cell ID Addition to Notebook Format — Jupyter Enhancement ...
Out of scope for this proposal is an overall notebook id field. ... This change is not an addition to the cells' metadata...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found