Fast implementation of asyncio event loop on top of libuv
Project description
uvloop is a fast, drop-in replacement of the built-in asyncio event loop. uvloop is implemented in Cython and uses libuv under the hood.
The project documentation can be found here. Please also check out the wiki.
Performance
uvloop makes asyncio 2-4x faster.
The above chart shows the performance of an echo server with different message sizes. The sockets benchmark uses loop.sock_recv() and loop.sock_sendall() methods; the streams benchmark uses asyncio high-level streams, created by the asyncio.start_server() function; and the protocol benchmark uses loop.create_server() with a simple echo protocol. Read more about uvloop in a blog post about it.
Installation
uvloop requires Python 3.8 or greater and is available on PyPI. Use pip to install it:
$ pip install uvloop
Note that it is highly recommended to upgrade pip before installing uvloop with:
$ pip install -U pip
Using uvloop
As of uvloop 0.18, the preferred way of using it is via the uvloop.run() helper function:
import uvloop
async def main():
# Main entry-point.
...
uvloop.run(main())
uvloop.run() works by simply configuring asyncio.run() to use uvloop, passing all of the arguments to it, such as debug, e.g. uvloop.run(main(), debug=True).
With Python 3.11 and earlier the following alternative snippet can be used:
import asyncio
import sys
import uvloop
async def main():
# Main entry-point.
...
if sys.version_info >= (3, 11):
with asyncio.Runner(loop_factory=uvloop.new_event_loop) as runner:
runner.run(main())
else:
uvloop.install()
asyncio.run(main())
Building From Source
To build uvloop, you’ll need Python 3.8 or greater:
Clone the repository:
$ git clone --recursive git@github.com:MagicStack/uvloop.git $ cd uvloop
Create a virtual environment and activate it:
$ python3 -m venv uvloop-dev $ source uvloop-dev/bin/activate
Install development dependencies:
$ pip install -e .[dev]
Build and run tests:
$ make $ make test
License
uvloop is dual-licensed under MIT and Apache 2.0 licenses.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for uvloop-0.21.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5c39f217ab3c663dc699c04cbd50c13813e31d917642d459fdcec07555cc553 |
|
MD5 | c6ff1946ac01015c088760a264227235 |
|
BLAKE2b-256 | 639a0962b05b308494e3202d3f794a6e85abe471fe3cafdbcf95c2e8c713aabd |
Hashes for uvloop-0.21.0-cp313-cp313-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd53ecc9a0f3d87ab847503c2e1552b690362e005ab54e8a48ba97da3924c0dc |
|
MD5 | f9a4f386364854075db442b0d99f3acb |
|
BLAKE2b-256 | 475766f061ee118f413cd22a656de622925097170b9380b30091b78ea0c6ea75 |
Hashes for uvloop-0.21.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3df876acd7ec037a3d005b3ab85a7e4110422e4d9c1571d4fc89b0fc41b6816 |
|
MD5 | 68a354f3b0b8245e2737ea3b068574a8 |
|
BLAKE2b-256 | d219f5b78616566ea68edd42aacaf645adbf71fbd83fc52281fba555dc27e3f1 |
Hashes for uvloop-0.21.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ee4d4ef48036ff6e5cfffb09dd192c7a5027153948d85b8da7ff705065bacc6 |
|
MD5 | 309bb0177d769761672cf4c5f36d2f54 |
|
BLAKE2b-256 | 50940a687f39e78c4c1e02e3272c6b2ccdb4e0085fda3b8352fecd0410ccf915 |
Hashes for uvloop-0.21.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 787ae31ad8a2856fc4e7c095341cccc7209bd657d0e71ad0dc2ea83c4a6fa8af |
|
MD5 | ce3b52a28d8fa3baa3a9de3153be9287 |
|
BLAKE2b-256 | 930db0038d5a469f94ed8f2b2fce2434a18396d8fbfb5da85a0a9781ebbdec14 |
Hashes for uvloop-0.21.0-cp313-cp313-macosx_10_13_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd55dfcc2a512316e65f16e503e9e450cab148ef11df4e4e679b5e8253a5281 |
|
MD5 | 8d3abc5ab29394ace85c28f6c9c1d045 |
|
BLAKE2b-256 | 3f8d2cbef610ca21539f0f36e2b34da49302029e7c9f09acef0b1c3b5839412b |
Hashes for uvloop-0.21.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 183aef7c8730e54c9a3ee3227464daed66e37ba13040bb3f350bc2ddc040f22f |
|
MD5 | 0aea6bdf3a970e2bb8fdd016a43d711b |
|
BLAKE2b-256 | 8febf7032be105877bcf924709c97b1bf3b90255b4ec251f9340cef912559f28 |
Hashes for uvloop-0.21.0-cp312-cp312-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 461d9ae6660fbbafedd07559c6a2e57cd553b34b0065b6550685f6653a98c1cb |
|
MD5 | 3ad810220e826f672da3c33b0a223c3b |
|
BLAKE2b-256 | ce0cf07435a18a4b94ce6bd0677d8319cd3de61f3a9eeb1e5f8ab4e8b5edfcb3 |
Hashes for uvloop-0.21.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86975dca1c773a2c9864f4c52c5a55631038e387b47eaf56210f873887b6c8dc |
|
MD5 | fb5d3964130eaa0b98ca4d7181505513 |
|
BLAKE2b-256 | 06a7b4e6a19925c900be9f98bec0a75e6e8f79bb53bdeb891916609ab3958967 |
Hashes for uvloop-0.21.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa4dcdbd9ae0a372f2167a207cd98c9f9a1ea1188a8a526431eef2f8116cc8d |
|
MD5 | 649bc15b4786ce5c9ab28dd4800c0f86 |
|
BLAKE2b-256 | a6efa02ec5da49909dbbfb1fd205a9a1ac4e88ea92dcae885e7c961847cd51e2 |
Hashes for uvloop-0.21.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7089d2dc73179ce5ac255bdf37c236a9f914b264825fdaacaded6990a7fb4c2 |
|
MD5 | 0e486dfe14e5b969e80de4adfd1eae01 |
|
BLAKE2b-256 | 433e92c03f4d05e50f09251bd8b2b2b584a2a7f8fe600008bcc4523337abe676 |
Hashes for uvloop-0.21.0-cp312-cp312-macosx_10_13_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 359ec2c888397b9e592a889c4d72ba3d6befba8b2bb01743f72fffbde663b59c |
|
MD5 | 38d5ba67768a0b3d39b29d85b1f31a1f |
|
BLAKE2b-256 | 8c4c03f93178830dc7ce8b4cdee1d36770d2f5ebb6f3d37d354e061eefc73545 |
Hashes for uvloop-0.21.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4509360fcc4c3bd2c70d87573ad472de40c13387f5fda8cb58350a1d7475e58d |
|
MD5 | 1fe2cbaa2b0b1f64378712f6fe9d34a7 |
|
BLAKE2b-256 | dae25cf6ef37e3daf2f06e651aae5ea108ad30df3cb269102678b61ebf1fdf42 |
Hashes for uvloop-0.21.0-cp311-cp311-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa0e6291d91649c6ba4ed4b2f982f9fa165b5bbd50a9e203c416a2797bab3c6 |
|
MD5 | 18fb116c7ec7e4536319fb34cb6f9aa6 |
|
BLAKE2b-256 | 30bf08ad29979a936d63787ba47a540de2132169f140d54aa25bc8c3df3e67f4 |
Hashes for uvloop-0.21.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a375441696e2eda1c43c44ccb66e04d61ceeffcd76e4929e527b7fa401b90fb |
|
MD5 | e592ae835bfa2f7fbaa831700cd1e440 |
|
BLAKE2b-256 | 8aca0864176a649838b838f36d44bf31c451597ab363b60dc9e09c9630619d41 |
Hashes for uvloop-0.21.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9fb766bb57b7388745d8bcc53a359b116b8a04c83a2288069809d2b3466c37e |
|
MD5 | b364dc5c8c17df7d8e6f5ae8c03eb5e9 |
|
BLAKE2b-256 | eeea0bfae1aceb82a503f358d8d2fa126ca9dbdb2ba9c7866974faec1cb5875c |
Hashes for uvloop-0.21.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0878c2640cf341b269b7e128b1a5fed890adc4455513ca710d77d5e93aa6d6a0 |
|
MD5 | 36e08a12773f03078db0dfc30595a7a6 |
|
BLAKE2b-256 | 8c7c1517b0bbc2dbe784b563d6ab54f2ef88c890fdad77232c98ed490aa07132 |
Hashes for uvloop-0.21.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0f3fa6200b3108919f8bdabb9a7f87f20e7097ea3c543754cabc7d717d95cf8 |
|
MD5 | a5f962e0532ed200ab46bb17440c9097 |
|
BLAKE2b-256 | 57a74cf0334105c1160dd6819f3297f8700fda7fc30ab4f61fbf3e725acbc7cc |
Hashes for uvloop-0.21.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67dd654b8ca23aed0a8e99010b4c34aca62f4b7fce88f39d452ed7622c94845c |
|
MD5 | bd27ba282c3342008eacee8359f62c95 |
|
BLAKE2b-256 | 26ddc7179618e46092a77e036650c1f056041a028a35c4d76945089fcfc38af8 |
Hashes for uvloop-0.21.0-cp310-cp310-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10d66943def5fcb6e7b37310eb6b5639fd2ccbc38df1177262b0640c3ca68c1f |
|
MD5 | b04cac7cf17c7d2a06bd2699a15e6260 |
|
BLAKE2b-256 | bffe5e94a977d058a54a19df95f12f7161ab6e323ad49f4dabc28822eb2df7ea |
Hashes for uvloop-0.21.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87c43e0f13022b998eb9b973b5e97200c8b90823454d4bc06ab33829e09fb9bb |
|
MD5 | d292902f1e74cd0fead45ad4514f4595 |
|
BLAKE2b-256 | 61e0f0f8ec84979068ffae132c58c79af1de9cceeb664076beea86d941af1a30 |
Hashes for uvloop-0.21.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f38b2e090258d051d68a5b14d1da7203a3c3677321cf32a95a6f4db4dd8b6f26 |
|
MD5 | 6186e7aa289d9a56ca660efca057f587 |
|
BLAKE2b-256 | f39663695e0ebd7da6c741ccd4489b5947394435e198a1382349c17b1146bb97 |
Hashes for uvloop-0.21.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 196274f2adb9689a289ad7d65700d37df0c0930fd8e4e743fa4834e850d7719d |
|
MD5 | ea2904bc437b757efc9b423bd1973e07 |
|
BLAKE2b-256 | 355a62d5800358a78cc25c8a6c72ef8b10851bdb8cca22e14d9c74167b7f86da |
Hashes for uvloop-0.21.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec7e6b09a6fdded42403182ab6b832b71f4edaf7f37a9a0e371a01db5f0cb45f |
|
MD5 | dd3368e9e5dd7569892c55738c59421b |
|
BLAKE2b-256 | 3d7644a55515e8c9505aa1420aebacf4dd82552e5e15691654894e90d0bd051a |
Hashes for uvloop-0.21.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d1f581393673ce119355d56da84fe1dd9d2bb8b3d13ce792524e1607139feff |
|
MD5 | 6be78d694c7fbc1cf3e8eba26cc4dd0d |
|
BLAKE2b-256 | 1a5c6ba221bb60f1e6474474102e17e38612ec7a06dc320e22b687ab563d877f |
Hashes for uvloop-0.21.0-cp39-cp39-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 221f4f2a1f46032b403bf3be628011caf75428ee3cc204a22addf96f586b19fd |
|
MD5 | 5f5dd634fe1e185b1667c14e4d62d159 |
|
BLAKE2b-256 | e124a5da6aba58f99aed5255eca87d58d1760853e8302d390820cc29058408e3 |
Hashes for uvloop-0.21.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88cb67cdbc0e483da00af0b2c3cdad4b7c61ceb1ee0f33fe00e09c81e3a6cb75 |
|
MD5 | 23cc3b18c3574ff5715b4b652c274750 |
|
BLAKE2b-256 | b8c0392e235e4100ae3b95b5c6dac77f82b529d2760942b1e7e0981e5d8e895d |
Hashes for uvloop-0.21.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53e420a3afe22cdcf2a0f4846e377d16e718bc70103d7088a4f7623567ba5fb0 |
|
MD5 | 9d05b4362992accaf4878145be2e911b |
|
BLAKE2b-256 | 2d1a9fbc2b1543d0df11f7aed1632f64bdf5ecc4053cf98cdc9edb91a65494f9 |
Hashes for uvloop-0.21.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46923b0b5ee7fc0020bef24afe7836cb068f5050ca04caf6b487c513dc1a20b2 |
|
MD5 | f675d8e4f771e3b0fbc945f7201897bd |
|
BLAKE2b-256 | 012ee128c66106af9728f86ebfeeb52af27ecd3cb09336f3e2f3e06053707a15 |
Hashes for uvloop-0.21.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c097078b8031190c934ed0ebfee8cc5f9ba9642e6eb88322b9958b649750f72b |
|
MD5 | 946f7b6f8eea63453336a1b76425ebbb |
|
BLAKE2b-256 | 3ca4646a9d0edff7cde25fc1734695d3dfcee0501140dd0e723e4df3f0a50acb |
Hashes for uvloop-0.21.0-cp38-cp38-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10da8046cc4a8f12c91a1c39d1dd1585c41162a15caaef165c2174db9ef18bdc |
|
MD5 | 35eebf7c0bd6534a5a5c685a0e726eb0 |
|
BLAKE2b-256 | 4f9f07c88dd3e76171e7808ff63719af12ee8bb6ea56fe40ea274da606ae5ade |
Hashes for uvloop-0.21.0-cp38-cp38-musllinux_1_2_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 460def4412e473896ef179a1671b40c039c7012184b627898eea5072ef6f017a |
|
MD5 | e49e4ebcd2f57ceee54c8ff14d803747 |
|
BLAKE2b-256 | 1a803f57f2458460501b709aec7c7e7f303b81b38ca35f786b41bf402b3349e8 |
Hashes for uvloop-0.21.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e678ad6fe52af2c58d2ae3c73dc85524ba8abe637f134bf3564ed07f555c5e79 |
|
MD5 | f754c5a82f4e3e34dd7ede7c7a28f37f |
|
BLAKE2b-256 | 9a4672fb3fbb457cd68632542ecc7fa191a17dac501f70b7f3786a18912bbe0e |
Hashes for uvloop-0.21.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0ce1b49560b1d2d8a2977e3ba4afb2414fb46b86a1b64056bc4ab929efdafbe |
|
MD5 | 2f28be755c94625edb2d8dac893e8b10 |
|
BLAKE2b-256 | 622329da7a6d3fba8dfe375ea48a8c3a3e5562b770d24008d79a7a6e0150d7c1 |
Hashes for uvloop-0.21.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc09f0ff191e61c2d592a752423c767b4ebb2986daa9ed62908e2b1b9a9ae206 |
|
MD5 | d11cdd0846258a23b28b66cf0eb7a528 |
|
BLAKE2b-256 | 78c910272e791562be6cfc4ee127883087de6443fede8f010b019ca0fdf841c1 |
Hashes for uvloop-0.21.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17df489689befc72c39a08359efac29bbee8eee5209650d4b9f34df73d22e414 |
|
MD5 | f36eb358798c151880d33383e528971b |
|
BLAKE2b-256 | b57b85a2c8231eac451ef9caecba8715295820c9f94fb51c4f5b2e39c79a5c11 |