Skip to main content

KeyTyper 🎨⌨️

PyPI version Python Support License: MIT Downloads

A powerful, cross-platform Python library for creating beautiful terminal output with typing effects, colors, and formatting. KeyTyper automatically detects your operating system and provides optimal terminal support for Windows, macOS, and Linux.

✨ Features

  • 🎬 Simulated Typing Effect - Display text with realistic typing animation
  • 🎨 Rich Formatting - Apply colors, bold, italic, underline styles
  • 🖥️ Cross-Platform - Works seamlessly on Windows, macOS, and Linux
  • 🔍 OS Detection - Automatically detects and optimizes for your operating system
  • 🌈 ANSI Color Support - Full support for 16 colors plus bright variants
  • 🚀 Easy API - Simple and intuitive methods for all use cases
  • ⚡ Performance - Efficient ANSI sequence handling
  • 🛡️ Safe - No low-level system dependencies that cause compatibility issues
  • 📦 Lightweight - Zero required dependencies (uses only Python standard library)

🚀 Quick Start

Installation

Python 3.11 or newer, no dependencies:

pip install keytyper        # or, in a uv project: uv add keytyper

Releases are published from GitHub Actions with Trusted Publishing; PyPI shows the attestation of each file.

Basic Usage

from keytyper import KeyTyper

# Create a KeyTyper instance
kt = KeyTyper()

# Print with typing effect
kt.print("Hello, World!", fore_color="green", bold=True)

# Print instantly without typing effect
kt.print_instant("This appears immediately!", fore_color="blue")

# Use convenience methods
kt.print_success("Operation completed successfully!")
kt.print_error("Something went wrong!")
kt.print_warning("This is a warning message")
kt.print_info("Here's some information")

📖 Comprehensive Examples

Basic Text Formatting

from keytyper import KeyTyper

kt = KeyTyper()

# Different colors
kt.print("Red text", fore_color="red")
kt.print("Green background", back_color="green")
kt.print("Blue text on yellow background", fore_color="blue", back_color="yellow")

# Text styles
kt.print("Bold text", bold=True)
kt.print("Italic text", italics=True)
kt.print("Underlined text", underline=True)
kt.print("Combined styles", fore_color="magenta", bold=True, underline=True)

Typing Effects

# Customize typing speed
kt.print("Slow typing...", speed=0.1)
kt.print("Fast typing!", speed=0.02)

# Default instance speed
kt = KeyTyper(speed=0.05, fore_color="cyan", bold=True)
kt.print("This uses the default settings")

Convenience Methods

# Predefined message types
kt.print_success("✅ Task completed successfully!")
kt.print_error("❌ An error occurred!")
kt.print_warning("⚠️ Warning: Check your input")
kt.print_info("ℹ️ Processing your request...")
kt.print_ai_response("🤖 AI: How can I help you today?")

Interactive Features

# User input with formatted prompt
name = kt.print_user_prompt("👤 Enter your name: ")
kt.print_success(f"Hello, {name}!")

# Clear screen
kt.clear_screen()

# Print banners
kt.print_banner("WELCOME TO KEYTYPER", char="=", width=50)

Advanced Usage

# Get OS information
os_info = kt.get_os_info()
kt.print_info(f"Running on: {os_info['system']} {os_info['release']}")

# Check color support
if kt.supports_color:
    kt.print("Your terminal supports colors! 🌈", fore_color="bright_green")
else:
    kt.print("Color support not detected")

# Custom formatting
kt.print("Custom message", 
         fore_color="bright_cyan", 
         back_color="black", 
         bold=True, 
         underline=True,
         speed=0.03)

🎨 Available Colors

Foreground Colors

  • black, red, green, yellow, blue, magenta, cyan, white
  • bright_black, bright_red, bright_green, bright_yellow
  • bright_blue, bright_magenta, bright_cyan, bright_white

Background Colors

Same as foreground colors, applied as background

Text Styles

  • bold - Bold text
  • italics - Italic text (may not work on all terminals)
  • underline - Underlined text

