Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

asyncio-atexit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asyncio-atexit

Like atexit, but for asyncio

  • 1.0.1
  • PyPI
  • Socket score

Maintainers
1

asyncio atexit

Adds atexit functionality to asyncio:

import asyncio_atexit

async def close_db():
    await db_connection.close()

asyncio_atexit.register(close_db)

atexit is part of the standard library, and gives you a way to register functions to call when the interpreter exits.

asyncio doesn't have equivalent functionality to register functions when the event loop exits:

This package adds functionality that can be considered equivalent to atexit.register, but tied to the event loop lifecycle. It:

  1. accepts both coroutines and synchronous functions
  2. should be called from a running event loop
  3. calls registered cleanup functions when the event loop closes
  4. only works if the application running the event loop calls close()

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc