{"categories":[{"label":"Python Modules","url":"https://skillfed.io/packages/category/software-development-libraries-python-modules/9"}],"enrichment":{"capability":"Wraps Python iterators to add timeout behavior, returning a sentinel value when iteration takes longer than a specified duration.","skillfed_tags":["iterator-control","timeout-wrapper"],"use_cases":["Wrap a generator that fetches data from a slow source to enforce per-item timeout and skip items that take too long.","Protect against runaway generators in a data pipeline by returning a sentinel when iteration stalls beyond a threshold.","Dynamically adjust timeout thresholds during iteration based on observed latency or changing system conditions.","Iterate over file handles or network streams with a deadline, gracefully handling slow or hung sources."],"what_it_does":"TimeoutIterator is a wrapper class that adds timeout semantics to any Python iterator. When you wrap an iterator with TimeoutIterator and call next() on it, the wrapper will wait for the underlying iterator to yield a value, but only up to a specified timeout duration. If the timeout expires before a value arrives, TimeoutIterator returns a sentinel object instead of blocking indefinitely or raising an exception.\n\nThe package supports both fixed timeouts (set once at construction) and dynamic timeout adjustment via set_timeout(). When a timeout occurs, iteration continues\u2014the next call to next() will attempt to retrieve the next value from the underlying iterator with the current timeout setting. This is useful for scenarios where you're iterating over slow or potentially stalled sources and need to enforce a deadline without terminating the entire iteration.","worth_installing":"Yes, if you need simple timeout semantics on synchronous iterators and can tolerate dormant maintenance. The package has no dependencies, low install friction, and a permissive license. However, verify that the timeout mechanism meets your concurrency and performance requirements before relying on it in production\u2014the project has not been actively maintained since early 2023."},"id":"iterators","links":{"html":"https://skillfed.io/packages/iterators","md":"https://skillfed.io/packages/iterators.md","pypi":"https://pypi.org/project/iterators/"},"maintenance":{"status":"dormant"},"meta":{"latest_release":"2023-01-23","license_spdx":null,"license_treatment":"permissive","name":"iterators","python_support":"supports_current","summary":"Iterator utility classes and functions"},"popularity":{"monthly_downloads":721807,"position":5229,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"0.2.0"}
