Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
PyPI

callgraph 1.0.0

pip install callgraph

Latest version

Released:

This package defines decorators and IPython magic to display a dynamic call graph.

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for oliversteele from gravatar.comoliversteele

Unverified details

These details havenot been verified by PyPI
Project links
Meta
Classifiers

Project description

Latest PyPI VersionDocumentation StatusLicenseSupported Python Versions

Callgraph is a Python package that defines a decorator, and Jupyter magic,to drawdynamic call graphs of Python function calls.

It’s intended for classroom use, but may also be useful for self-guidedexploration.

The package defines a JupyterIPythonmagic,%callgraph, thatdisplays a call graph within a Jupyter cell:

fromfunctoolsimportlru_cache@lru_cache()deflev(a,b):if""in(a,b):returnlen(a)+len(b)candidates=[]ifa[0]==b[0]:candidates.append(lev(a[1:],b[1:]))else:candidates.append(lev(a[1:],b[1:])+1)candidates.append(lev(a,b[1:])+1)candidates.append(lev(a[1:],b)+1)returnmin(candidates)%callgraph-w10lev("big","dog");lev("dig","dog")

image0

It also provides a Python decorator,callgraph.decorator, thatinstruments a function to collect call graph information and render theresult.

Jupyter / IPython Usage

$pipinstallcallgraph

In a Jupyter IPython notebook:

%load_extcallgraphdefnchoosek(n,k):ifk==0:return1ifn==k:return1returnnchoosek(n-1,k-1)+nchoosek(n-1,k)%callgraphnchoosek(4,2)

As an alternative to including%load_ext callgraph in each notebook thatuses%callgraph, you can add the extension to the Notebookconfiguration file in your IPython profile.

Your configuration file is probably called~/.ipython/profile_default/ipython_config.py.(You can runipython profile locate to find it.)Edit this file to include the following line:

c.InteractiveShellApp.extensions = ["callgraph.extension"]

(If your configuration file already includes an uncommented statementc.InteractiveShellApp.extensions = […], edit the list of extensions inthat line to include"callgraph.extension".

Seeextension example notebook for additional examples.

Decorator Usage

$pipinstallcallgraph
fromfunctoolsimportlru_cacheimportcallgraph.decoratorascallgraph@callgraph()@lru_cache()defnchoosek(n,k):ifk==0:return1ifn==k:return1returnnchoosek(n-1,k-1)+nchoosek(n-1,k)nchoosek(5,2)nchoosek.__callgraph__.view()

See theAPI documentation for additional documentation.

See thedecorator example notebook for additional instructions and examples.

Development

Install dev tools, and set up a Jupyter kernel for the current pythonenviromnent:

$pipinstall-rrequirements-dev.txt$python-mipykernelinstall--user

Install locally:

flitinstall--symlink

Acknowledgements

Callgraph uses the Pythongraphviz package. Python graphviz usestheGraphviz package.

License

MIT

Project details

Verified details

These details have beenverified by PyPI
Maintainers
Avatar for oliversteele from gravatar.comoliversteele

Unverified details

These details havenot been verified by PyPI
Project links
Meta
Classifiers

Download files

Download the file for your platform. If you're not sure which to choose, learn more aboutinstalling packages.

Source Distribution

callgraph-1.0.0.tar.gz (55.6 kBview details)

UploadedSource

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more aboutwheel file names.

Copy a direct link to the current filters

callgraph-1.0.0-py3-none-any.whl (15.4 kBview details)

UploadedPython 3

File details

Details for the filecallgraph-1.0.0.tar.gz.

File metadata

  • Download URL:callgraph-1.0.0.tar.gz
  • Upload date:
  • Size: 55.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for callgraph-1.0.0.tar.gz
AlgorithmHash digest
SHA2567bf40a314734a5deff4cb6a1ad71b164dccf66b049dafe69536bea9d80fd4d07
MD5e2ff727b8305d8f4df7036c4e440901c
BLAKE2b-256178c19aa947e7bfe9020c59b07e3ba3a3b39e1f16c54fd32c4bdf2f12d3d6b40

See more details on using hashes here.

File details

Details for the filecallgraph-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for callgraph-1.0.0-py3-none-any.whl
AlgorithmHash digest
SHA25624db0ffa82a1eb037d90d030dacaa9494002a88bb06f4daf81266ebfa564eb2a
MD5d36c500f1eee88dc3f48bb20f755fc89
BLAKE2b-2566a6cbcd23ace79b168d8a6c2436d92c1321704e2fbb2165ef78119c9895d1db7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security SponsorDatadog MonitoringDepot Continuous IntegrationFastly CDNGoogle Download AnalyticsPingdom MonitoringSentry Error loggingStatusPage Status page

[8]ページ先頭

©2009-2025 Movatter.jp