Skip to main content

tqdm progress bar + silly animations (chicken playing basketball / runner / rocket) to make long waits less boring

Project description

funny-tqdm

tqdm 进度条 + 沙雕动画(坤坤打篮球 / 跑步 / 火箭 / spinner),让漫长的等待不那么无聊。

  • 动画播放在进度条后缀位,自带耗时 / ETA(tqdm 原生)
  • 只写 stderr,不污染 stdout(对 stdio 协议如 MCP 安全)
  • 非 TTY 环境(重定向 / 日志管道)自动完全静默
  • 终端不支持 UTF-8 时自动从 emoji 降级为 ASCII 帧

安装

pip install funny-tqdm

用法

from funny_tqdm import FunProgress

# 确定总量: 进度条 + 百分比 + 耗时/ETA + 动画
with FunProgress(total=len(items), desc="下载板块K线") as p:
    for item in items:
        do_something(item)
        p.update()

# 不确定总量: 只显示 描述 + 耗时 + 动画
with FunProgress(desc="下载全市场行情..."):
    fetch_everything()

# 换动画
with FunProgress(total=100, desc="跑步前进", animation="runner") as p:
    ...

# tqdm 风格的可迭代入口
from funny_tqdm import funny_tqdm
for item in funny_tqdm(items, desc="处理数据", animation="rocket"):
    do_something(item)

# 注册自定义动画(单行帧;big_frames 可选)
from funny_tqdm import register_animation
register_animation("wave", ["/o/", "\\o\\", "|o|"])

内置动画

名称 内容
chicken(默认) 坤坤打篮球:运球 → 起球 → 铁山靠 → 鸡你太美
runner 往返奔跑的小人
rocket 火箭推进
spinner 经典转圈(UTF-8 为盲文点阵,降级为 `
from funny_tqdm import available_animations
print(available_animations())

API

FunProgress(total=None, desc="", animation=None, file=None, enabled=None, fps=8)
参数 说明
total 总步数;None 为不确定模式(无百分比,只显示耗时+动画)
desc 进度条前缀描述
animation 动画名,默认 chicken
file 输出流,默认 sys.stderr
enabled None=自动(仅 TTY 启用);True=强制;False=静默
fps 动画帧率,默认 8

方法:update(n=1) / set_description(desc) / close(),支持 with 上下文。

License

MIT

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

funny_tqdm-0.3.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

funny_tqdm-0.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: funny_tqdm-0.3.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for funny_tqdm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f6a06cc8f9829cfacdfeb6b45d6e6011b26df987f91d8b696d5ff706b46a7eae
MD5 ae5ba25fd2671f3a8c969ed11c32621e
BLAKE2b-256 f373880c71b85c425589792b25aa35ee8b887bb9ad9d979c69af15a27b61b5e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: funny_tqdm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.7

File hashes

Hashes for funny_tqdm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6215629c578e8e5971eb4fb34211153d069070d4664b9fcb3af2c5e1d6d88df7
MD5 d87dc7c03acbba263c91a7c1fed4d3d9
BLAKE2b-256 8c5eee06e0a642a4b2f8d73654b516c9fbd73831ee70fbea1c6fd20c9c405a45

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