Currently, when ArcGIS Pro exports a Notebook (Notebook ribbon > Export > Export to Python File), raw cells are exported just like code cells. Markdown cells are not exported. My idea/suggestion is to not export raw cells in Python files because raw cells act as commented-out code.
I (and perhaps other developers) mark cells as raw to treat them as comments, as code that is not meant to run. These may be failed pieces of code, code that was only meant to run once, code that contains snippets they want to keep for later, etc. When I run my entire notebook, I don't want these cells to do anything, or look any different, but I still want to keep them around; I don't want to delete them, but I don't want to execute them either, whether in the Notebook or in the resulting .py file.
Currently, the work-around for this is to mark such cells as markdown. The problem I have with this approach is that running markdown cells makes the code look different. For instance, Python comments start with hashtags (#) which markdown interprets as level-1 headers. Word-wrapping becomes enforced. The font and background change. Markdown is meant for documentation, and I don't feel that code should be given that kind of treatment.
To see what I see:
- In a Pro project, create a new Notebook
- In the first cell, type import arcpy and run the cell
- In the second cell, type # Not needed at this point
- Press Enter. On the second line of the second cell, type import os
- Mark the second cell as raw and run it. The cell is plain
- In the third cell, type # For future reference
- Press Enter. On the second line of the third cell, type import datetime
- Mark the third cell as markdown and run it. "For future reference" becomes a header, followed by non-monospaced text. The cell looks like it's poor documentation instead of code
- In the Notebook ribbon, click Export > Export as Python File
- Put the file in the project folder and leave the name
- Open File Explorer to your project directory (easily done by clicking the project's name in the application's title bar, and the hyperlinked path from the drop-down menu)
- Open the exported .py file in a text editor such as IDLE, Notepad, or Notepad++
- Notice that the script imports os, even though this is not what was desired
In short, please omit exporting raw cells to the resulting .py file. Thank you.