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:
%pip install sidepng
Load the extension once per kernel:
%load_ext sidepng
Then prepend a cell magic to the code you want to export:
%%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:
from sidepng import sidepng_export
sidepng_export("result.png")
- Captures text, errors, rich display, and inline raster plots. Use
%matplotlib inlinewhen 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
--archiveflag 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 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.
Metadata
Release files for sidepng 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 | Provenance | Actions |
|---|---|---|---|---|
| sidepng-0.1.0.tar.gz | 10.7 kB | With provenance | Details for sidepng-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sidepng-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sidepng-0.1.0-py3-none-any.whl |
Total release size: 21.3 kB
Release files / sidepng-0.1.0.tar.gz
| Download URL | sidepng-0.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58e145731f17db8e4a5e6fa62456510086a4b0499f89849d3edf6147a13b485d
|
|
BLAKE2b-256 checksum How to use checksums |
5a1de4de0249ae1688656033fa35f4dc9e631cbdcc2eba28fa9d3fdf49e70c0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logRelease files / sidepng-0.1.0-py3-none-any.whl
| Download URL | sidepng-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
928b17ee2afea57604304064181dd3128ccd247e27d5d6651ab8eeec42a34f07
|
|
BLAKE2b-256 checksum How to use checksums |
df7e99888f70d5536a62768392ddb3d208d3aa45d672fd63fcb0a0e529e42075
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logSecurity for sidepng 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sidepng-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.