Skip to main content

一个简单的 Python 调试辅助工具包

Project description

debug-tools

一个简单的 Python 调试工具包。

功能特性

  • hello(name) - 返回问候语
  • add(a, b) - 两数相加
  • print_dict(data, level) - 格式化打印字典,支持日志分级

安装

pip install debug-tools

使用示例

from debug_tools import hello, add, print_dict

# 基本功能
print(hello("World"))  # Hello, World!
print(add(1, 2))       # 3

# 打印字典
data = {
    "name": "Alice",
    "age": 30,
    "hobbies": ["reading", "coding"]
}
print_dict(data)

输出:

{
  "name": "Alice",
  "age": 30,
  "hobbies": [
    "reading",
    "coding"
  ]
}

日志分级

print_dict 支持不同的日志级别:

import logging
logging.basicConfig(level=logging.DEBUG)

from debug_tools import print_dict

print_dict({"info": "data"}, level="info")
print_dict({"warning": "msg"}, level="warning")
print_dict({"error": "msg"}, level="error")

本地开发

# 克隆项目
git clone <repository>
cd debug_tools

# 开发模式安装
pip install -e .

# 运行示例
python examples/test.py

# 运行测试
pytest tests/

项目结构

debug_tools/
├── src/
│   └── debug_tools/        # 源代码
│       ├── __init__.py
│       ├── main.py
│       └── print.py
├── tests/                  # 单元测试
├── examples/               # 使用示例
├── docs/                   # 文档
├── scripts/                # 发布脚本
└── pyproject.toml          # 项目配置

文档

要求

  • Python >= 3.9

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debug_helpers-0.3.0.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

debug_helpers-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file debug_helpers-0.3.0.tar.gz.

File metadata

  • Download URL: debug_helpers-0.3.0.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for debug_helpers-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4a92f469c5a2f9492025eec20c28972714a7198e491a7a31738e25d40a2d3435
MD5 f3170cc3d7906a4e643a8c3ec3c384f5
BLAKE2b-256 4849a4031c4c0ae8c5f5c32c8bc73febb63f9315a1156a4c22897c59d9918c0e

See more details on using hashes here.

File details

Details for the file debug_helpers-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: debug_helpers-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for debug_helpers-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cba2430c408e28fb49ac6efa419f559cbed50be5c3528b1887635d6edcf94580
MD5 b55470e67165dd1ab1cd226f6f49e8b3
BLAKE2b-256 72555ee0bd19cbfe969ac89a4234ede147a6e5e9bb64475f9d7742f7800bba2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page