wait-for-it

raw JSON →
2.3.0 verified Mon Apr 27 auth: no python

A cross-platform command-line tool that waits for one or more network services (TCP or UDP) to become available before executing a command. Version 2.3.0, released in 2024, requires Python >=3.9. Stable, low release cadence.

pip install wait-for-it
error RuntimeWarning: coroutine 'wait_for_it' was never awaited
cause The wait_for_it function is async but called without await.
fix
Use await: await wait_for_it('tcp://...') or wrap with asyncio.run().
error ModuleNotFoundError: No module named 'wait_for_it'
cause The package is not installed or the import path is wrong (old import style).
fix
Install via pip install wait-for-it and use from wait_for_it import wait_for_it.
error ValueError: Unsupported scheme: http
cause The URL scheme must be tcp or udp, not http or others.
fix
Use tcp://host:port or udp://host:port.
deprecated Python 3.8 support dropped in v2.3.0. Users on 3.8 must pin to v2.2.0 or upgrade Python.
fix Upgrade Python to >=3.9 or pin pip install wait-for-it==2.2.0
gotcha The Python API is asynchronous. Calling wait_for_it without await or in a non-async context will raise a RuntimeWarning or return a coroutine object.
fix Use async/await or call asyncio.run(wait_for_it(...))
breaking In v2.0.0, the import path changed from wait_for_it.wait_for_it to wait_for_it.
fix Update import to: from wait_for_it import wait_for_it

Wait for a PostgreSQL service on localhost:5432 with a 30-second timeout.

from wait_for_it import wait_for_it

await wait_for_it('tcp://localhost:5432', timeout=30)