whiteprints.debug_info#

Gather and organize runtime information for the current Python environment.

This module provides functionality to collect comprehensive debug details such as operating system specifics, Python interpreter information, package versioning, and dependency data. It is designed to facilitate troubleshooting by generating a structured snapshot of the environment in which the code is running.

The collected data includes:
  • OS distribution details (e.g., name, version).

  • Python version and platform information.

  • Package versions, including the version of this module.

  • A list of Python paths where modules are searched.

  • Detailed information about runtime dependencies, including their versions and locations when available.

This is useful for debugging issues related to dependency resolution, environment configuration across different systems.

Classes#

PackageInfo

Holds runtime dependency information.

DebugInfo

Holds runtime debug information.

Functions#

gather_debug_info(→ DebugInfo)

Gather detailed runtime debug information of the current environment.

Module Contents#

class whiteprints.debug_info.PackageInfo[source]#

Bases: TypedDict

Holds runtime dependency information.

name: str[source]#
version: str[source]#
origin: NotRequired[pathlib.Path][source]#
class whiteprints.debug_info.DebugInfo[source]#

Bases: TypedDict

Holds runtime debug information.

operating_system: distro.distro.InfoDict[source]#
platform: str[source]#
python_version: str[source]#
python_executable: pathlib.Path[source]#
package_version: str[source]#
pythonpath: list[pathlib.Path][source]#
dependencies: list[PackageInfo][source]#
whiteprints.debug_info.gather_debug_info() DebugInfo[source]#

Gather detailed runtime debug information of the current environment.

This function collects information about the operating system, the Python environment, package versions, and dependencies. It retrieves details such as the OS distribution, Python version, platform information, and the version of the executing package. Additionally, it includes the Python path and information about runtime dependencies, including their names, versions, and locations (if available).

Returns:

A dictionary containing:
  • operating_system: Details about the current OS distribution including name, version, and ID.

  • platform: A string representing the underlying platform, e.g., ‘Linux-5.15.0-76-generic-x86_64-with-glibc2.31’.

  • python_version: The full version string of the Python interpreter being used, e.g., ‘3.12.0’.

  • package_version: The version of the whiteprints package.

  • pythonpath: A list of paths where Python searches for modules.

  • dependencies: A list of dictionaries where each entry represents a runtime dependency with its name, version, and, if available, the path to the module’s origin file.

Return type:

DebugInfo