Skip to main content

Voir

Documentation

Voir lets you wrap your scripts to display certain values or metrics and/or analyze their behavior. To use Voir:

  • Add a file named voirfile.py in the current directory.
  • Define one or more instruments in voirfile.py.
  • Run voir script.py instead of python script.py.

Here are a few things you can do:

  • Patch functions and libraries prior to running a script
  • Log CPU or GPU usage
  • Manipulate or log streams of data coming from the script
  • Show a nifty dashboard

Functioning

An instrument is a function defined in voirfile.py that begins with instrument_, or a value in the __instruments__ dictionary of the same file. It takes one argument, the overseer, and its purpose is to do things at various points during execution. In order to do so, it is implemented as a generator function: all it has is to yield one of the overseer's phases, and the overseer will return to the instrument after that phase is finished. The overseer defines the order, so you only need to yield the phases you want to wait for.

def instrument_show_phases(ov):
    yield ov.phases.init
    # Voir has initialized itself. You can add command-line arguments here.

    yield ov.phases.parse_args
    # The command-line arguments have been parsed.

    yield ov.phases.load_script
    # The script has been loaded: its imports have been done, its functions defined,
    # but the top level statements have not been executed. You can perform some
    # manipulations prior to the script running.

    yield ov.phases.run_script
    # The script has finished.

    yield ov.phases.finalize

Voir also logs events in the 3rd file descriptor if it is open, or to the $DATA_FD descriptor. Consequently, if you run voir script.py 3>&1 you should be able to see the list of phases.

Example

This instrument adds a --time command-line argument to Voir. When given, it will calculate the time the script took to load and import its dependencies, and then the time it took to run, and it will print out these times.

def instrument_time(ov):
    yield ov.phases.init

    ov.argparser.add_argument("--time", action="store_true")

    yield ov.phases.parse_args

    if ov.options.time:
        t0 = time.time()
        
        yield ov.phases.load_script
        
        t1 = time.time()
        print(f"Load time: {(t1 - t0) * 1000}ms")
        
        yield ov.phases.run_script
        
        t2 = time.time()
        print(f"Run time: {(t2 - t1) * 1000}ms")

The --time argument goes BEFORE the script, so you would invoke it like this:

voir --time script.py SCRIPT_ARGUMENTS ...

Metadata

Release files for voir 0.2.25

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

Source distribution (sdist)

Source distribution for voir 0.2.25
File Size Uploaded Provenance Actions
voir-0.2.25.tar.gz 104.7 kB With provenance Details for voir-0.2.25.tar.gz

Built distribution (wheel)

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

Total release size: 149.4 kB

Release files / voir-0.2.25.tar.gz

Download URL voir-0.2.25.tar.gz
Size 104.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f3ad287dfea8b1f923e1f51e89a2a8ddaf363edcbafa5bf3c3f9618f9cfaa28f
BLAKE2b-256 checksum
How to use checksums
fe5f8ea852382dfacaa3270bb3e2d9a1c96401fe41857091188b798bc40e604b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Release files / voir-0.2.25-py3-none-any.whl

Download URL voir-0.2.25-py3-none-any.whl
Size 44.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98fbe071d77f319d751c70f59ba669cce8bf721bb16cb39e10727ff990e06a59
BLAKE2b-256 checksum
How to use checksums
780a1ab9a6a693f046165d6c541563c4841506ebbc6e210865e48e2f5999e448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 11, 2026.

Transparency log

Security for voir 0.2.25

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for voir-0.2.25.tar.gz

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 Nov 11, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

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