Skip to main content

profilegraph

pypi badge

A line/cell magic for displaying cProfile results in graph form. Like %time or %%time, but with far more information (with the performance penalty you'd expect from cProfile.run).

Inspired by mattijn/gprof2dot_magic.

A trivial profilegraph example.

Install

This package requires Jupyter with a python kernel to be installed. The only other python dependency is gprof2dot, which is used to convert cProfile output to a graphviz-compatible dotfile and is installed by pip automatically, and a graphviz binary, which is used to render the SVG output. You can install graphviz from the provided download link or using the package manager of your choice.

pip install profilegraph

Use

Load the extension in a Jupyter notebook:

%load_ext profilegraph

Profile a line of code by sticking %profilegraph at the start:

import re
%profilegraph re.sub("biz", "baz", "foobarbiz")

Profile result on re.sub

If you have a whole cell that needs to be profiled, you can use the cell magic form:

%%profilegraph
for i in range(10):
    print(i)

Develop

profilegraph uses flit. Install flit with pip install flit.

Install in editable mode with:

flit install [--symlink] [--python path/to/python]

Upload to PyPI with:

flit publish

Metadata

Release files for profilegraph 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for profilegraph 0.2.0
File Size Uploaded
profilegraph-0.2.0.tar.gz 174.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for profilegraph 0.2.0
File Interpreter ABI Platform
profilegraph-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 189.7 kB

Release files / profilegraph-0.2.0.tar.gz

Download URL profilegraph-0.2.0.tar.gz
Size 174.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6df748cbcd93bc0fa8abe1cc805fa4adc5cb7b3dfd79f5607867c2ba62b23496
BLAKE2b-256 checksum
How to use checksums
12c5d8f225575c493b17d1b5c5c528a573e388e2b13e86018fe47e0ff6cf9ecc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.24.0

Release files / profilegraph-0.2.0-py3-none-any.whl

Download URL profilegraph-0.2.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbf507e60e02a583d6154af4a5a1d2df177aa94e0fdf99fb69fa7e53e1ccf2a7
BLAKE2b-256 checksum
How to use checksums
e10efa7aed95e0bd98890d253f507f816135b18da9e804353d71d95d63aea15a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.24.0

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page