Skip to main content

runtime_introspect

PyPI Conda Version Supported Python Versions

A small Python library to introspect interpreter features in a couple of portable lines of code. The core functionality is to produce diagnostics for which optional features are (un)available, the state they are in (enabled, disabled, active, or inactive), and why. It utilizes implementation specific APIs to abstract away the pain of writing portable code that runs on any configuration.

Scope and development status

This project is currently in alpha, with a flexible scope; Only CPython interpreter features (Free-threading and JIT) are supported at the moment. However, the library design leaves open the possibility to add support for other Python implementations. If you spot something missing please open a feature request or a pull request, contributions are always welcome !

Installation

python -m pip install runtime-introspect

Usage

Create diagnostics

Here's how to produce a complete diagnostic

from runtime_introspect import runtime_feature_set

fs = runtime_feature_set()
print("\n".join(fs.diagnostics()))

example output:

free-threading: unavailable (this interpreter was built without free-threading support)
JIT: disabled (envvar PYTHON_JIT is unset)

Since runtime-introspect 0.3.0, FeatureSet.snapshot and FeatureSet.diagnostics will also accept a features list to fine-tune exactly which features to inspect and report on.

Inspect specific features

To make code conditional on the availability of a specific feature, use FeatureSet.supports. For instance

from runtime_introspect import runtime_feature_set

fs = runtime_feature_set()
if fs.supports("free-threading"):
    ... # cool multi-threading stuff
else:
    ... # also cool, but single-threaded stuff

As of runtime-introspect 0.4.0, supported feature names include

  • 'free-threading'
  • 'JIT'

Build a pytest header

You can use this library to customize pytest so that test session headers showcase the runtime feature set at startup. For instance

# conftest.py
import sys
import textwrap
from runtime_introspect import runtime_feature_set

# ...

def pytest_report_header(config, start_path) -> list[str]:
    fs = runtime_feature_set()
    if diagnostics := fs.diagnostics():
        return [
            "Runtime optional features state (snapshot):",
            textwrap.indent("\n".join(diagnostics), "  "),
        ]
    else:
        return []

example output (truncated)

===================================== test session starts ======================================
platform darwin -- Python 3.13.6, pytest-8.4.1, pluggy-1.6.0
Runtime optional features state (snapshot):
  free-threading: unavailable (this interpreter was built without free-threading support)
  JIT: undetermined (no introspection API known for Python 3.13)
...

Command Line Interface (CLI) examples

Outputs may (really, should) vary depending on which python interpreter is active and how it was invoked

❯ python3.13 -m runtime_introspect
free-threading: unavailable (this interpreter was built without free-threading support)
JIT: undetermined (no introspection API known for Python 3.13)
❯ PYTHON_JIT=1 python3.14 -m runtime_introspect
free-threading: unavailable (this interpreter was built without free-threading support)
JIT: enabled (by envvar PYTHON_JIT=1)
❯ python3.14t -X gil=0 -m runtime_introspect
free-threading: enabled (forced by command line option -Xgil=0)
JIT: unavailable (this interpreter was built without JIT compilation support)

Run python -m runtime_introspect --help to browse additional options.

Additional resources

Many more details can be inspected with the standard library sysconfig CLI (python -m sysconfig).

Also refer to python-introspection for a similar tool with a different approach and focus.

Metadata

Release files for runtime-introspect 0.4.3

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

Source distribution (sdist)

Source distribution for runtime-introspect 0.4.3
File Size Uploaded
runtime_introspect-0.4.3.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for runtime-introspect 0.4.3
File Interpreter ABI Platform
runtime_introspect-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 45.5 kB

Release files / runtime_introspect-0.4.3.tar.gz

Download URL runtime_introspect-0.4.3.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
698e5db7f4c5f5b990554a93b10d1a3ecfc5319d7280380ee3b4430bcefbeba8
BLAKE2b-256 checksum
How to use checksums
66dad15f2ac384738c6eac8d8235140f2c3da593d39083574ba3f3359a3a8dfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / runtime_introspect-0.4.3-py3-none-any.whl

Download URL runtime_introspect-0.4.3-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9544703caaa9590fdf1ec297b29a6abb79a3ece5ad2f70698e89949ddef6e7f6
BLAKE2b-256 checksum
How to use checksums
a5158995088c18480a20f72e3ba7c4fb0167a829afdfa6b13a3df5cfa48c9f2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

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