jupytext.nvim icon indicating copy to clipboard operation
jupytext.nvim copied to clipboard

fix: correctly infer output extension for jupytext command

Open hamzashezad opened this issue 1 year ago • 2 comments

fixes a bug where extracted metadata information is not used when constructing the jupytext command to convert python. NOTE: this and #19 are both required to fix issues when opening a Google Colab exported notebook.

Context I get the following metadata from a notebook exported directly from Google Colab. jupytext doesn't have enough information to use auto:hydrogen when converting:

  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    }

hamzashezad avatar Mar 23 '24 12:03 hamzashezad

Can you explain what information is jupytext missing above in order to make use of the auto mode?

GCBallesteros avatar Mar 25 '24 07:03 GCBallesteros

jupytext uses the kernelspec.language_info.file_extension (or kernelspec.language, or jupytext.main_language as fallbacks) to determine the output format: https://github.com/mwouts/jupytext/blob/main/src/jupytext/formats.py#L811 -> https://github.com/mwouts/jupytext/blob/main/src/jupytext/formats.py#L782

hamzashezad avatar Mar 25 '24 13:03 hamzashezad