Skip to main content

TermCap

测试 文档 PyPI

TermCap 是一个 Python 终端录制与渲染工具:把 PTY 会话保存为 asciicast v2,并输出 SVG 动画、静态 SVG 帧或 GIF。

核心能力

  • 交互 shell 与单命令 PTY 录制
  • exec wrapper:运行原命令时自动保存 CAST,并可直接渲染 SVG/GIF
  • 兼容 asciinema 的 .cast 格式
  • ANSI 颜色、光标、文本样式和宽字符渲染
  • 模板化 SVG 动画与 16 套内置主题
  • CAST→SVG、CAST→GIF、SVG→GIF
  • 关键帧确定性采样和 Chrome viewport 自动校正

TermCap 终端录制导出 GIF 示例

查看 SVG · 查看完整生成命令

安装

TermCap 支持 Linux、macOS 和 BSD,需要 Python 3.8 或更高版本。GIF 导出需要 Google Chrome。

python -m pip install termcap
termcap --version

最短工作流

termcap record demo.cast -g 80x20
termcap render demo.cast demo.svg
termcap render demo.cast demo.gif --format gif

录制单条命令:

termcap record tests.cast -g 100x24 -c "python -m pytest -q"

像命令 wrapper 一样执行并录制,同时渲染 SVG:

termcap exec -g 96x16 --media-output hello.svg -- python3 -c 'print("hello")'

已有 SVG 转 GIF:

termcap svg2gif demo.svg demo.gif --speed 1 --loop 0

文档开发

python -m pip install -e '.[dev,docs]'
mkdocs serve
mkdocs build --strict

许可证

MIT License

Download files

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

Source Distribution

termcap-0.2.3.tar.gz (147.1 kB view details)

Uploaded Source

Built Distribution

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

termcap-0.2.3-py3-none-any.whl (153.1 kB view details)

Uploaded Python 3

File details

Details for the file termcap-0.2.3.tar.gz.

File metadata

  • Download URL: termcap-0.2.3.tar.gz
  • Upload date:
  • Size: 147.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for termcap-0.2.3.tar.gz
Algorithm Hash digest
SHA256 23c4dbafa3596c09c9e9454149ec3339b32601b4550965e33d54e5cbc5327e64
MD5 af23aeaece860c09ac98216cc8142e56
BLAKE2b-256 ac5820f0436ac80eb651a5c1e8bf939825e6ab367002d9a8092c131b6b711485

See more details on using hashes here.

Provenance

The following attestation bundles were made for termcap-0.2.3.tar.gz:

Publisher: publish.yml on ChatArch/TermCap

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

File details

Details for the file termcap-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: termcap-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 153.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for termcap-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 83f45c4de5b7bcd0b4e6bf849a507f001d58c1821ec7a14839b91b567566902b
MD5 deae4783dea7d8eab30bc2e993f76cd4
BLAKE2b-256 991167cbcbe23e8ea01dc34cd43a9280258c5d286924767d423c0a7df6fa7e8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for termcap-0.2.3-py3-none-any.whl:

Publisher: publish.yml on ChatArch/TermCap

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

Release history Release notifications | RSS feed

0.2.4

2 files

This release

0.2.3 This release

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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