Skip to main content

Track functions invocations

Project description

spoor

Tests PyPI PyPI - Python Version

pre-commit Code style: black EditorConfig semantic-release: angular

Track invocation of your functions and methods; display collected statistics for the invocations; export data gathered to external services.

$ pip install spoor

Usage

from spoor import Spoor

s = Spoor()

@s.track
def function(a: int, b: int):
  return a + b

func(5, 10)
func(23, 42)

assert s.called(func)
assert s.call_count(func) == 2

Configuration

Option Type Default Description
attach bool False Expose called/call_count attributes directly on a function/method object.
distinct_instances bool False Separate metrics collection for each instance of a class. Has no effect if tracking only functions.
skip_dunder bool True Do not track double underscore method calls (like __str__) for class instances. Has no effect if tracking only functions.
disabled bool False Initialize as inactive and ignore metrics collection until enabled explicitly. Can be controlled via enable()/disable() methods later.

Exporters

See also

  • 🍒 podmena for nice commits emoji
  • 🌈 rich for beautiful terminal output
  • 🇺🇦 United 24 to support Ukraine in the war

Project details


Download files

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

Source Distribution

spoor-0.5.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

spoor-0.5.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file spoor-0.5.0.tar.gz.

File metadata

  • Download URL: spoor-0.5.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.6 Linux/5.15.0-1024-azure

File hashes

Hashes for spoor-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5686bc8d8281a971329f6f9d977b73a486496ab396cdeeecd81244f6b0e829ac
MD5 2e0a8a5a66b00865bc7e549321d1e3f1
BLAKE2b-256 28e5f3dfdc6fd14ade81cfe50c1334fa24e781226fe7544432130acefd9bd2c6

See more details on using hashes here.

File details

Details for the file spoor-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: spoor-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.1 CPython/3.10.6 Linux/5.15.0-1024-azure

File hashes

Hashes for spoor-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a800cc10cc2c1e42aed19f567ab3e69806a9db55fa7e1b3ff3529136880085ef
MD5 c7a8a9f6a0e543803b0b710f1512ff3a
BLAKE2b-256 69727d3a4032d88dd2b455a6efd1acc84d636a985c727962b3f45a9ec44efa93

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page