A useless Python package for marking technical debt in your codebase. Based on the infamous "Ostrich Algorithm" - if you can't see the problem, is it really a problem? As the saying usually goes, if you don't see it, it's not there /s.
The Ostrich Algorithm is a term in programming where developers deliberately ignore certain problems in their code (like an ostrich "burying its head in the sand"). While it sounds like a joke, it's actually a legitimate strategy when:
- The problem is super unlikely to occur (or at least we hope so)
- Fixing it would cost more than ignoring it
- You're dealing with legacy code that works (don't touch it ever!)
- Your deadline was yesterday
This package turns this concept into a (hopefully) useful marking system for your code, letting you:
- Flag problematic code with priority levels
- Add ticket references
- Get reminded of your poor life choices with random funny messages
- Make your technical debt visible (but still ignore it professionally)
pip install py-ostrich
from ostrich import ostrich, Priority
# Mark high priority issues with specific line problems
@ostrich(Priority.HIGH, "PERF-123", lines={
15: "This regex makes senior devs cry",
20: "O(n³) but we pretend it's O(1)"
})
def slow_as_hell_function():
pattern = r'^[^\s]{0,}(?<=\w{3})\d+'
for i in range(1000000):
do_something_terrible(i)
return "somehow it worked"
# medium priority stuff you'll "fix later"
@ostrich(Priority.MEH)
def might_explode():
x = {'a': 1, 'b': 2}
return "🤞"
@ostrich()
def pure_chaos():
important_business_logic()
return "¯\_(ツ)_/¯"
from ostrich import ostrich, Priority
@ostrich(Priority.HIGH, "PERF-123", lines={
15: "This query makes the DB cry",
22: "N+1 query problem but it's Friday"
})
def calculate_user_metrics():
query = "SELECT * FROM users WHERE..."
for metric in all_metrics:
results.append(calculate_metric(user, metric))
return results
# The output will look like:
# [OSTRICH HIGH][PERF-123] watching from line 3
# Marked lines in this function:
# Line 15 -> This query makes the DB cry
# query = "SELECT * FROM users WHERE..."
# Line 22 -> N+1 query problem but it's Friday
# for metric in all_metrics:
- Priority.CRITICAL - Red (Oh shit, we're in trouble)
- Priority.HIGH - Yellow (This is fine... 🔥)
- Priority.MEH - Blue (We'll fix it... someday)
- Priority.LOW - Green (GGWP)
- Priority.LOL - Gray (RIP...)
- You've got some hacky code that works but needs attention later
- You want to track technical debt in a fun way
- You need to mark priority levels for future fixes
- Your code review involves a lot of "we'll fix it later"
- Or you want to live in self-denial
Found a bug? (Or want to professionally ignore it?) Feel free to:
- Add more funny excuses
- Suggest new priority levels
- Report bugs (or ignore them, staying true to the spirit)
- Improve documentation (or don't, who reads docs anyway?)
Because sometimes you need to:
- Track technical debt without crying
- Make your team laugh about bad code instead of quitting
- Show management exactly how many problems you're "working on"
- Turn your bugs into features
- Turn your shame into a feature
This is meant to be a joke. Please write proper code.
MIT License - Because we take some responsibility (unlike our code)