jupytext.nvim
jupytext.nvim copied to clipboard
fix: correctly infer output extension for jupytext command
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"
}
Can you explain what information is jupytext missing above in order to make use of the auto mode?
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