Skip to main content

Pyfault

A Python package that provides automatic exception handling and crash reporting to the Memfault platform.

Overview

This package installs a custom exception handler that captures unhandled Python exceptions and sends them to memfaultd, the Memfault Linux observability agent for IOT devices, for crash analysis and debugging.

Features

  • Automatic Exception Handling: Captures all unhandled exceptions in your Python application
  • Rich Traceback Data: Collects detailed traceback information including local variables (filtered to safe types)
  • Non-blocking: Exception reporting doesn't interfere with normal exception handling

Installation

pip install pyfault

Usage

import pyfault

# Initialize with default memfaultd settings (connects to 127.0.0.1:8787)
pyfault.init()

# Or specify a custom memfaultd host
pyfault.init(host="your-memfaultd-host:port")

Once initialized, any unhandled exception in your application will automatically be reported to Memfault while still allowing the normal exception handling to proceed.

How it Works

The package works by:

  1. Installing a custom sys.excepthook that intercepts unhandled exceptions
  2. Extracting traceback information using tblib with safe local variable capture
  3. Packaging the exception data with metadata (Python version, program name, etc.)
  4. Sending the data to the Memfault daemon via HTTP POST to /v1/trace/save
  5. Calling the original exception handler to maintain normal Python behavior

Data Collected

The following information is sent to Memfault:

  • Traceback: Complete stack trace with filtered local variables
  • Python Version: Runtime Python version
  • Exception Type: The type of exception that occurred
  • Program Name: Name of the file where the exception originated

Safety

Local variables are filtered to only include safe primitive types (str, int, float, bool, None) to avoid serialization issues and potential sensitive data exposure.

Changes

[0.1.6]

  • Require certifi >=2026.10.19, which removes the distrusted emudhra root CA certificates.

Metadata

Release files for pyfault 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfault 0.1.6
File Size Uploaded Provenance Actions
pyfault-0.1.6.tar.gz 16.7 kB Without provenance Details for pyfault-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfault 0.1.6
File Interpreter ABI Platform Actions
pyfault-0.1.6-py3-none-any.whl Python 3 none any Details for pyfault-0.1.6-py3-none-any.whl

Total release size: 35.1 kB

Release files / pyfault-0.1.6.tar.gz

Download URL pyfault-0.1.6.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4dcb81de6e45f1c687d094736df1c9e3175845d2af0313493f5655b652d5c2a8
BLAKE2b-256 checksum
How to use checksums
61f2d64ee4d5223c9266887d7721d71b2c71783d32888ed73dbb30cb9b39a822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pyfault-0.1.6-py3-none-any.whl

Download URL pyfault-0.1.6-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c106279ca40faf1b3ba74f5fb0645cb75447affccdb1ff6c84bc756e6100f311
BLAKE2b-256 checksum
How to use checksums
5b42d59050c7bb5366f987d97502f48b804d1ab97fca72f0620adbac94083f20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pyfault 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page