Jupyter-like cell running in ipython
Project description
# ipython-cells
This repo contains the codes for bringing Jupyter-like cell functionality to ipython.
## Example
Suppose we have a .py file with cells separated by user created comments
`example.py`
``` python
# %% cell1
a = 10
# %% cell2
a += 1
print(a)
```
In ipython:
``` python
# load the extension
%run ipython_cells.py
# load example.py with autoreloading enabled
%load_file example.py --autoreload
# simple cell running
%cell_run cell1
%cell_run cell2
11
%cell_run cell2
11
# override variables
%cell_run cell2 a=100
101
# example.py is modified by an external editor (e.g. `a += 1` -> `a += 2`)
# we detect that and automatically reload the cells
%cell_run cell2
103
```
This repo contains the codes for bringing Jupyter-like cell functionality to ipython.
## Example
Suppose we have a .py file with cells separated by user created comments
`example.py`
``` python
# %% cell1
a = 10
# %% cell2
a += 1
print(a)
```
In ipython:
``` python
# load the extension
%run ipython_cells.py
# load example.py with autoreloading enabled
%load_file example.py --autoreload
# simple cell running
%cell_run cell1
%cell_run cell2
11
%cell_run cell2
11
# override variables
%cell_run cell2 a=100
101
# example.py is modified by an external editor (e.g. `a += 1` -> `a += 2`)
# we detect that and automatically reload the cells
%cell_run cell2
103
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ipython_cells-1.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for ipython_cells-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92b34aadeb6b01dfd2d106d72ca7f32254968e75352d5596217554c99852a5db |
|
MD5 | abe5f279068607662842abb78f29c2dd |
|
BLAKE2b-256 | 79e13017f2fcd47d4b8b45c5380e1fd45e05bf95a74450a982c8b7107ea3d0e7 |