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.

Is there a list of which formats offer roundtripping ?

See original GitHub issue

I tried jupytext initially, with .py, but I noticed, when roundtripping to ipynb, that multiple newlines can result in code cells splitting up.

Now I’m trying .md, as I could see this in github, though it turns out to be not completely ideal as github shows all the metadata at the top.

What is the best format to use that can handle a round trip ?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mwoutscommented, Feb 17, 2020

That looks good, is there a list that maps extensions to the format names somewhere ?

That’s a good idea! I’ll update the PR. Basically,

  • the .md extension corresponds to either the markdown (default) or pandoc formats (calls pandoc, so you should have a recent version of pandoc installed)
  • the .Rmd extension corresponds to the rmarkdown format (default)
  • the script formats uses the language extension, i.e. .py in the context of a Python notebook. And the available formats are light (the default), percent (# %% markers), sphinx (if you are using sphinx-gallery, cannot store cell metadata), hydrogen (same as percent, except that magic commands are not commented out), and nomarker (no cell marker nor metadata, obviously not robust to a round trip).
1reaction
mwoutscommented, Feb 6, 2020

Hello @stuaxo , thanks for asking.

The three main formats, i.e. py:percent, py:light and md should be robust to the round-trip. Now the question is how you define the cells: py:percent is the most explicit with # %% before every cell, the two others may indeed use single or double blank lines as cell breaks.

These formats are documented here.

Given a text file, or an .ipynb notebook, you can test the round-trip with

jupytext --to ipynb --test script.py # or --test-strict

as github shows all the metadata at the top

For this, you can give a try to the notebook metadata filter. Uncheck the ‘include metadata’ entry in the Jupytext menu, or execute:

jupytext --update-metadata '{"jupytext": {"notebook_metadata_filter":"-all"}}' notebook.ipynb
Read more comments on GitHub >

github_iconTop Results From Across the Web

Round-tripping (finance) - Wikipedia
In international scenarios, round-tripping is a method of structuring to evade taxes and to launder money. Other companies making unconventional round-tripping ...
Read more >
What is round-trip time? | RTT definition - Cloudflare
Round-trip time (RTT) is the duration in milliseconds (ms) it takes for a network request to go from a starting point to a...
Read more >
Standard date and time format strings | Microsoft Learn
Learn how to use a standard date and time format string to define the text representation ... More information: The round-trip ("O", "o")...
Read more >
Roundtrip vs Flex - Zipcar
At Zipcar we offer two ways of getting around: Roundtrip and Flex. Roundtrip is our traditional service, used for pre-planned round trips, whilst...
Read more >
How to Format Fixed Broadband Availability Location Lists
Field Header Data Type Example Provider ID provider_id Integer 131425 Brand Name brand_name String Acme Broadband Location ID location_id Integer 1000000121
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