QuantEcon / meta

For issues and discussion covering more than one repository
0 stars 0 forks source link

Disappeared ipython3 #102

Open chappiewuzefan opened 1 year ago

chappiewuzefan commented 1 year ago

the correct format should be:

image

however, every time I pushed it, those ipython3 are disappeared

the incorrect format:

image

I think this problem only occur when using jupyter lab, cause previously I used jupyter notebook and transfer the file between md and ipynb there was no this issue.

jstac commented 1 year ago

@chappiewuzefan Are you sure this happens when you push?

I guess it happens when you do the conversion. If so, what exact commands did you use, and what exactly what were you converting, and what versions of software are you using?

(This is what I meant by describing your problem exactly.)

Smit-create commented 1 year ago

I can reproduce the error. Please follow the following steps to notice the change:

(qe) thebigbool@192 lecture-python-intro % git clean -dfx
Removing .ipynb_checkpoints/
Removing _build/
Removing in-work/
Removing lectures/.ipynb_checkpoints/
(qe) thebigbool@192 lecture-python-intro % jupytext --to ipynb lectures/lln_clt.md
[jupytext] Reading lectures/lln_clt.md in format md
[jupytext] Writing lectures/lln_clt.ipynb
(qe) thebigbool@192 lecture-python-intro % jupytext --to myst lectures/lln_clt.ipynb   
[jupytext] Reading lectures/lln_clt.ipynb in format ipynb
[jupytext] Writing lectures/lln_clt.md in format md:myst (destination file replaced)

The file lln_clt.md gets updated by removing all the ipython3 from code-cell even when we do not open/touch lln_clt.ipynb at all.

Versions:

% jupytext --version                  
1.14.5
% pip show markdown-it-py
Name: markdown-it-py
Version: 2.2.0
chappiewuzefan commented 1 year ago

Thanks Smit. Below is what I did (without ipython3 disappeared issue):

 1008  conda activate quantecon
 1013  git checkout power_iteration
 1016  jupytext markov_asset.md --to ipynb
 1017  jupytext markov_asset.ipynb --to myst
 1018  git status
 1019  git add markov_asset.md
 1020  git commit -m "ipython3"
 1022  git push

In this case, I pulled the md file down, and transfer into ipynb, then I used jupyter notebook to midify the lecture, after the modification, I transferred the ipynb back to md file. Finally, I pushed to the branch. In this way, no issue about the ipython3.

(quantecon) frank@Franks-MBP lectures % jupytext --version 
1.14.5
(quantecon) frank@Franks-MBP lectures % pip show markdown-it-py
Name: markdown-it-py
Version: 1.1.0
Summary: Python port of markdown-it. Markdown parsing, done right!
Home-page: https://github.com/executablebooks/markdown-it-py
Author: Chris Sewell
Author-email: chrisj_sewell@hotmail.com
License: MIT
Location: /Users/frank/opt/anaconda3/envs/quantecon/lib/python3.9/site-packages
Requires: attrs
Required-by: myst-parser, mdit-py-plugins, jupytext

I tried the jupyter lab again, no ipython disappeared issue with same environment.

jstac commented 1 year ago

@mmcky FYI

mmcky commented 1 year ago

@Smit-create and @chappiewuzefan can you please

pip install --upgrade jupyterlab-myst

then

jupyter lab <filename>.md

once jupyter lab opens then you

right click on the <filename>.md and say open as ipynb

this should render really nicely for you.

Then

  1. make an edit
  2. save the file

and see if the md file has been altered / removing those ipython language identifiers.

chappiewuzefan commented 1 year ago

tested, the ipython identifiers are not removed.