Skip to main content

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: ignore with 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

  1. 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/.
  2. Analysis (crates/hydroid_core, plain graph code): "does calling f block?" 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 def bodies, 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.
  3. 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.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hydroid-cli 0.5.0
File Size Uploaded Provenance Actions
hydroid_cli-0.5.0.tar.gz 170.0 kB With provenance Details for hydroid_cli-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for hydroid-cli 0.5.0
File Actions
hydroid_cli-0.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for hydroid_cli-0.5.0-py3-none-win_amd64.whl
hydroid_cli-0.5.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details for hydroid_cli-0.5.0-py3-none-musllinux_1_2_x86_64.whl
hydroid_cli-0.5.0-py3-none-musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64 Details for hydroid_cli-0.5.0-py3-none-musllinux_1_2_aarch64.whl
hydroid_cli-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for hydroid_cli-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
hydroid_cli-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for hydroid_cli-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
hydroid_cli-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for hydroid_cli-0.5.0-py3-none-macosx_11_0_arm64.whl
hydroid_cli-0.5.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for hydroid_cli-0.5.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 75.4 MB

Release files / hydroid_cli-0.5.0.tar.gz

Download URL hydroid_cli-0.5.0.tar.gz
Size 170.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1e0760db4341faa1ba9d77ce052b4980f1325fbe9812b48adb51bf31fcaa5574
BLAKE2b-256 checksum
How to use checksums
7ce3fd4af12afb5b05bb35bc45954807355f93d4dd6f974ec27bc791bd10f4df
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-win_amd64.whl

Download URL hydroid_cli-0.5.0-py3-none-win_amd64.whl
Size 11.2 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
497572a44374638e7c7d920001a9d62b438862c6078bd2b217bc773445eb6896
BLAKE2b-256 checksum
How to use checksums
5918bfbbe7754c944bfe9f0957cba77e8c2fd713d528a0e0d5c5ecf5f7737979
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-musllinux_1_2_x86_64.whl

Download URL hydroid_cli-0.5.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
81aa732b613e886c42214f296ac5c518b9d1b4de9d6d2f5c483e34190dc42ae8
BLAKE2b-256 checksum
How to use checksums
a40aff1637e5bbe601d97bdc64db90e7e994f414635fdecb2d76022b4609b5a4
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-musllinux_1_2_aarch64.whl

Download URL hydroid_cli-0.5.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
58635d5890b6ad7e5659f008b5e0274aa1c78adc5dc2073d3bf29c914d93b2e8
BLAKE2b-256 checksum
How to use checksums
34e7407e23cadbe6462593ab764010dca04bc0fff937ac59241686f985ae8636
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hydroid_cli-0.5.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
a05c6502914da54a44a1ada0813fea1eae60cd81c8f60f94d2c7a48167eb89f7
BLAKE2b-256 checksum
How to use checksums
87dff081f559e8c9c3dcde9144fff1b0a9c9a3c3441004a086a5887087a546d2
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hydroid_cli-0.5.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
ccb723356b91febe874d6900c290ddf2390695fd0b0f8ca64924b809fa1000d5
BLAKE2b-256 checksum
How to use checksums
1379e0c286b4dddfb169c62e8ae275a0b51f4a53b0638f444353e601b3d27e79
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-macosx_11_0_arm64.whl

Download URL hydroid_cli-0.5.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
b10289825117c6ef148a3c858bdf19c207ab902cf780a991760527b44e01ef67
BLAKE2b-256 checksum
How to use checksums
78077f9358222dd624c787b6d3d994102a32432710cffdb191f8fd2851e11f31
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 16, 2026.

Transparency log

Release files / hydroid_cli-0.5.0-py3-none-macosx_10_12_x86_64.whl

Download URL hydroid_cli-0.5.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
24c903f613bd487a848562bf57fb7f301dbd5450c95c4f77cc053f65223a3f8e
BLAKE2b-256 checksum
How to use checksums
a1c4e89a963f27ced7ad239ac285f0af4fa86fb5570c38e6a042d389e55f0311
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 16, 2026.

Transparency log

Security for hydroid-cli 0.5.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.

Select from 8 files

Attestation for hydroid_cli-0.5.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 16, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page