Kári Gunnarsson
Kári Gunnarsson

Reputation: 98

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?

Upvotes: 0

Views: 1388

Answers (2)

Tom F
Tom F

Reputation: 339

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

Upvotes: 0

Pawan kumar
Pawan kumar

Reputation: 3592

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?

Upvotes: 2

Related Questions