Minimally-invasive reproducibility helpers for matplotlib figures.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file refig-0.1.0.tar.gz.
File metadata
- Download URL: refig-0.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0059b5298f003bf672662a6bcb9195398aa0c640face137f5feb205193bb6064
|
|
| MD5 |
96cb459f5ffbdd8f7272bc3fdcc7eb41
|
|
| BLAKE2b-256 |
5d76ac7d0fdef46c4572051ab6a5e6878a71dbf5f4336879d3b14036b445deca
|
File details
Details for the file refig-0.1.0-py3-none-any.whl.
File metadata
- Download URL: refig-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b547ecac1b3646115d1c4e25a52dc18b30ce838b3f879e3a802e805c099c606
|
|
| MD5 |
b5b95fcbe0c3c9928de86dd865763087
|
|
| BLAKE2b-256 |
81085df25f7513eb23d73678ae01df42d256e26e0aace70f18e077fef84c156d
|