--- id: threaded version: "4.2.0" license: Apache-2.0 license_treatment: permissive maintenance: aging --- # threaded — Decorators for running functions in Thread/ThreadPool/IOLoop License: permissive · Maintenance: aging · Downloads: 295.4K/mo ## What it is and what it does threaded is a decorator library that wraps ordinary Python functions to run them concurrently using standard library primitives—ThreadPoolExecutor, threading.Thread, or asyncio.Task. Instead of writing boilerplate like `loop.create_task()` or `thread_pool.submit()` every time you want to run a function concurrently, you decorate it once and call it normally; the decorator handles the concurrency setup and returns a future or thread object. It supports Python 3.8 through 3.12 on CPython and PyPy, with no external dependencies beyond the standard library. The library provides three main decorators: ThreadPooled (submits to a thread pool with configurable worker count), Threaded (wraps in a threading.Thread with optional daemon and auto-start modes), and AsyncIOTask (wraps in an asyncio.Task). Each decorator can be configured with custom event loops or loop-extraction logic for integration with existing async code. The thread pool can be shut down explicitly during application shutdown. Use it for: - Offload blocking I/O operations (file reads, network calls) to a thread pool without writing submit/future boilerplate - Launch long-running background tasks as daemon threads with a single decorator instead of manual Thread instantiation - Wrap synchronous functions to run as asyncio tasks within an event loop for mixed sync/async codebases - Reduce copy-paste of concurrent.futures or threading setup code across a codebase by standardizing on decorators - Integrate blocking library calls into async code by scheduling them on a thread pool executor ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides decorators to wrap functions for execution in thread pools, individual threads, or asyncio tasks, eliminating boilerplate code for common concurrency patterns. Yes, if you frequently write concurrent code and want to reduce boilerplate. The package is stable (Production/Stable classifier), has no dependencies, and works across modern Python versions. The aging maintenance status (last release 996 days ago) is not a blocker for a mature decorator library, but means you should not expect rapid bug fixes or new features. No known vulnerabilities. ## Install pip install threaded uv add threaded poetry add threaded ## Installing threaded Before you install: Low install friction with no runtime dependencies. Maintenance is aging—last release was 996 days ago—but the repository remains active with a recent commit on 2026-01-12, suggesting occasional updates rather than abandonment. License in practice: Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions; suitable for most projects without license compatibility concerns. Quickstart: pip install threaded import threaded @threaded.ThreadPooled def blocking_task(): return "result" future = blocking_task() import concurrent.futures concurrent.futures.wait([future]) Requires Python 3.8 or later; asyncio integration requires an active event loop when using AsyncIOTask or ThreadPooled with loop_getter. Verify before relying: - Whether the package handles thread-local storage or context propagation correctly in all use cases - Performance characteristics when managing large numbers of concurrent tasks relative to raw threading APIs ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 295.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags thread pool decorator, asyncio task decorator, threading decorator, concurrent.futures wrapper, function threading, async task wrapper, thread pool executor decorator, concurrency, decorators, asyncio [View on SkillFed](https://skillfed.io/packages/threaded) · [View on PyPI](https://pypi.org/project/threaded/)