Skip to main content

A library that insults programmers when their code throws errors

Project description

CodeRoast

A Python library that insults programmers when their code throws errors. Because sometimes you need a reality check.

Overview

CodeRoast is a humorous Python library that catches exceptions and provides snarky commentary on your programming skills. Great for adding a bit of levity to the debugging process or for teaching humility to overconfident programmers.

Features

  • Automatically adds insults to exceptions
  • Provides a decorator for roasting specific functions
  • Includes insults categorized by error type
  • Can be enabled/disabled at runtime
  • Supports custom insults and personalization
  • Provides "roast levels" from mild to brutal

Installation

pip install coderoast

Usage

Basic Usage

Simply import the library and activate the roasting:

from coderoast import CodeRoast

# Activate the roasting globally
CodeRoast.activate()

# Now any unhandled exception will trigger an insult
def broken_function():
    return 1 / 0

try:
    broken_function()
except:
    pass  # The exception will be printed with an insult

Function Decorator

You can use the decorator to roast specific functions:

from coderoast import CodeRoast

# Only roast specific functions
@CodeRoast.roast_function
def another_broken_function():
    x = [1, 2, 3]
    return x[10]  # Index error

try:
    another_broken_function()
except:
    pass  # This function will be roasted

Setting Roast Level

Choose the severity of insults from mild to brutal:

from coderoast import CodeRoast, RoastLevel

# Set roast level
CodeRoast.set_roast_level(RoastLevel.MILD)  # More polite insults
# OR
CodeRoast.set_roast_level(RoastLevel.MEDIUM)  # Default level
# OR
CodeRoast.set_roast_level(RoastLevel.BRUTAL)  # No mercy

Getting Insults Directly

# Get a random insult
insult = CodeRoast.get_insult()
print(insult)

# Get an insult for a specific error type
insult = CodeRoast.get_insult_by_error(ValueError)
print(insult)

Customizing Insults

You can add your own insults to the library:

from coderoast import CodeRoast

# Add general insults
CodeRoast.add_insults([
    "This code is so bad it made my CPU cry.",
    "Have you considered a career in interpretive dance instead?",
])

# Add insults for specific error types
CodeRoast.add_categorized_insult('syntax', [
    "Your syntax is like abstract art - innovative but completely non-functional.",
    "I've seen more structure in a kindergarten finger painting than in your code.",
])

Enable/Disable

You can enable or disable the roasting at runtime:

# Disable roasting
CodeRoast.deactivate()

# Re-enable roasting
CodeRoast.activate()

Sample Output

Traceback (most recent call last):
  File "example.py", line 10, in <module>
    broken_function()
  File "example.py", line 7, in broken_function
    return 1 / 0
ZeroDivisionError: division by zero

🔥 ROASTED 🔥
👉 Your code has more bugs than a tropical rainforest.
👉 Maybe try again when you know what you're doing.

Insult Categories

CodeRoast includes specialized insults for different error types:

  • Syntax errors
  • Logic errors
  • Runtime errors
  • Mathematical errors
  • Type errors
  • And more!

Why Use CodeRoast?

  • To add humor to your debugging process
  • To humble yourself or your teammates
  • For educational purposes (teaching new programmers to handle exceptions)
  • Because normal error messages are too polite
  • To build character and resilience in coding

Pair with JediDebug

For a good cop/bad cop debugging experience, try pairing CodeRoast with its gentler counterpart, JediDebug!

Contributing

Feel free to contribute additional insults or features by submitting a pull request. The more creative the insults, the better!

License

MIT License

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

coderoast-0.2.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

coderoast-0.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file coderoast-0.2.0.tar.gz.

File metadata

  • Download URL: coderoast-0.2.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for coderoast-0.2.0.tar.gz
Algorithm Hash digest
SHA256 410c93f7dbb1560a27221d80a19bb345b1086035b294750007b899781ed07434
MD5 648dfcf7ae373af5c731c45118d989d4
BLAKE2b-256 271dc9cd971bbd591db83281d5be3970c5c1d4762d9c99f02882a9de294464e3

See more details on using hashes here.

File details

Details for the file coderoast-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: coderoast-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for coderoast-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df87947a3dbac459a2d98297ac5f519eae0ce0cf04037117de3f916be03996fc
MD5 bbd3008db673bb6c014556de94e6237e
BLAKE2b-256 69ebe48fb07bfbaa25135fabf66f9dcb4cdf19796b76297d71783180c7ffe1da

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