Skip to content

jaried/is_debug

Repository files navigation

is_debug

判断当前是否处于调试模式的 Python 工具包。

功能

  • 检测当前 Python 程序是否在调试模式下运行
  • 支持多种调试器检测(pdb、PyCharm、VSCode 等)
  • 简单易用的 API

安装

pip install is_debug

使用方法

from is_debug import is_debug

if is_debug():
    print("当前处于调试模式")
else:
    print("当前不在调试模式")

检测原理

  1. 优先使用 sys.gettrace() 检测调试跟踪函数
  2. 如果标准方法检测为 False,则检查调用栈中是否包含已知的调试器文件

作者

Tony Xiao ([email protected])

许可证

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages