refig is a Python library for minimally-invasive reproducibility in Jupyter notebooks, with a focus on figures and plots.
Installation
You can install refig using pip:
pip install refig
uv add refig
Usage
To use refig, simply import it in your Jupyter notebook:
from refig import refig
Then use refig.savefig(NAME) instead of matplotlib.pyplot.savefig(PATH) to save your figures with embedded metadata. NAME can end in .png or .svg.
When you save a figure, refig will automatically save the figure along with a steganographic pointer to the code that generated it, including (all optionally),
- The notebook / file that generated the figure
- The cell number (if applicable / available)
- The date and time the figure was generated
- The git commit hash (if applicable / available)
- The installed
refigpackage version
You can view these metadata by loading the figure with refig:
uv run refig meta figure.png
uv run refig meta figure.svg
Figure Saving Paths
By default, refig saves figures in a figures/ directory. There are several subdirectories:
figures/latest/: Contains the most recently generated version of each figure.figures/history/: Contains all historical versions of generated figures, sorted by timestamp and git commit hash.
For example,
figures/
latest/
figure1.png
figure2.png
history/
figure1/
_20250101_abcdef.png
_20250201_bcdefa.png
figure2/
_20250115_cdefab.png
Metadata
Release files for refig 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| refig-0.1.0.tar.gz | 6.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| refig-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / refig-0.1.0.tar.gz
| Download URL | refig-0.1.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0059b5298f003bf672662a6bcb9195398aa0c640face137f5feb205193bb6064
|
|
BLAKE2b-256 checksum How to use checksums |
5d76ac7d0fdef46c4572051ab6a5e6878a71dbf5f4336879d3b14036b445deca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / refig-0.1.0-py3-none-any.whl
| Download URL | refig-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4b547ecac1b3646115d1c4e25a52dc18b30ce838b3f879e3a802e805c099c606
|
|
BLAKE2b-256 checksum How to use checksums |
81085df25f7513eb23d73678ae01df42d256e26e0aace70f18e077fef84c156d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|