Skip to main content

Live Python function execution tracer with timing and slow function detection

Project description

pytrace-live

A lightweight Python CLI tool that traces function execution in real-time, showing execution times and highlighting slow functions as your code runs.

Installation

pip install pytrace-live

Usage

Basic usage:

pytrace-live script.py

With custom slow threshold (default is 100ms):

pytrace-live script.py --threshold 200

Example Output

→ load_config()              6 ms
→ connect_db()             420 ms  ⚠ SLOW
→ fetch_users()           1310 ms  🚨 VERY SLOW
→ process_data()            45 ms
→ save_results()           180 ms  ⚠ SLOW

Color coding:

  • Green: Normal execution (< threshold)
  • Yellow: Slow (≥ threshold) with ⚠ SLOW marker
  • Red: Very slow (≥ 5× threshold) with 🚨 VERY SLOW marker

Why Use This?

  • Zero code changes: Just run your script through pytrace-live
  • Live feedback: See performance bottlenecks as they happen
  • Minimal overhead: Uses Python's built-in profiling hooks
  • Clean output: Only shows your functions, filters out internal/stdlib calls

Perfect for quick performance checks during development without setting up complex profiling tools.

Requirements

  • Python 3.9 or higher
  • rich (for terminal formatting)

License

MIT License - see LICENSE file for details

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

pytrace_live-0.1.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

pytrace_live-0.1.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file pytrace_live-0.1.2.tar.gz.

File metadata

  • Download URL: pytrace_live-0.1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for pytrace_live-0.1.2.tar.gz
Algorithm Hash digest
SHA256 29c0e19bb2c0931f1756bf3f32401aadd98d535423ed05c7868f16f195f38c94
MD5 cf94e62852068cca114eccd254ec4b88
BLAKE2b-256 ac56bfd5c9c7704f30c4b7f6469eedd671694f37669a7e408a086193ce60c42b

See more details on using hashes here.

File details

Details for the file pytrace_live-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pytrace_live-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for pytrace_live-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e682ae62cd1c1e8f1a761a9205c973f02508ffa8edd19975b6eafb98c56b79a
MD5 095828984d1f92a3b9f62e3d9ae43302
BLAKE2b-256 327c68e8bc4013fdb95a414c3ef52aa0bc0c2a864dde0289208a6fb9ec50b39b

See more details on using hashes here.

Supported by

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