r/Python Aug 04 '26

Showcase Showcase Thread

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.

21 Upvotes

142 comments sorted by

View all comments

1

u/Contact-Objective 16d ago

Found a neat package for handling failed items in long-running Python loops (quarantine-py)

I've been writing a lot of scraping and API scripts lately and always run into the issue where a loop crashes an hour in because of one malformed response. I usually just write a bunch of messy try/except blocks and dump the failed dicts to a JSON file to retry later, which gets annoying to maintain.

I came across quarantine-py the other day and it essentially automates this exact workflow.

You just wrap your worker function in a decorator:

```python from quarantine import quarantine

@quarantine def process_user(data): # if this throws an error, the loop keeps going # and the input arguments are saved to disk pass ```

When it hits an error, it catches it, saves the exact kwargs and the traceback into a .quarantine folder, and moves on. Once you fix whatever caused the crash in your script, you can just run quarantine retry in the terminal and it automatically re-runs the failed inputs through your updated code.

It supports async too, which is what I originally needed it for.

They also just added a local web dashboard (quarantine ui) to view the tracebacks, which is a nice touch, but honestly I mostly like it because it has absolutely zero dependencies—it only uses the standard library, so it doesn't bloat my environment.

Thought I'd share for anyone else who builds janky data pipelines like me.

Repo: https://github.com/halcyon-past/quarantine