Domanda

I am new to IPython Notebook. I am using the Anaconda distribution on CrunchBang (Waldorf). My development cycle is as follows:

1. Open Spyder.
2. Open the .py file if not already loaded
3. Start IPython Notebook
4. Open the specific notebook from the main IPython screen
5. Select Cell/Run All
6. Note errors. If none goto step 11.
7. Save and close the notebook
8. Shutdown the notebook from main IPython screen
9. Correct errors in Spyder and save
10. go to step 4
11. Move on to the next part of the project and start the process over.

Is there a better approach for a noob? This really gets monotonous although I am learning quite a bit.

Thanks in advance

È stato utile?

Soluzione

Forget Spyder for the time being just use the IPython notebook. 1, write code in notebook 2. test it 3. when done if needed make a py file...

You really will only need Spyder later for starting out it just complicates things for no gain

Altri suggerimenti

Use Spyder and .py files for writing big functions, classes, modules, tests, etc.

Use IPython notebooks for interactive work where you want to keep the output together with the code (e.g. data processing and analysis, demos, etc.).


To add to Ian's answer, another useful tool is the autoreload extension, which reloads modules automatically when they are changed.

To use, type into your IPython console or notebook:

%load_ext autoreload
%autoreload 2

For example:

enter image description here

This way you can work on a Python file and an IPython notebook at the same time, without having to reload the Python file after each change.

In addition to @dartdog's answer about developing directly in the notebook, if you must edit .py files used by the notebook then note the reload function which allows you to re-import already imported modules without having to shutdown and reopen the notebook.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top