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.
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.4.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

spoor-0.4.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spoor-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 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.4.0.tar.gz
Algorithm Hash digest
SHA256 bf8ec8334fddce1a34d0b2ffad2eebc70ea2f2e7cda996f15a917c39e99661df
MD5 368f3ca932760ecdfa7d55edf7051241
BLAKE2b-256 191d39510d4f32264cc43db5e060a182fef420936ff7dfd4be406bb858402143

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spoor-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c138ecb5cdb13c7f4b14485e4f4284233c78eb56e0ab5ff916b2c7e1a5456617
MD5 eda528a72130a74d2490e43591e6f757
BLAKE2b-256 4223e929160d3a200a2b91ea88c9d36670e496dcc63e01762502b191d69b1151

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