• Stars
    star
    139
  • Rank 262,954 (Top 6 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created about 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Defines a %%cache cell magic in the IPython notebook to cache results of long-lasting computations in a persistent pickle file

ipycache

Build Status Latest PyPI version

Defines a %%cache cell magic in the IPython notebook to cache results and outputs of long-lasting computations in a persistent pickle file. Useful when some computations in a notebook are long and you want to easily save the results in a file.

Examples

Installation

Latest PyPI release:

pip install ipycache

Latest development version:

pip install git+https://github.com/rossant/ipycache.git

Usage

In IPython, execute the following:

%load_ext ipycache

Then, create a cell with:

%%cache mycache.pkl var1 var2
var1 = 1
var2 = 2

When you execute this cell the first time, the code is executed, and the variables var1 and var2 are saved in mycache.pkl in the current directory along with the outputs. Rich display outputs are only saved if you use the development version of IPython. When you execute this cell again, the code is skipped, the variables are loaded from the file and injected into the namespace, and the outputs are restored in the notebook.

Alternatively use $file_name instead of mycache.pkl, where file_name is a variable holding the path to the file used for caching.

Use the --force or -f option to force the cell's execution and overwrite the file.

Use the --read or -r option to prevent the cell's execution and always load the variables from the cache. An exception is raised if the file does not exist.

Use the --cachedir or -d option to specify the cache directory. You can specify a default directory in the IPython configuration file in your profile (typically in ~\.ipython\profile_default\ipython_config.py) by adding the following line:

c.CacheMagics.cachedir = "/path/to/mycache"

If both a default cache directory and the --cachedir option are given, the latter is used.

More Repositories

1

awesome-math

A curated list of awesome mathematics resources
Python
7,684
star
2

ipymd

Use the IPython notebook as an interactive Markdown editor
Python
479
star
3

ipython-minibook

UPDATE (2015): This is an old repo, go here for the new edition
Python
203
star
4

awesome-scientific-python

A curated list of awesome scientific Python resources
Python
194
star
5

galry

[deprecated] High-performance interactive visualization in Python
Python
187
star
6

smopy

OpenStreetMap image tiles in Python
Python
161
star
7

playdoh

UNMAINTAINED - USE AT YOUR OWN RISKS
Python
67
star
8

euroscipy2014

IPython advanced tutorial: introducing the interactive features of the IPython Notebook
43
star
9

h5view

Command-line tool in Python to explore a HDF5 file
Python
19
star
10

programming-yin-yang

A list of antonyms commonly used in programming
12
star
11

datagit

Random notes about data science workflows with Python, git, and the Jupyter notebook
7
star
12

rossant.github.io

HTML
6
star
13

phd-thesis-template

LaTeX template for a thesis
TeX
6
star
14

qtools

Some Python tools for Qt
Python
5
star
15

pipo

CLI helper for setuptools
Python
4
star
16

website

JavaScript
2
star
17

spiky

THIS REPOSITORY IS OUTDATED, the new one is:
Python
2
star
18

mdconvert

Convert Markdown documents in HTML, LaTeX and PDF
Python
2
star
19

collatepdf

A simple Python script to collate multiple PDFs into a single PDF.
Python
2
star
20

eye

Python
1
star
21

kwiklib2

1
star
22

odt-linux-mag

GitHub repository superseding the gist https://gist.github.com/rossant/99a2316465c84192b630
Python
1
star
23

yam

Command-line remote controller for Yamaha AV network systems
Python
1
star
24

rust-emscripten-passes

LLVM passes for compiling Rust code with Emscripten
C++
1
star
25

easy_profiler

Easy-to-use profiler in Python
Python
1
star
26

synthesizer

Python
1
star
27

brian-modelfitting-tutorial

Python
1
star