Skip to main content

Cute Python traceback beautifier with multilingual support

Project description

Kawaii Traceback

PyPI Version Python Versions License

一个可爱的Python异常美化工具,提供更友好的错误提示和多语言支持

✨ 特性

  • 可爱的异常输出格式
  • 智能错误建议(拼写检查、导入提示、Traceback简化等)及可扩展性
  • 高度的多语言可扩展性
  • 高度可定制的提示信息(甚至可以对自定义场景自定义提示)
  • 兼容标准Python traceback模块

📦 安装

pip install kawaii-traceback

🚀 快速开始

import kawaiitb.autoload  # noqa

# 现在所有异常都会以可爱的方式显示
1 / 0

🌍 多语言支持

“语言”实际上是广义语言的扩展,你可以通过自定义新的语言来自定义提示的风格

# 加载中文提示
import kawaiitb

kawaiitb.load('zh_hans')

# 或者加载猫娘版提示
kawaiitb.load('neko_zh')

🛠 配置

创建 mytb.json 配置文件:

{
  "translate_keys": {
    "my_neko": {
      "extend": "zh_hans",
      "native.ZeroDivisionError.msg": "{divisor}变成零了喵!不能除以零喵不能除以零喵!",
      "native.AttributeError.premsg": "{type_} 类型的 '{obj}' 没有属性 '{name}' 喵!"
    }
  },
  "default_lang": "my_neko"
}

然后使用 kawaiitb.load(file='mytb.json') 加载配置。

🤝 贡献

欢迎提交Issue和PR!请确保:

  1. 开发新功能前请先创建Issue
  2. 代码需与已有风格一致
  3. 添加相应的测试用例

📜 许可证

本项目基于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

kawaii_traceback-0.3.2.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

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

kawaii_traceback-0.3.2-py3-none-any.whl (57.2 kB view details)

Uploaded Python 3

File details

Details for the file kawaii_traceback-0.3.2.tar.gz.

File metadata

  • Download URL: kawaii_traceback-0.3.2.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kawaii_traceback-0.3.2.tar.gz
Algorithm Hash digest
SHA256 133738a338c2c996ed3e2b769c398e7f7b3f1fbfa36ecab2b84fec1df0ffbcea
MD5 d9fc075fb46c0367f2dac15ee6bdf5f8
BLAKE2b-256 0e6314316a6b27f3820dbcd9aa3e01e914035aba77f88c2134f565be6bc03660

See more details on using hashes here.

Provenance

The following attestation bundles were made for kawaii_traceback-0.3.2.tar.gz:

Publisher: publish.yml on BPuffer/kawaii-traceback

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kawaii_traceback-0.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for kawaii_traceback-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8932cc446fbfcd47e3331754ff3baca0af4c629dc87b40ccdba20f19dea9d299
MD5 b71716cfff30362df21cc416fb1a51fd
BLAKE2b-256 e8cb3ed47a3e9c0c73f7169b2e8a64910a4c1e745b3e2ba96e50ad52fdde815d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kawaii_traceback-0.3.2-py3-none-any.whl:

Publisher: publish.yml on BPuffer/kawaii-traceback

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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