Skip to main content

ty-async

Extremely fast linter implementing flake8-async's ASYNC200 check (user-configured blocking calls in async functions), built on ruff's Python parser. Drop-in replacement for the flake8 flag, ~2 orders of magnitude faster.

pip install ty-async

ty-async src-dir another-dir \
  --exclude=src-dir/tests \
  --async200-blocking-calls='stripe.*->alt(),*.load_data->(),fcntl.flock->()'

Stdlib preset

There is no official CPython list of "don't call this in the event loop", but flake8-async's ASYNC21x–25x rules are the de-facto one. --async200-stdlib appends a curated preset mirroring them plus high-signal extras: time.sleep, input, pathlib read_text/write_bytes/…, heavy shutil/os.walk filesystem work, subprocess.* and os.system/os.spawn*/os.wait*, urllib.request.urlopen, socket DNS lookups, smtplib/ftplib/http.client, sqlite3.connect, and archive/compression helpers. Deliberately omitted: generic method names (.read, .recv, .acquire, .wait, .get) and cheap single-syscall ops (os.stat, os.listdir, os.mkdir, all of os.path, open and tempfile.* — opening is cheap, it's reading/writing that blocks) — too many false positives / too little blocking to matter. User patterns win on overlap, awaited calls stay exempt (so aiofiles/anyio wrappers never fire), and it composes with --async200-transitive.

Transitive mode

--async200-transitive (with the same patterns flag) additionally builds a name-based call graph and reports call sites in async functions that reach a blocking call through sync helpers, with the chain as evidence:

app.py:161:18: ASYNC200T blocking sync call markdown.markdown reachable from async function via markdown_to_slack_blocks (client.py:176:12)

Calls are resolved by name only (same class → same file → globally unique; ambiguous names are skipped, not guessed). Callables merely passed to asyncio.to_thread / run_in_executor are not calls, so executor wrappers are naturally exempt. Dynamic dispatch and framework callbacks are out of scope. Suppress a site with # noqa / # noqa: ASYNC200 on its line.

Shield scope (ASYNC201)

--async201 flags asyncio.shield(...) calls whose argument uses a name bound by an enclosing async with:

async with ctx.db() as db:
    await asyncio.shield(update_status(db, ...))  # ASYNC201

shield only protects the inner coroutine — on cancellation the await raises immediately and the async with exits, closing db while the shielded task is still using it (use-after-close, connection returned to the pool mid-transaction). Fix: move the async with inside the shielded coroutine so the resource's lifetime is shielded too. Matches bare shield and any *.shield attribute call; resolved by name, so aliased resources (conn = db) are missed. Suppress with # noqa: ASYNC201.

Type escape hatches

--type-hatches=no-any,no-getattr,no-object enables three extra rules (usable alone or together with the ASYNC200 flag, single pass either way):

  • no-getattr — bare getattr() / hasattr() calls
  • no-any — Any (or typing.Any, t.Any, …) inside an annotation
  • no-object — object inside an annotation

Suppress a site with a trailing # lint-ignore: no-any,no-getattr comment anywhere in the enclosing statement / function-signature span.

Semantics

Semantics match flake8-async exactly: calls inside async def bodies (nested def/lambda reset the context), directly-awaited calls are skipped, patterns are fnmatch-ed against ast.unparse(func) (so * crosses dots), # noqa / # noqa: ASYNC200 are honored, and output format and exit codes match flake8. Only ASYNC200 is implemented; --ignore and --asyncio are accepted as no-ops.

Metadata

Release files for ty-async 0.4.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 ty-async 0.4.0
File Size Uploaded
ty_async-0.4.0.tar.gz 23.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for ty-async 0.4.0
File
ty_async-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
ty_async-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
ty_async-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
ty_async-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
ty_async-0.4.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 5.2 MB

Release files / ty_async-0.4.0.tar.gz

Download URL ty_async-0.4.0.tar.gz
Size 23.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f823cdc6131e9ffff4e6767050313bca65603c245af4cf6a072cb2ee28f8fe89
BLAKE2b-256 checksum
How to use checksums
784318276a46c05d0f971cfc602a4c448c0e6ccbc1faf09f4a8dec2aa1913daa
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 Aug 20, 2026.

Transparency log

Release files / ty_async-0.4.0-py3-none-win_amd64.whl

Download URL ty_async-0.4.0-py3-none-win_amd64.whl
Size 974.3 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
a20845f085d9e06864c74c64140632a6b85ceb3b3b3ae59a2cccebc913983dc5
BLAKE2b-256 checksum
How to use checksums
e470194f0b3bfa0024f02fe983a4f52bf84bdd71b93a47a48deb525aa1391281
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 Aug 20, 2026.

Transparency log

Release files / ty_async-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL ty_async-0.4.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.1 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
034ba682639fdd628daa8f37997eb24c2c1bab8dfad1c833b03637ea469abfa1
BLAKE2b-256 checksum
How to use checksums
0c08502bee41b451b8bdec6aec0a9d937bdefc176d4e0d89edd9f850392b802e
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 Aug 20, 2026.

Transparency log

Release files / ty_async-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL ty_async-0.4.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.1 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
9a01e4eb771113225742696185289f96d3e707d90506c6713dd506c45a491c4d
BLAKE2b-256 checksum
How to use checksums
7269f6f679a735a5980e8fbb3dc067686bdc7743049572b336dcc73671fa00af
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 Aug 20, 2026.

Transparency log

Release files / ty_async-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL ty_async-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 1.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
922e502a53b2437f059ae75d5351be729370b2713f42707df9a434b84bc8302e
BLAKE2b-256 checksum
How to use checksums
c574baa95a230a3ab0c3989507c04bc125edf9635ef76ea8451c0a53f9ac2727
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 Aug 20, 2026.

Transparency log

Release files / ty_async-0.4.0-py3-none-macosx_10_12_x86_64.whl

Download URL ty_async-0.4.0-py3-none-macosx_10_12_x86_64.whl
Size 1.0 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
7562eab961e74a03f86c28698e07be061da296e526319ab6722557667579fc34
BLAKE2b-256 checksum
How to use checksums
5cc3c37b8ed775d14cac16468f15fb2a86be7983252d68e9aa27c70520d8eb01
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 Aug 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

6 release files

0.3.0

6 release files

0.2.0

6 release files

0.1.0

6 release files

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