hydroid
Finds blocking calls that run on the event loop in async FastAPI (and any asyncio) code — at any call depth, across modules, through callbacks, decorators, context managers, properties and subclass overrides — and shows the whole chain.
error[blocking-http]: `requests.api.get` blocks the event loop
--> app/main.py:12:12 in `app.main.get_user`
= reached from route GET /users/{user_id}: app.main.get_user (app/main.py:11)
= blocking chain (3 calls):
app/main.py:12:12 services.load -> app.services.load
app/services.py:7:22 fetch -> app.repo.fetch
app/repo.py:5:16 http_get -> requests.api.get
= help: use an async client (`httpx.AsyncClient`, `aiohttp`) or `await asyncio.to_thread(...)`
New here? Read the usage guide. Adding it to CI, or letting a coding agent set it up: CI/CD and agent setup.
Written in Rust on top of ty's semantic model (types, imports,
go-to-definition). Polar's server (1,854 files, 108k call sites) takes about as long as ty needs
to type-check it the first time (~10 s on 4 vCPUs), then ~0.35 s while nothing changed: extracted
facts are cached in .hydroid_cache/. HYDROID_TIMINGS=1 prints where the time goes.
Install and run
With uv (prebuilt wheels for macOS, Linux, Windows; no Rust needed):
uvx --from hydroid-cli hydroid .
To install the hydroid command permanently, run uv tool install hydroid-cli
(without uv: pipx install hydroid-cli or pip install hydroid-cli), then run hydroid . anywhere.
From the source on main (builds once with a Rust toolchain, then cached):
uvx --from git+https://github.com/agusmdev/hydroid hydroid .. From a clone:
cargo install --path crates/hydroid. More in the guide.
hydroid path/to/project # finds .venv / VIRTUAL_ENV like ty
hydroid . --python .venv --format sarif > hydroid.sarif
| Flag | |
|---|---|
--python PATH |
virtualenv or interpreter to resolve imports (default: discovered) |
--follow-libs |
also analyze third-party function bodies |
--cpu |
also report CPU-bound calls (bcrypt, pbkdf2, scrypt) |
--strict |
report calls on the loop whose target is unknown, and fail on them |
--fail-on warn|critical |
lowest severity that fails the run (default warn: any finding) |
--exclude GLOB |
skip files (repeatable) |
--no-cache |
do not read or write .hydroid_cache/ |
--format human|json|sarif |
output |
Exit status: 0 clean, 1 findings (or unresolved calls with --strict), 2 error.
Each finding has a severity. error[...] (critical): the call can block the loop for a long or
unknown time (network, database, subprocess, locks, sleeps). warning[...] (warn): a short,
local block (Path.exists, small file reads), or a critical call that only runs while the server
starts or stops. Fix the errors first; --fail-on critical gates CI on them only.
More.
Suppress a line with # hydroid: ignore.
Configuration in pyproject.toml (flags win):
[tool.hydroid]
python = ".venv"
exclude = ["migrations/**"]
strict = false
fail-on = "warn"
[[tool.hydroid.sink]] # your own blocking functions (defining qualified names)
category = "sdk"
advice = "use the async client"
severity = "critical" # default; "warn" for short, local work
functions = ["acme.client.Client.fetch"]
CI/CD and agent setup
hydroid exits 1 when it finds blocking calls, so it can gate a build as is. On GitHub,
--format sarif puts each blocking chain on the pull request through code scanning:
# .github/workflows/hydroid.yml
name: hydroid
on: [push, pull_request]
jobs:
hydroid:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v6
- run: uv sync # hydroid needs the project's dependencies installed
# Optional: pin a version for reproducible builds, e.g. hydroid-cli==0.2.0
- run: >-
uvx --from hydroid-cli
hydroid . --format sarif > hydroid.sarif || [ $? -eq 1 ]
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: hydroid.sarif
|| [ $? -eq 1 ] reports findings without failing the job (exit 2, an error, still fails it);
drop it and the upload step to fail the build instead.
docs/AGENT_SETUP.md has:
- a prompt to paste into a coding agent (Claude Code, Cursor, Codex…) that installs hydroid
in your repository, configures
[tool.hydroid], triages the existing findings (fix,# hydroid: ignorewith a reason, or report to you) and adds the CI job; - configs for GitLab CI, pre-commit, monorepos, projects not using uv, and other CI systems;
- a path for adopting it on a code base with existing findings: report-only first, then gate.
How it works
- Facts (
crates/hydroid_ty, the only crate that touches ty): every function body is walked in parallel, and each call is resolved through ty to the functions it can run, implicit calls included (with,for, properties, descriptors, operators, constructors). Callables passed as arguments, stored on instances or returned are recorded as flows. What a library does that its source does not show (stub-only stdlib, frameworks calling project code later) comes from the catalog. The facts of an unchanged project are reused from.hydroid_cache/. - Analysis (
crates/hydroid_core, plain graph code): "does callingfblock?" is computed once per function by a backwards search from blocking functions, giving shortest witness chains. Diagnostics are the call sites in loop code (async defbodies, callbacks the loop runs, code a framework runs on the loop around an entry point) whose callee blocks. Offload APIs cut the graph. Overrides are found by class hierarchy, narrowed by what is known about the instance (or argument). Generators run when iterated, not when called. - Catalog (
crates/hydroid_core/catalog.toml): library knowledge as data, by defining qualified name. It covers:- what blocks, and what offloads or schedules on the loop;
- what functions do with their arguments;
- framework entry points and what the framework runs around them;
- model hooks, observers (logging), exit stacks, running-loop probes, lazily loaded attributes,
and state namespaces.
Library knowledge goes here, not in the Rust code. Every table can be extended from
pyproject.toml, and a test checks that every name exists in a real environment.
Sync def endpoints and dependencies are not reported: FastAPI runs them in a threadpool. The
details, and what hydroid knowingly misses: docs/GUIDE.md.
Limits
Python is dynamic: calls through getattr, untyped parameters, or registries of callables filled
at run time cannot always be resolved. --strict lists every one reachable on the loop (except
awaited calls, assumed to run a coroutine). A call on a value typed as a Protocol or ABC resolves to the abstract
method, so the real implementation can be missed. What hydroid knowingly misses, and why:
docs/GUIDE.md.
Development
cargo test --workspace # needs `uv`; syncs tests/fixtures/.venv from uv.lock
scripts/corpus.sh [names] # Polar, mealie, lnbits, dispatch, litellm, open-webui, template
Fixture cases live in tests/fixtures/cases/*; expectations are inline comments:
# expect: time.sleep via route GET /x, # expect: * (any blocking function), # expect-unresolved.
tests/adversarial/ is a suite of cases written to break hydroid, split into a training half
(required to pass, by cargo test) and a held-out half that is only scored:
scripts/hillclimb/score.py --split train # misses and false positives, per case
scripts/hillclimb/score.py --split holdout --quiet # aggregate only: don't tune on it
scripts/hillclimb/polar_time.sh target/release/hydroid 5
uv run --with anthropic scripts/hillclimb/adversary.py --count 5 # Claude proposes new cases
scripts/hillclimb/oracle.py PROJECT report.json # naive syntactic scan: candidate misses
ty's crates are pinned to exact versions (=0.0.15); they have no API stability promise.
The bundled typeshed stubs are Apache-2.0; hydroid is MIT.
Releases: docs/RELEASING.md.
Metadata
Release files for hydroid-cli 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hydroid_cli-0.4.0.tar.gz | 167.3 kB | With provenance | Details for hydroid_cli-0.4.0.tar.gz |
Built distributions (wheels)
Total release size: 75.3 MB
Release files / hydroid_cli-0.4.0.tar.gz
| Download URL | hydroid_cli-0.4.0.tar.gz |
|---|---|
| Size | 167.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f9bddfe6261d2f45a65a7b145a0340aac186925404cc0022df79bbd92abf683a
|
|
BLAKE2b-256 checksum How to use checksums |
1d524ee982eabb41c3e33d656d8a9d75507156db02bfb8104895f9e1e4e55585
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-win_amd64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-win_amd64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
7701671ba3ee5e9b6330e9914d20dc8ecc125888f43706b37bc71ee07bbd974d
|
|
BLAKE2b-256 checksum How to use checksums |
243ff0acb9a730b5631fb2bb64d057e2ef38154419329fee093ad2854fc70404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
466fcadac2ebb405da6fe886d7aa8cefcf1044cc8208875061be1518719e7e6c
|
|
BLAKE2b-256 checksum How to use checksums |
2da1c6952f5f6af96f22b8b0a4990fd7ee54bf022550b18b82bc45b925a9011f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-musllinux_1_2_aarch64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 10.3 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
12971c484c411a62f9cc1c29a7f02de730ad929c294a96fcc16bb01fa7ba9a02
|
|
BLAKE2b-256 checksum How to use checksums |
22b0b5f5f4488356280cd8a32009afc72301ca7433d20e5a163e01bc181c0ba0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 11.0 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
d611ab9329d99e97d819be7096b223817b77ffa7a09555d3dae0732ffa8818dc
|
|
BLAKE2b-256 checksum How to use checksums |
17ae4c6cbabb0d609cd2c68402ac2ce772ed8d58b9cd6b920a9ee0dc2e237dea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 10.4 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
19d55e85da8d222e738256ef751bc5a8d76612f915a8f61570c71b27ac54904d
|
|
BLAKE2b-256 checksum How to use checksums |
9fdf16f6fdd5e693882562daf28ec944308e5d45fe64d82a2ba32d50e96be916
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-macosx_11_0_arm64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 10.3 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5f2cf095adf60127ac6e18e341a8893d81741fe49990302f37a46b657fe9f8f9
|
|
BLAKE2b-256 checksum How to use checksums |
eedca1ff09d1501b49fda19d9d1588d7f689057921a02525c7aae8b22c241bf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logRelease files / hydroid_cli-0.4.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | hydroid_cli-0.4.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 10.9 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b48bc7c6970e9829462951cd92fc468c5e343ba9fb257fe9855efa4ce1a6d14d
|
|
BLAKE2b-256 checksum How to use checksums |
f413518fa396c0b3f19fbf1b62f6a26c7b4e8a2fc13400d628e8ef8c5598fb54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logSecurity for hydroid-cli 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for hydroid_cli-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.