python / python/cpython

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

Đang mở
#154,335 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

stdlib topic-profiling type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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
  • gh-154344

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu từ entry point python -m profiling.sampling run --pstats test.py và kiểm tra helper xử lý màu trong Lib/_colorize.py. Xác minh rằng bộ thu thập pstats tôn trọng NO_COLOR=1 và đầu ra được chuyển hướng không chứa các chuỗi escape ANSI.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
devtools
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.