Zero-Code Runtime Suppression.

A .gitignore-style workflow for disabling debug, development, and runtime behaviors in Python automatically. One import. Zero code changes. Full control.

$ pip install debugignore
debugignore logo large

What is this?

debugignore lets you declare which runtime behaviors (like prints, logging calls, debug helpers, network requests, or file writes) should be silently suppressed.

You define these rules in a simple .debugignore file that lives in your project root. When your app runs, debugignore intercepts these actions dynamically without throwing errors.

Idempotent & Safe: All patched functions safely return None or act as a noop, ensuring your application doesn't crash even if the underlying function is removed.

Before & After Examples

Below are real-world scenarios demonstrating how debugignore intercepts Python execution seamlessly.

1. Suppressing Prints

Console prints are the most common debugging tool, but leaving them in production can clutter logs. Here's how to disable them completely.

Without debugignore
# app.py
def process_data():
    print("Starting process...")
    # ... doing work ...
    print("Process finished!")

process_data()
$ python app.py
Starting process...
Process finished!
With debugignore
# .debugignore
print
# app.py
import debugignore

def process_data():
    print("Starting process...")
    # ... doing work ...
    print("Process finished!")

process_data()
$ python app.py
(No output generated)

2. Disabling Module Functions (e.g., JSON)

You can target specific modules and functions. If you use a helper that dumps JSON to the console during dev, disable it entirely via wildcards.

Without debugignore
# app.py
import json

data = {"user_id": 42, "status": "active"}
result = json.dumps(data)
print(f"Payload: {result}")
$ python app.py
Payload: {"user_id": 42, "status": "active"}
With debugignore
# .debugignore
json.dumps
# app.py
import json
import debugignore

data = {"user_id": 42, "status": "active"}
result = json.dumps(data) # Returns None
print(f"Payload: {result}")
$ python app.py
Payload: None

3. Blocking Network Requests

Ensure your test scripts or development environments don't accidentally ping production servers by blocking outbound HTTP requests.

Without debugignore
# app.py
import requests

# Sends real data to a server
requests.post("https://api.example.com", json={"foo": "bar"})
print("Sent webhook!")
$ python app.py
Sent webhook!
(Server receives HTTP POST)
With debugignore
# .debugignore
requests.post
# app.py
import requests
import debugignore

# Suppressed safely, returns a noop object
requests.post("https://api.example.com", json={"foo": "bar"})
print("Sent webhook!")
$ python app.py
Sent webhook!
(No actual network request made)

4. Preventing File Writes

Disable file writes to avoid cluttering your filesystem during tests, while keeping file reads intact.

Without debugignore
# app.py
with open("test.log", "w") as f:
    f.write("System initialized.\n")
print("Log written.")
$ python app.py
Log written.
(test.log is created on disk)
With debugignore
# .debugignore
open
*.write
# app.py
import debugignore

# File creation is intercepted. 
# f is replaced by a dummy in-memory string buffer.
with open("test.log", "w") as f:
    f.write("System initialized.\n")
print("Log written.")
$ python app.py
Log written.
(No file is created on disk)
Ready to gain full control? Start using debugignore today and clean up your runtime behaviors effortlessly!