Metadata-Version: 2.4
Name: sidepng
Version: 0.1.0
Summary: Export Jupyter cell code and outputs side by side in one PNG
Keywords: jupyter,ipython,notebook,png,cell-magic
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: IPython
Classifier: Framework :: Jupyter
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: IPython>=8
Requires-Dist: Pillow>=10
Provides-Extra: widgets
Requires-Dist: ipywidgets>=8; extra == "widgets"

# sidepng

An IPython extension that puts numbered Python code on the left and cell output on the right of a single PNG. Rendering runs locally in the active kernel.

In a Jupyter Notebook or JupyterLab kernel:

```python
%pip install sidepng
```

Load the extension once per kernel:

```python
%load_ext sidepng
```

Then prepend a cell magic to the code you want to export:

```python
%%sp result.png
print("Hello from sidepng")
```

`%%sidepng` is an alias. Static outputs show a PNG preview. To save it, install the optional widget extra (`%pip install "sidepng[widgets]"`) and click **导出 PNG**. Without widgets, run this in a separate cell:

```python
from sidepng import sidepng_export
sidepng_export("result.png")
```

- Captures text, errors, rich display, and inline raster plots. Use `%matplotlib inline` when plotting with Matplotlib.
- Live widgets remain interactive in the notebook. Export includes supported widget values and outputs already synchronized to the kernel. PNG does not preserve interaction, browser-only state, animation, web layout, or media playback. Unsupported outputs are labeled; an SVG-only display uses a static fallback.
- Saved images include the cell source and output. Review them before sharing. The optional `--archive` flag additionally embeds captured raw MIME data in the PNG and is **off by default**.
- The package itself does not download resources or upload your notebook or PNG. Your own notebook code, dependencies, and live frontend outputs can have their own behavior.

## 中文速用

每次新开内核运行一次 `%load_ext sidepng`。要合图的代码格第一行写 `%%sp 结果.png`。静态内容会直接预览；控件保留在 Notebook 里，点「导出 PNG」可保存当时已同步的数值和静态结果。按钮需要 `ipywidgets`，也可以用上面的函数手动保存。

## Maintainer release

Run **Release** in GitHub Actions on `main` with `publish` unchecked to build and smoke-test. Configure a pending [PyPI Trusted Publisher](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/) for project `sidepng`, workflow `release.yml`, environment `pypi`, and this repository. Then run the same workflow with `publish` checked. The build job has no publishing credentials; only the separate publish job can request an OIDC token.
