'Can you edit normal .py scripts interactively in jupyterlab?
I'm thinking similar to atom with the hydrogen plugin?
When doing data science in Python I tend to get stuck in a "first create it in jupyter notebook, then re-create it in an actual python script so we can go into production". Using Atom i've been able to just create the code directly in a python script, but still have the great interactive features of jupyter.
I was really hoping that jupyterlab would be similar, but as far as i can tell, you only get the interactive features in the python notebooks and not in python scripts?
Solution 1:[1]
To write/save
%%writefile myfile.py
write/save cell contents into myfile.py (use -a to append). Another alias: %%file myfile.py
To run
%run myfile.py
run myfile.py and output results in the current cell
To load/import
%load myfile.py
load "import" myfile.py into the current cell
For more magic and help
%lsmagic
list all the other cool cell magic commands.
%COMMAND-NAME?
for help on how to use a certain command. i.e. %run?
Solution 2:[2]
You might like using the Spyder IDE for this. You can use it to edit and execute jupyter notebooks and python scripts: https://docs.spyder-ide.org/current/plugins/notebook.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pawan kumar |
| Solution 2 | Tom F |
