polling2
Updated polling utility with many configurable options
What it is and what it does
Polling2 is a utility for repeatedly calling a function until it returns a desired result or a timeout is reached. Instead of writing custom retry loops with exception handling and timing logic, you pass a callable to polling2.poll() along with timeout and step parameters, and it handles the polling loop for you—returning the function's result when the condition is met or raising an exception if the timeout expires.
The package is useful in integration tests, waiting for external resources (files, API responses, locks), and any scenario where you need to retry an operation with configurable delays and timeouts. It's a fork of the original polling library, maintained to address issues the original project no longer handles.
Use it for:
- Wait for an API endpoint to return a successful status code before proceeding in tests or deployment scripts.
- Poll for the existence or non-existence of a file on disk with a timeout to avoid indefinite hangs.
- Retry acquiring a resource lock or waiting for a thread to release a lock within a time limit.
- Check for completion of an asynchronous background task by polling a status function periodically.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Polling2 lets you wait for a function to return a desired condition without writing custom retry logic, handling timeouts and polling intervals automatically.
Yes, if you need a lightweight polling utility. The package has no dependencies, low install friction, and a permissive license. However, note that it is aging—last released in 2021 and not actively developed—so it is best suited for stable, simple polling tasks rather than projects requiring ongoing maintenance or new features.
Install
polling2 on PyPI
pip
pip install polling2uv
uv add polling2poetry
poetry add polling2Installing polling2
Before you install
Low install friction with no runtime dependencies. Maintenance status is aging—last release was 2021-07-19 and the last commit 2026-01-11, so the package is stable but not actively developed.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install polling2
import polling2
file_handle = polling2.poll(
lambda: open('/tmp/myfile.txt'),
ignore_exceptions=(IOError,),
timeout=3,
step=0.1
)
Verify before relying
- Whether the package works reliably with modern Python versions (classifiers list Python 2 and 3 but requires_python is unspecified)
Package facts
| License | not declared (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 1,852 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,028,715/month — #3,353 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: polling2-0.5.0-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
httsleephttsleep polls HTTP endpoints repeatedly until…
permissive · top 15,000 on PyPI
timeout-samplerPolls a function repeatedly within a timeout…
permissive · top 15,000 on PyPI
waiterWaiter provides iteration-based retry and…
permissive · top 15,000 on PyPI
waitingWaiting is a lightweight library for polling a…
permissive · top 15,000 on PyPI
busypieProvides expressive, fluent API for…
permissive · top 15,000 on PyPI
retryingRetrying is a decorator-based library that adds…
permissive · top 1,000 on PyPI
monotonicProvides a monotonic clock function that…
permissive · top 5,000 on PyPI
python-retryProvides a decorator to automatically retry…
permissive · top 15,000 on PyPI
wait-for-itA command-line tool that waits for one or more…
permissive · top 15,000 on PyPI
wait-for2Provides an alternate implementation of…
permissive · top 15,000 on PyPI