nowfound

Dev tools · August 30, 2024

AP

Asyncpal: Preemptive concurrency and parallelism for sporadic workloads

Hi HN ! Alex here. I'm excited to show you Asyncpal (https://github.com/pyrustic/asyncpal), a Python library for parallelism [1] and preemptive concurrency [2] tailored for sporadic workloads [3]. I've been working on a private project where it would be convenient to have asynchronous versions of some operations without using `async/await` [4]. Besides `async/await`, which represents cooperative concurrency via the `asyncio` package, Python also provides preemptive concurrency through its `threading` package. Additionally, the `concurrent.futures` package builds…

In plain words

Asyncpal is a Python library that provides parallelism and preemptive concurrency designed for sporadic workloads. It offers an alternative to async/await syntax by enabling asynchronous operations through threading and thread pools. The library simplifies resource management and task execution for developers building applications where cooperative concurrency is less suitable than thread-based approaches.

written from the facts on this page · September 2026

From the sources

In the maker’s words, at launch

Hi HN ! Alex here. I'm excited to show you Asyncpal (https://github.com/pyrustic/asyncpal), a Python library for parallelism [1] and preemptive concurrency [2] tailored for sporadic workloads [3]. I've been working on a private project where it would be convenient to have asynchronous versions of some operations without using `async/await` [4]. Besides `async/await`, which represents cooperative concurrency via the `asyncio` package, Python also provides preemptive concurrency through its `threading` package. Additionally, the `concurrent.futures` package builds upon the `threading` package to provide a thread pool [5], which is the design pattern my project needed for managing concurrent tasks. Although a thread pool is the right tool for the problems it solves, its creation and usage involve the allocation of resources that must be properly released. For this reason, it is recommended to use a thread pool with a context manager [6] to ensure that resources are properly released once the pool executor has finished its tasks. However, this strategy can introduce overhead in programs that sporadically submit tasks to a thread pool, as multiple pools may be created and destroyed throughout the execution of these programs. Maintaining one or a few thread pools for the duration of a program can be an effective solution, assuming these thread pools can automatically shrink after workers have been idle for a short period defined by the programmer. I developed Asyncpal to meet the requirements and extended it with processes to achieve parallelism. For more details about this project, please refer to the README. You can download the lightweight package on PyPI, try the examples provided in the README, or run the tests on your machine. Let me know what you think about this project. [1] https://en.wikipedia.org/wiki/Parallel_computing [2] https://en.wikipedia.org/wiki/Concurrent_computing [3] https://www.cloudcomputingpatterns.org/unpredictable_workloa... (related) [4] https://en.wikipedia.org/wiki/Async/await [5] https://en.wikipedia.org/wiki/Thread_pool [6] https://superfastpython.com/threadpoolexecutor-context-manag...

More dev tools this month

the category →
  • Dograh592

    The open source VAPI alternative

    Dev tools · 25d ago · dograh.com

  • Meridian530

    Don't let your work go unnoticed. Get promoted!

    Dev tools · 20d ago · meridiona.com

  • x1516

    Lovable for iPhone apps go from idea to App Store

    Dev tools · 11d ago · x1.new

  • Open-source GTM skills for technical founders

    Dev tools · 29d ago · gtmcofounder.com

  • OpenTrailPaper is open-source bike computer firmware for the LilyGO T5S3 4.7" E-Paper PRO. It supports offline maps, GPX routes, FIT recording and Bluetooth sensors.

    Dev tools · 1d ago · opentrailpaper.com

  • Nuphos380

    The AI-Native DevOps Workspace.

    Dev tools · 24d ago · nuphos.ai

Launched alongside, August 2024

the whole month →
  • Wordware9,866

    Your tool for building AI agents with natural language

    AI · 2024 · wordware.ai

  • IY

    Life & fun · 2024 · ytch.xyz

  • Me.bot1,628

    The inspiring companion for your life

    AI · 2024 · me.bot

  • Upmetrics AI1,197

    Business plan & financial forecast using AI

    Work · 2024 · upmetrics.co

  • Jupitrr AI1,196

    Auto-generate B-roll visuals for content marketing videos

    AI · 2024 · jupitrr.com

  • IA

    Hey there HN! We’re Joe and Stopa, and today we’re open sourcing InstantDB, a client-side database that makes it easy to build real-time and collaborative apps like Notion and Figma. Building modern apps these days involves a lot of schleps. For a basic CRUD app you need to spin up servers, wire up endpoints, integrate auth, add permissions, and then marshal data from the backend to the frontend and back again. If you want to deliver a buttery smooth user experience, you’ll need to add optimistic updates and rollbacks. We do these steps over and over for every feature we build, which can…

    Dev tools · 2024 · github.com