All Projects → tiangolo → asyncer

tiangolo / asyncer

Licence: MIT License
Asyncer, async and await, focused on developer experience.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to asyncer

fastapi-azure-auth
Easy and secure implementation of Azure AD for your FastAPI APIs 🔒 B2C, single- and multi-tenant support.
Stars: ✭ 174 (-69.58%)
Mutual labels:  asyncio, trio, anyio
python-socks
Core proxy client (SOCKS4, SOCKS5, HTTP) functionality for Python
Stars: ✭ 40 (-93.01%)
Mutual labels:  asyncio, trio, anyio
Dnspython
a powerful DNS toolkit for python
Stars: ✭ 1,838 (+221.33%)
Mutual labels:  asyncio, trio
Httpx
A next generation HTTP client for Python. 🦋
Stars: ✭ 8,052 (+1307.69%)
Mutual labels:  asyncio, trio
sniffio
Sniff out which async library your code is running under
Stars: ✭ 75 (-86.89%)
Mutual labels:  asyncio, trio
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-96.85%)
Mutual labels:  asyncio, trio
aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (-95.45%)
Mutual labels:  asyncio
aioimaplib
Python asyncio IMAP4rev1 client library
Stars: ✭ 77 (-86.54%)
Mutual labels:  asyncio
waio
Is a pretty simple and fully asynchronous framework for WhatsApp Business API written in Python 3.7 with asyncio and aiohttp.
Stars: ✭ 18 (-96.85%)
Mutual labels:  asyncio
deeppyer
Image deepfryer written in Python.
Stars: ✭ 36 (-93.71%)
Mutual labels:  asyncio
AmimeWatch
Telegram bot made in Python 3 using the @pyrogram framework.
Stars: ✭ 19 (-96.68%)
Mutual labels:  asyncio
fastapi-sqlalchemy-1.4-async
https://rogulski.it/blog/sqlalchemy-14-async-orm-with-fastapi/
Stars: ✭ 17 (-97.03%)
Mutual labels:  asyncio
Sharingan
We will try to find your visible basic footprint from social media as much as possible - 😤 more sites is comming soon
Stars: ✭ 13 (-97.73%)
Mutual labels:  asyncio
fastapi-boilerplate
FastAPI boilerplate for real world production
Stars: ✭ 145 (-74.65%)
Mutual labels:  asyncio
findssh
Asyncio concurrent Python finds SSH servers (or other services with open ports) on an IPv4 subnet, WITHOUT NMAP
Stars: ✭ 36 (-93.71%)
Mutual labels:  asyncio
sanic-url-shortener
Example of how to use Sanic and asyncpg (PostgreSQL)
Stars: ✭ 16 (-97.2%)
Mutual labels:  asyncio
PepperBot
An intuitive multi-platform bot framework, write once, run everywhere. 一个符合直觉的跨社交平台机器人框架,轻松地在平台间传递消息,支持QQ、微信
Stars: ✭ 21 (-96.33%)
Mutual labels:  asyncio
aiohttp-jwt
aiohttp middleware and helper utils for working with JSON web token.
Stars: ✭ 70 (-87.76%)
Mutual labels:  asyncio
rigor
HTTP-based DSL for for validating RESTful APIs
Stars: ✭ 65 (-88.64%)
Mutual labels:  asyncio
python-libmaas
Official python client library for MAAS
Stars: ✭ 45 (-92.13%)
Mutual labels:  asyncio

Asyncer

Asyncer, async and await, focused on developer experience.

Test Publish Coverage Package version


Documentation: https://asyncer.tiangolo.com

Source Code: https://github.com/tiangolo/asyncer


Asyncer is a small library built on top of AnyIO.

Asyncer has a small number of utility functions that allow working with async, await, and concurrent code in a more convenient way under my (@tiangolo - Sebastián Ramírez) very opinionated and subjective point of view.

The main goal of Asyncer is to improve developer experience by providing better support for autocompletion and inline errors in the editor, and more certainty that the code is bug-free by providing better support for type checking tools like mypy.

Asyncer also tries to improve convenience and simplicity when working with async code mixed with regular blocking code, allowing to use them together in a simpler way... again, under my very subjective point of view.

🚨 Warning

This small library only exists to be able to use these utility functions until (and if) they are integrated into AnyIO.

It will probably take some time for that to happen (or to be decided if it will be included or not).

So I made this to be able to use these ideas right now. 🤓

Can I Use It?

Yes 🎉 (but continue reading).

You can use this and evaluate the library API design I'm proposing. It will probably be useful to know if it works and is useful for you (I hope so).

But still, consider this lab material, expect it to change a bit. 🧪

If you use it, pin the exact Asyncer version for your project, to make sure it all works.

Have tests for your project (as you should, anyway). And upgrade the version once you know that the new version continues to work correctly.

Still, it's just 4 functions, so there's not much to change, if you had to refactor your code to update something it would not be much.

And if you don't want to add asyncer as a dependency to your project, you can also just copy the main file and try out those functions, it's quite small (but in that case you won't get updates easily).

Requirements

As Asyncer is based on AnyIO it will be also installed automatically when you install Asyncer.

Installation

$ pip install asyncer
---> 100%
Successfully installed asyncer anyio

How to Use

You can read more about each of the use cases and utility functions in Asyncer in the tutorial.

As a sneak preview of one of the utilities, you can call sync code from async code using asyncify():

import time

import anyio
from asyncer import asyncify


def do_sync_work(name: str):
    time.sleep(1)
    return f"Hello, {name}"


async def main():
    message = await asyncify(do_sync_work)(name="World")
    print(message)


anyio.run(main)

Asyncer's asyncify() will use AnyIO underneath to do the smart thing, avoid blocking the main async event loop, and run the sync/blocking function in a worker thread.

Editor Support

Everything in Asyncer is designed to get the best developer experience possible, with the best editor support.

  • Autocompletion for function arguments:

  • Autocompletion for return values:

  • Inline errors in editor:

  • Support for tools like mypy, that can help you verify that your code is correct, and prevent many bugs.

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].