Skip to content

Tachyon's pstats_collector does not respect "no-color" modes #154335

Description

@pfackeldey

Bug report

Bug description:

The Tachyon sampling profiler always emits colored output when used with the pstats collector. For example, the NO_COLOR environment variable is currently not respected:

NO_COLOR=1 python -m profiling.sampling run --pstats test.py

Enabling this would be useful e.g. in cases where the output is redirected into a file for further processing, as it avoids including ANSI escape sequences in the file.

There is already a helper function available in the project that could be used to enable this functionality:
https://github.com/python/cpython/blob/main/Lib/_colorize.py#L564-L605

If you think this would be a useful addition/fix, I'd be happy to work on a patch PR.

Best, Peter

CPython versions tested on:

3.15

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions