Skip to main content

Beautiful, secure, and powerful print() replacement

Project description

One simple import completely replaces the built-in print() with a powerful callback system.
Add colors, gradients, animations, password hiding, encryption, logging all with a single filter function.

Features

  • Auto-overwrites print() on import filty
  • Multiple callbacks – chain as many filters as you want
  • get_callbacks() – returns clean list of callback names (read-only, no side effects)
  • Cross-platform colors powered by colorama
  • Rainbow gradient that intelligently skips pre-colored text
  • Animation support (typing & fade effects)
  • Fast encryption XOR + Base64 (with custom for security)
  • Smart bypass: print(get_callbacks()) prints raw without filtering

Installation

pip install filty

Quick Start

from filty import *

def hide_password(text):
    if "password" in text.lower():
        return "***HIDDEN***"
    return text

def add_color(text):
    if "ERROR" in text.upper():
        return Colors.red(text)
    return text

def rainbow(text):
    return gradient(text)

add_callback(hide_password)
add_callback(add_color)
add_callback(rainbow)

print("Current callbacks:", get_callbacks())

print("My password is Secret123!")
print("ERROR: Something went wrong!")
print("SUCCESS: Operation completed")

All Available Tools

Colors

from filty import Colors

print(Colors.red("Error message"))
print(Colors.green("Success!"))
print(Colors.cyan("Info text"))

Gradient

from filty import gradient
print(gradient("This text becomes beautiful rainbow!"))

Animation

from filty import animate_print

animate_print("Loading system...", delay=0.04)
animate_print("Fading in...", delay=0.06, style="fade")

Secure (XOR + base64)

from filty import encrypt, decrypt

secret = encrypt("My password is P@ssw0rd!", "1234567890")
print("Encrypted:", secret)

original = decrypt(secret, "1234567890")
print("Decrypted:", original)

Performance

Text length Pure Python (secure.py) Native
1,000 chars ~20 ms ~0.3 ms
10,000 chars ~205 ms ~2.5 ms
100,000 chars ~2107 ms ~22 ms

Full Callback Detail

from filty import (
    add_callback,
    set_callbacks,
    reset_callbacks,
    get_callbacks,
    Colors,
    gradient,
    animate_print,
    encrypt
)

# 1. set_callbacks(): Replace all at once
def hide_password(text):
    if "password" in text.lower():
        return "***HIDDEN***"
    return text

def add_color(text):
    upper = text.upper()
    if "ERROR" in upper:
        return Colors.red(text)
    if "SUCCESS" in upper:
        return Colors.green(text)
    if "WARNING" in upper:
        return Colors.yellow(text)
    return text

def rainbow(text):
    return gradient(text)

set_callbacks([hide_password, add_color, rainbow])

print("\nCurrent callbacks:", get_callbacks())
# Output: ['hide_password', 'add_color', 'rainbow']


# 2. Full Secure Filter + set_callbacks
def secure_filter(text):
    lower = text.lower()
    
    if any(word in lower for word in ["password", "secret", "token", "key", "api", "auth"]):
        encrypted = encrypt(text, "mykey")
        return Colors.red("[ENCRYPTED] " + encrypted)
    
    upper = text.upper()
    if "ERROR" in upper:
        return Colors.red(gradient(text))
    if "SUCCESS" in upper:
        return Colors.green(gradient(text))
    if "WARNING" in upper:
        return Colors.yellow(gradient(text))
    
    return gradient(text)

reset_callbacks() 
set_callbacks([secure_filter])

print("\n=== Using Secure Filter ===")
print("My password is SuperSecret123!")
print("ERROR: Access denied")
print("SUCCESS: Login completed")
print("WARNING: Low memory")
print("Normal message here")

# 3. Switch back to multiple callbacks
print("\n=== Switching to Multiple Callbacks ===")
reset_callbacks()

set_callbacks([
    hide_password,
    add_color
])

print("Current callbacks:", get_callbacks())
print("My password is P@ssw0rd!")
print("ERROR: Access denied")

Project Structure (for developers)

filty/
├── __init__.py
├── core.py          
├── config.py        
├── color.py
├── gradient.py
├── secure.pyd       # Native compiled extension for Windows
├── secure.so        # Native compiled extension for Linux
├── secure.py
└── animate.py

All modules are tiny, focused, and optimized.


License

MIT License


Made with ❤️ for clean, beautiful, and secure printer.

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

filty-1.0-py3-none-win_amd64.whl (130.5 kB view details)

Uploaded Python 3Windows x86-64

filty-1.0-py3-none-manylinux1_x86_64.whl (38.5 kB view details)

Uploaded Python 3

File details

Details for the file filty-1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: filty-1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 130.5 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for filty-1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 dd44b97523a4617f473793d7ed9a2e7b1ef14297eb372cdf66853495a66b3be3
MD5 23a8178184c15edd3b7bf8b093acfa43
BLAKE2b-256 9150e639f2db178b2279dad8f74e770aecb8dc1076b67daa6b0d376aee0b1bf8

See more details on using hashes here.

File details

Details for the file filty-1.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for filty-1.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dc619182973e08ab3dfc962dfbed1f24914b35c882d7a470b314fd151e85992b
MD5 f994cf7de9950f1c0066d97ee610d1b2
BLAKE2b-256 b799d417d7301fc6ddde4fe57928c0d2a29fdd5ffe228c6519daee63e1414e1f

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