🖥️ Platform Support

KeyTyper is designed to work seamlessly across different operating systems:

Windows

  • Automatic ANSI support detection
  • Optional colorama integration for enhanced compatibility
  • Fallback support for older Windows versions

macOS

  • Native ANSI support
  • Optimized for Terminal.app and iTerm2
  • Full color and formatting support

Linux

  • Native ANSI support
  • Compatible with all major terminal emulators
  • Full feature support

🔧 Configuration

Default Settings

# Create with custom defaults
kt = KeyTyper(
    speed=0.05,           # Typing speed (seconds per character)
    fore_color="green",   # Default foreground color
    back_color=None,      # Default background color
    bold=True,            # Default bold styling
    underline=False,      # Default underline styling
    italics=False         # Default italic styling
)

Environment Variables

KeyTyper respects standard environment variables:

  • NO_COLOR - Disable color output
  • FORCE_COLOR - Force color output even if not detected

🧪 Why KeyTyper?

KeyTyper was created to solve compatibility issues with other terminal libraries, particularly on macOS. Unlike libraries that depend on low-level system access or have complex dependencies, KeyTyper:

  • Uses only Python standard library - No external dependencies required
  • Cross-platform by design - Tested on Windows, macOS, and Linux
  • Handles ANSI sequences properly - Efficient and reliable color/formatting
  • Provides typing effects - Engaging user experience without complexity
  • Automatic fallbacks - Works even on limited terminals

📚 API Reference

KeyTyper Class

Constructor

KeyTyper(speed=0.05, fore_color="green", back_color=None, bold=True, underline=False, italics=False)

Methods

  • print(text, **kwargs) - Print with typing effect
  • print_instant(text, **kwargs) - Print immediately
  • print_success(text, speed=None) - Print success message
  • print_error(text, speed=None) - Print error message
  • print_warning(text, speed=None) - Print warning message
  • print_info(text, speed=None) - Print info message
  • print_ai_response(text, speed=None) - Print AI response
  • print_user_prompt(prompt="") - Get user input with prompt
  • clear_screen() - Clear terminal screen
  • print_banner(text, char="=", width=60) - Print banner
  • get_os_info() - Get OS information

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Setup

# Clone the repository
git clone https://github.com/leosavio/keytyper.git
cd keytyper

# Install development dependencies
pip install -r requirements-dev.txt

# Run tests
pytest

# Format code
black keytyper/

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Inspired by the need for a reliable, cross-platform terminal formatting library
  • Built to replace problematic dependencies in educational and professional projects
  • Thanks to the Python community for feedback and suggestions

Made with ❤️ for developers who love beautiful terminal output

Metadata

Release files for keytyper 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keytyper 0.1.0
File Size Uploaded Provenance Actions
keytyper-0.1.0.tar.gz 18.9 kB With provenance Details for keytyper-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for keytyper 0.1.0
File Interpreter ABI Platform Actions
keytyper-0.1.0-py3-none-any.whl Python 3 none any Details for keytyper-0.1.0-py3-none-any.whl

Total release size: 28.8 kB

Release files / keytyper-0.1.0.tar.gz

Download URL keytyper-0.1.0.tar.gz
Size 18.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b2876f6a2d70610a28db663fef48bc9e3f9a2358426939e6a35ccdaef818e96b
BLAKE2b-256 checksum
How to use checksums
f0628cdbb7de046ed495d04e2655517344b06454757ff60d83878e910d814123
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 27, 2026.

Transparency log

Release files / keytyper-0.1.0-py3-none-any.whl

Download URL keytyper-0.1.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
825b0e34321b77d4cacf70c202776e1c77eda13de12eaee81ece8405d672db04
BLAKE2b-256 checksum
How to use checksums
7b3b6fdf0756ecc7ea9a45f552adbc19d55609b02674dc612e7283be90db3689
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 27, 2026.

Transparency log

Security for keytyper 0.1.0

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.

Select from 2 files

Attestation for keytyper-0.1.0.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 27, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page