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 func(a: int, b: int) -> 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.6.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

spoor-0.6.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spoor-0.6.0.tar.gz
  • Upload date:
  • Size: 7.3 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.6.0.tar.gz
Algorithm Hash digest
SHA256 acafc417cae0b7fb21a9b6e272fe367dce1296d450ed222009a1630d47f08459
MD5 711928183217a6faa0d41c6a0bc8cbd4
BLAKE2b-256 73091106a274ef9b74f296e18df1dd1eae0e4ec1d0620b5ed583b10d0995fb62

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spoor-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c89f279748bbf5d8d01b71b676ad88c364bfbfcab0d3bf845b14816da3355bb4
MD5 3fd93b514518c5099927398c663da322
BLAKE2b-256 e6757231818c5d744ce1b0ea4fd15c6a4c297f1f8cc7d49076cae1e40978a6cd

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