English | 简体中文
🐍 PyKuai (v1.2.7) — Open-Source CS & Developer Script Toolbox
An open-source, modular CLI & TUI script toolbox built for Computer Science workflows, developer utilities, and community sharing.
"The Lord is my shepherd." — Author: TuKuai (GallantTarry)
🌟 Overview & Design Philosophy
PyKuai (from Chinese "Kuai", meaning fast) is an open-source micro-kernel + drop-in 3-letter plugin toolbox built for Computer Science students, engineers, and Python developers. Rather than leaving handy automation scripts buried in scattered local folders, PyKuai gives them a unified terminal runtime so anyone can install and use them out of the box—or drop in standard three-letter .py engines to share with the community:
- Zero-Config Micro-Kernel: Drop any compliant three-letter lowercase
.pymodule (^[a-z]{3}$) implementingBaseEngineintopykuai/engines/. PyKuai automatically discovers it and wires it into the Tool Tray (tt), CLI subcommand router, and dependency scanner (pp) with zero boilerplate. - Two-Tier Command Ergonomics:
- Doubled 2-letter global commands (
tt,pp,vv,cc,hh,gg) deliver instant muscle-memory navigation across the REPL console. - 3-letter tool engines (
ifc,ytd, ...) keep every utility isolated behind clean, collision-free namespaces.
- Doubled 2-letter global commands (
- Dual-Mode Execution & In-App Guides: Run every engine either interactively through mouse-clickable Rich / Textual Cyber-Dark Studios (press
?orF1, or click?in the top-right corner, for a full in-app feature guide) or headlessly via direct CLI flags in automation scripts. - Cyber-Dark Tactile Experience: Features an ASCII banner, an optional high-DPI desktop pixel-snake launch sequence (
--fastto skip), Windows Terminal title/icon protection, drag-and-drop image routing, and toggleable retro CC0 arcade sound effects persisted in~/.pykuai/settings.json.
📁 Repository Architecture
pykuai/
├── .github/
│ └── workflows/
│ └── publish.yml # GitHub Actions Trusted Publishing workflow for PyPI
├── pyproject.toml # Package metadata, optional extras & pykuai CLI entrypoint
├── README.md # English documentation (GitHub homepage & PyPI)
├── README.zh-CN.md # Chinese documentation (简体中文详细说明文档)
├── .gitignore # Git ignore rules (caches, builds, heavy binaries & temp outputs)
├── .backup_engines/ # Historical archive of 10 pre-refactor scripts (not loaded at runtime)
└── pykuai/ # Core Python package
├── __init__.py # Version (1.2.7) & author metadata
├── __main__.py # python -m pykuai module entrypoint
├── cli.py # Main dispatcher (interactive REPL & direct CLI modes)
├── core/ # Micro-kernel infrastructure
│ ├── __init__.py # Core package marker
│ ├── audio.py # Non-blocking CC0 retro SFX player & persistent settings
│ ├── base.py # Abstract BaseEngine plugin contract
│ ├── deps.py # Dependency scanner & visual/CLI installer (pp)
│ ├── intro.py # High-DPI pixel-snake desktop launch intro (snake.wav)
│ ├── registry.py # Auto-discovery registry for 3-letter engine modules
│ ├── tools.py # Binary toolchain resolver & verified Windows FFmpeg installer
│ ├── tray.py # Interactive Tool Tray & subcommand dispatcher (tt)
│ ├── tui.py # Textual Cyber-Dark widgets, help modal (?/F1) & SFX hooks
│ ├── ui.py # Rich Cyber-Dark theme, ASCII banner, greeting & console hooks
│ ├── watchdog.py # Windows Terminal settings.json guard & exit cleanup
│ └── yt_auth.py # Isolated Chromium YouTube sign-in helper -> ~/.pykuai/cookies.txt
├── engines/ # Plug-and-play 3-letter tool engines
│ ├── __init__.py # Engines package marker
│ ├── ifc.py # ifc: Image Format Converter & multi-resolution ICO packer
│ └── ytd.py # ytd: YouTube & media downloader (yt-dlp + FFmpeg)
├── assets/ # Visual & audio assets
│ ├── icon.ico # High-DPI multi-resolution application icon
│ └── sfx/ # Retro CC0 sound effects
│ ├── click.wav # Button click SFX
│ ├── enter.wav # Command / dialog submit SFX
│ ├── key.wav # Keyboard typing & backspace SFX
│ ├── paste.wav # Clipboard paste & file drop SFX
│ ├── snake.wav # Launch pixel-snake hiss SFX
│ └── type.wav # Pixel-telegraph greeting SFX
└── tools/ # Lightweight portable Windows binaries & pixel font
├── yt-dlp.exe # Standalone stream extractor binary (2026.10.26)
├── UnRAR.exe # RAR extraction utility (7.30 beta 2)
└── zpix.ttf # Recommended pixel-style terminal font
# (ffmpeg/ffprobe resolved from PATH or auto-installed to ~/.pykuai/tools/)
Module Breakdown
-
Root Configuration, CI & Archive
- pyproject.toml: Defines package metadata (
1.2.7, Python>=3.9), core dependencies (rich,textual,openpyxl,Pillow,pypdf), optional extras (office,media,cv,archive,ui,all), package data (tools/*,assets/*,assets/sfx/*), and thepykuaiconsole entrypoint. - .github/workflows/publish.yml: Passwordless PyPI Trusted Publishing pipeline (OIDC) triggered on
v*/pykuaiv*tags or manualworkflow_dispatch. - .backup_engines/: Reference archive of 10 pre-refactor standalone scripts (
archive.py,excel_merge.py,excel_split.py,img_compress.py,media_fetch.py,office_fixed.py,pdf_split.py,scanner.py,video_compress.py,web_sniffer.py). Never loaded byregistry.py.
- pyproject.toml: Defines package metadata (
-
Micro-Kernel (
pykuai/core/)- cli.py & tray.py: Routes bare
pykuailaunches into the interactive REPL (with live keystroke, cursor, history, clipboard paste burst SFX, and automatic drag-and-drop image launch forifc), or routespykuai tt <tool> [args]directly to the target engine.ttincludes a?/F1guide modal and bottom-right🔊 SFX ON / 🔇 SFX OFFtoggle. - base.py & registry.py: Defines the
BaseEngineinterface (includinghelp_textandlaunch_with_path) and automatically registers valid 3-letter.pyplugins underpykuai/engines/. - tui.py, ui.py & audio.py: Provides the Cyber-Dark Rich theme, pixel-telegraph greeting, reusable Textual widgets (
PyKuaiStudioApp,StudioHeader,HelpChip,HelpModalScreen,ToggleChip,ActionChip,SfxToggleChip,pick_multi,pick_one), non-blocking CC0 WAV SFX playback, and persistent~/.pykuai/settings.json. - deps.py: Powers
pp, auditing declared enginerequiresand AST imports against the active Python environment with clickable selection or CLI--check/-y/--all/-Umodes. - tools.py & yt_auth.py: Resolves external tools (
ffmpeg,ffprobe,yt-dlp,UnRAR, Node/Deno JS runtimes) across bundledtools/, systemPATH, and~/.pykuai/tools/, downloads & SHA256-verifies WindowsFFmpeg/FFprobeessentials on demand (urllib+curl/direct fallback), and drives the extension-free isolated browser YouTube login flow (~/.pykuai/yt-session→~/.pykuai/cookies.txt). - intro.py & watchdog.py: Plays the high-DPI desktop pixel-snake launch animation (
snake.wav) and safely restores Windows Terminal title/icon state on exit.
- cli.py & tray.py: Routes bare
-
Built-In Engines (
pykuai/engines/)
🧰 Built-In Engines & Key Features
1. ifc — Image Format Converter
- Formats: Exports to
ICO,PNG,JPG,WEBP,BMP,GIF,TIFF, andAVIF; reads broader sources includingJPEG,TIF,ICNS,TGA,PPM,DDS, andPSD. - Smart Image Pipeline: Automatically normalizes EXIF orientation, extracts the highest-resolution layer from
ICO/ICNSor first frame of animated images, flattens transparent pixels onto solid white when targetingJPG/BMP, and performs atomic temp-file writes to prevent half-written files or accidental self-overwrite. - Multi-Resolution
.icoPackaging: Toggle any combination of sizes from8to256px (Std,All,Webpresets), pads non-square images cleanly onto a transparent square canvas, and applies subtleUnsharpMasksharpening on tiny layers (<= 32px, toggleable or--no-sharpen). - Lossy Quality Control: Studio chips (
80%/90%/92%/95%/100%) or CLI-q 1..100(default92) forJPG,WEBP, andAVIF.
2. ytd — YouTube & Media Downloader
- Profiles & Aliases:
best(Auto-muxed MP4),1080p,720p,mp3(--audio-quality 0), andm4a(CLI aliases:video/mp4→best,audio→mp3). - Scope, Subtitles & Probing: Switch cleanly between
Single(--no-playlist, even with&list=) andPlaylist(--yes-playlist), download & embed English/Chinese captions (--subs), or inspect all available streams without downloading (-F/Formats). - Extension-Free
Login YouTube(--login): Windows Chrome/Edge (127+) locks its cookie DB (yt-dlp #7271) and enforces App-Bound Encryption (#10927). ClickLogin YouTubein Studio (or runpykuai tt ytd --login) to sign in inside an isolated browser profile (~/.pykuai/yt-session)—PyKuai captures the authenticated session automatically into~/.pykuai/cookies.txtwithout touching your personal browser or needing third-party extensions. Interactive downloads hitting YouTube's sign-in gate also offer to open this login flow and retry immediately. - Smart Resilience & On-Demand FFmpeg: Automatically wires
ejs:githubchallenge solving when Node/Deno is installed, prefers bundledyt-dlp.exewhen Pythonyt-dlplackscurl_cffi, auto-detectscookies.txtacross save/working dirs,~/.pykuai/cookies.txt, and~/Downloads, and prompts to install SHA256-verified Windows FFmpeg/FFprobe binaries into~/.pykuai/tools/(--install-ffmpeg) whenever missing.
🚀 Dual-Mode Usage & Global Commands
1. Interactive Console Mode (REPL)
Launch the workbench from any terminal:
pykuai
# Skip the pixel-snake launch intro (also supports --no-intro or -f):
pykuai --fast
Inside the console, use the 6 doubled-letter global commands (or press ? / F1 inside any visual Studio for its built-in guide):
| Command | Meaning | Description |
|---|---|---|
tt |
Tool Tray | Open the interactive Tool Tray (with bottom-right SFX toggle), or run tt <tool> [args] |
pp |
Pull Packages | Audit and install/upgrade plugin dependencies (pp --check / pp -y / pp -U) |
vv |
View Version | Display version (v1.2.7), author signature, and open-source audio credits |
cc |
Clear Console | Clear the screen and redraw the Cyber-Dark banner |
hh |
Help Hub | Show the global command quick-reference table |
gg |
Good Game | Exit cleanly and restore the original terminal title and icon |
💡 Pro Tip: Dragging or pasting an image file path straight into the REPL prompt automatically opens
ifcpre-loaded with that image.
2. Direct CLI Mode
Run tools headlessly or script them in pipelines without entering the REPL:
# Open interactive Tool Tray (prints a summary table when piped/non-TTY)
pykuai tt
# Image format conversion & multi-layer .ico generation (ifc)
pykuai tt ifc logo.png -t webp -q 90
pykuai tt ifc logo.png -t ico -s 16,32,48,256 -o app.ico
# YouTube & media download, stream probing, login & FFmpeg setup (ytd)
pykuai tt ytd "https://www.youtube.com/watch?v=..." -f best
pykuai tt ytd "https://www.youtube.com/watch?v=..." -f mp3 --subs -o ./music
pykuai tt ytd "https://www.youtube.com/watch?v=..." -F
pykuai tt ytd --login
pykuai tt ytd --install-ffmpeg
# Audit, install, or upgrade dependencies (pp)
pykuai pp --check
pykuai pp -y
pykuai pp -y --all -U
# Help & version
pykuai hh
pykuai --version
🛠️ Installation & Development Setup
Install directly from PyPI or in editable mode from source:
# Core workbench from PyPI
pip install pykuai
# With optional media download tools or full extras
pip install "pykuai[media]"
pip install "pykuai[all]"
# Local editable install for development
git clone https://github.com/GallantTarry/pykuai.git
cd pykuai
pip install -e .
pip install -e ".[all]"
Once installed, launch from anywhere using pykuai or python -m pykuai.
Note on External Binaries: Git and PyPI distributions stay lightweight (~30 MiB) by bundling
yt-dlp.exe,UnRAR.exe, andzpix.ttfwithout heavy FFmpeg binaries. On Windows, ifffmpeg/ffprobeare not already onPATHor in~/.pykuai/tools/,ytdautomatically prompts to download and SHA256-verify official FFmpeg essentials into~/.pykuai/tools/(or runpykuai tt ytd --install-ffmpeg).
🧩 Extending PyKuai (3-Letter Plugin Contract)
Create a .py file named with three lowercase letters (e.g. pykuai/engines/pdf.py) subclassing BaseEngine:
# -*- coding: utf-8 -*-
import argparse
from rich.console import Console
from pykuai.core.base import BaseEngine
class MyToolEngine(BaseEngine):
name = "pdf"
description = "Merge or split PDF documents"
usage = "tt pdf | tt pdf <files> [-o output]"
category = "Document"
requires = ["pypdf>=3.0.0"]
help_text = "Click Merge or Split in interactive mode, or pass PDF files via CLI."
def register_args(self, parser: argparse.ArgumentParser) -> None:
parser.add_argument("files", nargs="*", help="Input PDF file paths")
parser.add_argument("-o", "--output", default="merged.pdf", help="Output file path")
def run_direct(self, args: argparse.Namespace, console: Console) -> int:
if not args.files:
return self.run_interactive(console)
console.print(f"[#00FF00]Processing {len(args.files)} file(s)...[/#00FF00]")
return 0
def run_interactive(self, console: Console) -> int:
from pykuai.core.tui import pick_one
mode = pick_one("Select PDF Action", [("Merge PDFs", "merge"), ("Split PDF", "split")])
if mode:
console.print(f"[#00FF00]Selected mode: {mode}[/#00FF00]")
return 0
Restart pykuai—no core edits or manual registration needed. pdf appears immediately in tt, and pp automatically tracks its requires packages and imports.
✨ What's New in v1.2.7
- Built-In
Login YouTube(--login): Addedyt_auth.pyandLogin YouTubeinYtdStudioApp, enabling zero-extension sign-in via an isolated Chromium profile (~/.pykuai/yt-session) that saves~/.pykuai/cookies.txtand retries YouTube bot-check blocks interactively. - Lean Distribution & Auto FFmpeg Installer (
--install-ffmpeg): Removed ~200 MiBffmpeg.exe/ffprobe.exebinaries from Git/PyPI packages while adding SHA256-verified on-demand installation into~/.pykuai/tools/with proxy/curl fallbacks. - Universal Studio Feature Guides (
?/F1): Added clickable top-right?help buttons andHelpModalScreendocumentation dialogs acrosstt,pp,ifc, andytd. - Reliability & Toolchain Upgrades: Updated bundled
yt-dlp.exe(2026.10.26) andUnRAR.exe(7.30 beta 2), preferred bundledyt-dlp.exewhen Pythonyt-dlplackscurl_cffi, improved responsive narrow-terminal Studio layouts and URL/path sanitization, and added Windows Chromium lock fallback.
🙏 Open-Source Credits & Assets
- yt-dlp — Stream extraction engine powering
pykuai tt ytd - FFmpeg — Media muxing and MP3/M4A audio transcoding
- Pillow — Multi-format image processing powering
pykuai tt ifc - Textual & Rich — Cyber-Dark interactive TUI widgets and console rendering
- Kenney Audio & CC0 Public Domain Sounds — Retro CC0 UI click, key, enter, paste, telegraph, and pixel-snake sound effects
Metadata
Release files for pykuai 1.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pykuai-1.2.7.tar.gz | 25.1 MB | With provenance | Details for pykuai-1.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pykuai-1.2.7-py3-none-any.whl | Python 3 | none | any | Details for pykuai-1.2.7-py3-none-any.whl |
Total release size: 50.3 MB
Release files / pykuai-1.2.7.tar.gz
| Download URL | pykuai-1.2.7.tar.gz |
|---|---|
| Size | 25.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a14ab988c1658bd60f5dcb110a59b1e6fdd608b834710f582bcda8071d9815ea
|
|
BLAKE2b-256 checksum How to use checksums |
c03650c02991c1ef1cb7e6f96edf3fa86c2c3d8365589947be4c6a52d5d529bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / pykuai-1.2.7-py3-none-any.whl
| Download URL | pykuai-1.2.7-py3-none-any.whl |
|---|---|
| Size | 25.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9ecc4f9d042420a22c80b64c89b48fa818d50bbed97b0977c0f0b8a4d8dac30e
|
|
BLAKE2b-256 checksum How to use checksums |
9cd56bf86ceabfce0090526153e20b3cba0c6b44bc5bca2fe5c9a360111985e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for pykuai 1.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pykuai-1.2.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.