winloop 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {winloop-0.1.3/winloop.egg-info → winloop-0.1.5}/PKG-INFO +64 -39
- {winloop-0.1.3 → winloop-0.1.5}/README.md +32 -31
- winloop-0.1.5/pyproject.toml +79 -0
- winloop-0.1.5/setup.py +289 -0
- {winloop-0.1.3 → winloop-0.1.5}/tests/test_aiodns.py +5 -6
- {winloop-0.1.3 → winloop-0.1.5}/tests/test_aiohttp.py +2 -0
- {winloop-0.1.3 → winloop-0.1.5}/tests/test_aiomultiprocess.py +11 -11
- winloop-0.1.5/tests/test_base.py +972 -0
- winloop-0.1.5/tests/test_context.py +791 -0
- {winloop-0.1.3 → winloop-0.1.5}/tests/test_cython.py +7 -4
- winloop-0.1.5/tests/test_dealloc.py +61 -0
- winloop-0.1.5/tests/test_dns.py +256 -0
- {winloop-0.1.3 → winloop-0.1.5}/tests/test_executors.py +5 -1
- winloop-0.1.5/tests/test_fs_event.py +105 -0
- winloop-0.1.5/tests/test_libuv_api.py +23 -0
- winloop-0.1.5/tests/test_pipes.py +304 -0
- winloop-0.1.5/tests/test_process.py +1047 -0
- winloop-0.1.5/tests/test_process_spawning.py +115 -0
- winloop-0.1.5/tests/test_regr1.py +120 -0
- winloop-0.1.5/tests/test_runner.py +39 -0
- winloop-0.1.5/tests/test_signals.py +470 -0
- winloop-0.1.5/tests/test_sockets.py +767 -0
- winloop-0.1.5/tests/test_sourcecode.py +73 -0
- winloop-0.1.5/tests/test_tcp.py +3219 -0
- winloop-0.1.5/tests/test_testbase.py +51 -0
- winloop-0.1.5/tests/test_udp.py +414 -0
- winloop-0.1.5/tests/test_unix.py +700 -0
- {winloop-0.1.3 → winloop-0.1.5}/winloop/__init__.py +47 -54
- {winloop-0.1.3 → winloop-0.1.5}/winloop/_noop.py +0 -1
- {winloop-0.1.3 → winloop-0.1.5}/winloop/_testbase.py +99 -91
- {winloop-0.1.3 → winloop-0.1.5}/winloop/_version.py +1 -1
- {winloop-0.1.3 → winloop-0.1.5}/winloop/loop.c +55332 -53126
- {winloop-0.1.3 → winloop-0.1.5}/winloop/loop.pyi +15 -27
- winloop-0.1.5/winloop/py.typed +0 -0
- {winloop-0.1.3 → winloop-0.1.5/winloop.egg-info}/PKG-INFO +64 -39
- winloop-0.1.5/winloop.egg-info/SOURCES.txt +41 -0
- winloop-0.1.5/winloop.egg-info/not-zip-safe +1 -0
- winloop-0.1.5/winloop.egg-info/requires.txt +19 -0
- {winloop-0.1.3 → winloop-0.1.5}/winloop.egg-info/top_level.txt +0 -1
- winloop-0.1.3/pyproject.toml +0 -9
- winloop-0.1.3/setup.py +0 -105
- winloop-0.1.3/tests/__init__.py +0 -1
- winloop-0.1.3/tests/__main__.py +0 -16
- winloop-0.1.3/winloop/includes/__init__.py +0 -23
- winloop-0.1.3/winloop/includes/context.h +0 -38
- winloop-0.1.3/winloop.egg-info/SOURCES.txt +0 -25
- winloop-0.1.3/winloop.egg-info/requires.txt +0 -1
- {winloop-0.1.3 → winloop-0.1.5}/LICENSE-APACHE +0 -0
- {winloop-0.1.3 → winloop-0.1.5}/LICENSE-MIT +0 -0
- {winloop-0.1.3 → winloop-0.1.5}/setup.cfg +0 -0
- {winloop-0.1.3 → winloop-0.1.5}/winloop.egg-info/dependency_links.txt +0 -0
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: winloop
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Windows version of uvloop
|
|
5
5
|
Author: Vizonex
|
|
6
|
-
License: MIT
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: github, https://github.com/Vizonex/Winloop
|
|
8
|
+
Keywords: asyncio,networking
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: Framework :: AsyncIO
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: POSIX
|
|
15
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
9
19
|
Classifier: Programming Language :: Python :: 3.9
|
|
10
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
11
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier:
|
|
13
|
-
Classifier:
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Topic :: System :: Networking
|
|
25
|
+
Requires-Python: >=3.8.0
|
|
14
26
|
Description-Content-Type: text/markdown
|
|
15
27
|
License-File: LICENSE-APACHE
|
|
16
28
|
License-File: LICENSE-MIT
|
|
17
|
-
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: aiohttp>=3.8.1; python_version < "3.12" and extra == "test"
|
|
31
|
+
Requires-Dist: aiohttp==3.9.0b0; python_version >= "3.12" and extra == "test"
|
|
32
|
+
Requires-Dist: flake8~=5.0; extra == "test"
|
|
33
|
+
Requires-Dist: psutil; extra == "test"
|
|
34
|
+
Requires-Dist: pycodestyle~=2.9.0; extra == "test"
|
|
35
|
+
Requires-Dist: pyOpenSSL~=23.0.0; extra == "test"
|
|
36
|
+
Requires-Dist: mypy>=0.800; extra == "test"
|
|
37
|
+
Requires-Dist: Cython<0.30.0,>=0.29.36; extra == "test"
|
|
38
|
+
Provides-Extra: docs
|
|
39
|
+
Requires-Dist: Sphinx~=4.1.2; extra == "docs"
|
|
40
|
+
Requires-Dist: sphinxcontrib-asyncio~=0.3.0; extra == "docs"
|
|
41
|
+
Requires-Dist: sphinx_rtd_theme~=0.5.2; extra == "docs"
|
|
18
42
|
|
|
19
43
|
<img src="https://raw.githubusercontent.com/Vizonex/Winloop/main/winloop.png" width="200px"/>
|
|
20
44
|
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
|
21
45
|
|
|
22
46
|
# Winloop
|
|
23
|
-
An Alternative library for uvloop
|
|
24
|
-
I never really liked the fact that I couldn't make anything run faster escpecially when you have fiber internet connections in place and you've done all the optimizations you could possibly think of. It always felt disappointing when `libuv` is
|
|
47
|
+
An Alternative library for uvloop compatibility with windows because let's face it. Window's python asyncio standard libaray is garabage escpecially when Windows Defender decides to eat half your ram.
|
|
48
|
+
I never really liked the fact that I couldn't make anything run faster escpecially when you have fiber internet connections in place and you've done all the optimizations you could possibly think of. It always felt disappointing when `libuv` is available for windows [but windows was never compatible with uvloop.](https://github.com/MagicStack/uvloop/issues/14#issuecomment-575826367])
|
|
25
49
|
|
|
26
|
-
Because nobody was willing to step in after so many years of waiting, I went ahead and downloaded the source code for uvloop and started modifying the source code to be windows
|
|
50
|
+
Because nobody was willing to step in after so many years of waiting, I went ahead and downloaded the source code for uvloop and started modifying the source code to be windows compatible by carefully removing and changing parts that were not made for windows. Many hours of research went into making this library exist.
|
|
27
51
|
|
|
28
52
|
The differences with __uvloop__ is that forking has been fully disabled and some smaller api calls had to be changed, error handling has been carefully modified and subprocesses instead release the gil instead of forking out...
|
|
29
53
|
|
|
30
|
-
There is a
|
|
54
|
+
There is a performance increase of about 5 times vs using the `WindowsSelectorEventLoopPolicy` and `WindowsProactorEventLoopPolicy` which have been known to trigger ssl problems in `python 3.9`. Winloop is a very good replacement for solving those ssl problem as well. This library also has comparable performance to it's brother uvloop.
|
|
55
|
+
|
|
31
56
|
|
|
32
57
|
|
|
33
58
|
## How to install Winloop on your Windows Operating System
|
|
@@ -36,24 +61,23 @@ There is a perfromance increase of about 5 times vs using the `WindowsSelectorEv
|
|
|
36
61
|
pip install winloop
|
|
37
62
|
```
|
|
38
63
|
|
|
39
|
-
You can also clone the reposity and build the extension yourself by running the command below if you wish to use or build this library locally, Note that you will need Cython and The Visual C++ extensions
|
|
40
|
-
to compile this library on your own.
|
|
64
|
+
You can also clone the reposity and build the extension yourself by running the command below if you wish to use or build this library locally, Note that you will need Cython and The Visual C++ extensions
|
|
65
|
+
to compile this library on your own.
|
|
41
66
|
|
|
42
67
|
```
|
|
43
|
-
python setup.py build_ext --inplace
|
|
68
|
+
python setup.py build_ext --inplace
|
|
44
69
|
```
|
|
45
70
|
|
|
46
71
|
## Issues Reporting
|
|
47
72
|
|
|
48
73
|
If you find any bugs with this library be sure to open up an issue to our github repo. Me and other contributors will be happy try to help you figure out and diagnose your problems.
|
|
49
74
|
|
|
50
|
-
## Making pull requests
|
|
75
|
+
## Making pull requests
|
|
51
76
|
We encourage anyone to make pull-requests to winloop from spelling mistakes to vulnerability patches. Every little bit helps keep this library maintained and alive.
|
|
52
77
|
Make sure that you are able to compile the library with the steps shown above. We plan to implement a nightly workflow to verify one's pull request in the future.
|
|
53
78
|
|
|
54
79
|
|
|
55
80
|
|
|
56
|
-
|
|
57
81
|
```python
|
|
58
82
|
try:
|
|
59
83
|
import aiohttp
|
|
@@ -72,7 +96,7 @@ import sys
|
|
|
72
96
|
class TestAioHTTP(unittest.TestCase):
|
|
73
97
|
def __init__(self, methodName: str = "test_aiohttp_basic_1") -> None:
|
|
74
98
|
super().__init__(methodName)
|
|
75
|
-
|
|
99
|
+
|
|
76
100
|
|
|
77
101
|
def setUp(self):
|
|
78
102
|
self.loop = asyncio.get_event_loop()
|
|
@@ -170,42 +194,43 @@ if __name__ == "__main__":
|
|
|
170
194
|
# asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy
|
|
171
195
|
# asyncio.DefaultEventLoopPolicy = asyncio.WindowsProactorEventLoopPolicy
|
|
172
196
|
unittest.main()
|
|
173
|
-
# Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
|
|
197
|
+
# Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
|
|
174
198
|
print("testing again but with winloop enabled")
|
|
175
199
|
winloop.install()
|
|
176
200
|
unittest.main()
|
|
177
201
|
```
|
|
178
202
|
|
|
179
|
-
The benchmarks for the code above are as follows
|
|
203
|
+
The benchmarks for the code above are as follows
|
|
180
204
|
|
|
181
205
|
## Benchmarks
|
|
182
206
|
|
|
183
|
-
### TCP Connections
|
|
207
|
+
### TCP Connections
|
|
184
208
|
-------------------
|
|
185
209
|
|
|
186
|
-
| Asyncio Event Loop Policy | Time (in Seconds) |
|
|
210
|
+
| Asyncio Event Loop Policy | Time (in Seconds) |
|
|
187
211
|
|-----------------------------------|-----------------------|
|
|
188
212
|
| WinLoopPolicy | 0.493s |
|
|
189
213
|
| WindowsProactorEventLoopPolicy | 2.510s |
|
|
190
214
|
| WindowsSelectorEventLoopPolicy | 2.723s |
|
|
191
215
|
|
|
192
216
|
|
|
193
|
-
That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
|
|
217
|
+
That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
|
|
194
218
|
I modify more of the current test suites made by uvloop...
|
|
195
219
|
|
|
196
220
|
|
|
197
|
-
## How to Use Winloop with Fastapi
|
|
221
|
+
## How to Use Winloop with Fastapi
|
|
198
222
|
|
|
199
223
|
This was a cool little script I put together Just to make fastapi that much faster to handle
|
|
200
224
|
|
|
201
225
|
```python
|
|
202
226
|
|
|
227
|
+
# TODO this code example is deprecated
|
|
203
228
|
from fastapi import FastAPI
|
|
204
229
|
from fastapi.responses import HTMLResponse
|
|
205
|
-
import winloop
|
|
230
|
+
import winloop
|
|
206
231
|
import uvicorn
|
|
207
|
-
import asyncio
|
|
208
|
-
import datetime
|
|
232
|
+
import asyncio
|
|
233
|
+
import datetime
|
|
209
234
|
|
|
210
235
|
app = FastAPI()
|
|
211
236
|
|
|
@@ -220,7 +245,7 @@ async def test_get_request():
|
|
|
220
245
|
return HTMLResponse("<html><body><h1>FAST API WORKS WITH WINLOOP!</h1></body></html>")
|
|
221
246
|
|
|
222
247
|
|
|
223
|
-
# starllete will use asyncio.to_thread() so that this can remain asynchronous
|
|
248
|
+
# starllete will use asyncio.to_thread() so that this can remain asynchronous
|
|
224
249
|
@app.get("/date")
|
|
225
250
|
def test_dynamic_response():
|
|
226
251
|
return str(datetime.datetime.now())
|
|
@@ -237,14 +262,14 @@ if __name__ == "__main__":
|
|
|
237
262
|
```
|
|
238
263
|
|
|
239
264
|
|
|
240
|
-
## How To Use Winloop When Uvloop is not
|
|
265
|
+
## How To Use Winloop When Uvloop is not available
|
|
241
266
|
|
|
242
267
|
```python
|
|
243
268
|
|
|
244
|
-
# Here's A small Example of using winloop when uvloop is not
|
|
269
|
+
# Here's A small Example of using winloop when uvloop is not available to us
|
|
245
270
|
import sys
|
|
246
271
|
import aiohttp
|
|
247
|
-
import asyncio
|
|
272
|
+
import asyncio
|
|
248
273
|
|
|
249
274
|
async def main():
|
|
250
275
|
async with aiohttp.ClientSession("https://httpbin.org") as client:
|
|
@@ -256,11 +281,11 @@ if __name__ == "__main__":
|
|
|
256
281
|
from winloop import run
|
|
257
282
|
else:
|
|
258
283
|
# if we're on apple or linux do this instead
|
|
259
|
-
from uvloop import run
|
|
284
|
+
from uvloop import run
|
|
260
285
|
run(main())
|
|
261
286
|
```
|
|
262
|
-
|
|
263
|
-
|
|
287
|
+
|
|
288
|
+
|
|
264
289
|
## TODO-List
|
|
265
290
|
|
|
266
291
|
- Update Fastapi Example to a more recent version of fastapi
|
|
@@ -271,19 +296,19 @@ if __name__ == "__main__":
|
|
|
271
296
|
|
|
272
297
|
- Drop All `DEF` Macros, I'm currently seeking help on replacements for macros where all the variables are known about at compile-time
|
|
273
298
|
|
|
274
|
-
- Adding in the
|
|
299
|
+
- Adding in the necessary hooks for pyinstaller to compile this fast library to executable code even though hooks have been known to inflate the size of the `.exe` files. This is because calling hidden-imports for all the `__init__.py` modules might annoy some developers. (Luckily I'm aware of this issue because I've been doing this myself...)
|
|
275
300
|
|
|
276
301
|
- write a workflow for compiling libuv on different versions of windows when distributing out pypi wheels.
|
|
277
302
|
|
|
278
|
-
- write a workflow for nightly builds if
|
|
303
|
+
- write a workflow for nightly builds if necessary for verification of pull requests.
|
|
279
304
|
|
|
280
305
|
- Sphinx Styled Documentation (Maybe I'm thinking about it...)
|
|
281
306
|
|
|
282
|
-
- Update benchmarks (They are old) can't
|
|
307
|
+
- Update benchmarks (They are old) can't believe I maintained this project for over a year now...
|
|
283
308
|
|
|
284
309
|
## Videos
|
|
285
310
|
- By me: https://www.youtube.com/watch?v=tz9RYJ6aBZ8 (I might make a tutorial on how to use and install winloop it for those who have reading problems)
|
|
286
|
-
- My Presentation and Virtual Confrence: https://www.youtube.com/watch?v=Cbb6trkKWXY
|
|
311
|
+
- My Presentation and Virtual Confrence: https://www.youtube.com/watch?v=Cbb6trkKWXY
|
|
287
312
|
|
|
288
313
|
## Contributing
|
|
289
|
-
I put my heart and soul into this library ever since it began and any help is apperciated and means a lot to me.
|
|
314
|
+
I put my heart and soul into this library ever since it began and any help is apperciated and means a lot to me.
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
|
|
3
3
|
|
|
4
4
|
# Winloop
|
|
5
|
-
An Alternative library for uvloop
|
|
6
|
-
I never really liked the fact that I couldn't make anything run faster escpecially when you have fiber internet connections in place and you've done all the optimizations you could possibly think of. It always felt disappointing when `libuv` is
|
|
5
|
+
An Alternative library for uvloop compatibility with windows because let's face it. Window's python asyncio standard libaray is garabage escpecially when Windows Defender decides to eat half your ram.
|
|
6
|
+
I never really liked the fact that I couldn't make anything run faster escpecially when you have fiber internet connections in place and you've done all the optimizations you could possibly think of. It always felt disappointing when `libuv` is available for windows [but windows was never compatible with uvloop.](https://github.com/MagicStack/uvloop/issues/14#issuecomment-575826367])
|
|
7
7
|
|
|
8
|
-
Because nobody was willing to step in after so many years of waiting, I went ahead and downloaded the source code for uvloop and started modifying the source code to be windows
|
|
8
|
+
Because nobody was willing to step in after so many years of waiting, I went ahead and downloaded the source code for uvloop and started modifying the source code to be windows compatible by carefully removing and changing parts that were not made for windows. Many hours of research went into making this library exist.
|
|
9
9
|
|
|
10
10
|
The differences with __uvloop__ is that forking has been fully disabled and some smaller api calls had to be changed, error handling has been carefully modified and subprocesses instead release the gil instead of forking out...
|
|
11
11
|
|
|
12
|
-
There is a
|
|
12
|
+
There is a performance increase of about 5 times vs using the `WindowsSelectorEventLoopPolicy` and `WindowsProactorEventLoopPolicy` which have been known to trigger ssl problems in `python 3.9`. Winloop is a very good replacement for solving those ssl problem as well. This library also has comparable performance to it's brother uvloop.
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
## How to install Winloop on your Windows Operating System
|
|
@@ -18,24 +19,23 @@ There is a perfromance increase of about 5 times vs using the `WindowsSelectorEv
|
|
|
18
19
|
pip install winloop
|
|
19
20
|
```
|
|
20
21
|
|
|
21
|
-
You can also clone the reposity and build the extension yourself by running the command below if you wish to use or build this library locally, Note that you will need Cython and The Visual C++ extensions
|
|
22
|
-
to compile this library on your own.
|
|
22
|
+
You can also clone the reposity and build the extension yourself by running the command below if you wish to use or build this library locally, Note that you will need Cython and The Visual C++ extensions
|
|
23
|
+
to compile this library on your own.
|
|
23
24
|
|
|
24
25
|
```
|
|
25
|
-
python setup.py build_ext --inplace
|
|
26
|
+
python setup.py build_ext --inplace
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
## Issues Reporting
|
|
29
30
|
|
|
30
31
|
If you find any bugs with this library be sure to open up an issue to our github repo. Me and other contributors will be happy try to help you figure out and diagnose your problems.
|
|
31
32
|
|
|
32
|
-
## Making pull requests
|
|
33
|
+
## Making pull requests
|
|
33
34
|
We encourage anyone to make pull-requests to winloop from spelling mistakes to vulnerability patches. Every little bit helps keep this library maintained and alive.
|
|
34
35
|
Make sure that you are able to compile the library with the steps shown above. We plan to implement a nightly workflow to verify one's pull request in the future.
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
|
|
38
|
-
|
|
39
39
|
```python
|
|
40
40
|
try:
|
|
41
41
|
import aiohttp
|
|
@@ -54,7 +54,7 @@ import sys
|
|
|
54
54
|
class TestAioHTTP(unittest.TestCase):
|
|
55
55
|
def __init__(self, methodName: str = "test_aiohttp_basic_1") -> None:
|
|
56
56
|
super().__init__(methodName)
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
|
|
59
59
|
def setUp(self):
|
|
60
60
|
self.loop = asyncio.get_event_loop()
|
|
@@ -152,42 +152,43 @@ if __name__ == "__main__":
|
|
|
152
152
|
# asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy
|
|
153
153
|
# asyncio.DefaultEventLoopPolicy = asyncio.WindowsProactorEventLoopPolicy
|
|
154
154
|
unittest.main()
|
|
155
|
-
# Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
|
|
155
|
+
# Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
|
|
156
156
|
print("testing again but with winloop enabled")
|
|
157
157
|
winloop.install()
|
|
158
158
|
unittest.main()
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
The benchmarks for the code above are as follows
|
|
161
|
+
The benchmarks for the code above are as follows
|
|
162
162
|
|
|
163
163
|
## Benchmarks
|
|
164
164
|
|
|
165
|
-
### TCP Connections
|
|
165
|
+
### TCP Connections
|
|
166
166
|
-------------------
|
|
167
167
|
|
|
168
|
-
| Asyncio Event Loop Policy | Time (in Seconds) |
|
|
168
|
+
| Asyncio Event Loop Policy | Time (in Seconds) |
|
|
169
169
|
|-----------------------------------|-----------------------|
|
|
170
170
|
| WinLoopPolicy | 0.493s |
|
|
171
171
|
| WindowsProactorEventLoopPolicy | 2.510s |
|
|
172
172
|
| WindowsSelectorEventLoopPolicy | 2.723s |
|
|
173
173
|
|
|
174
174
|
|
|
175
|
-
That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
|
|
175
|
+
That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
|
|
176
176
|
I modify more of the current test suites made by uvloop...
|
|
177
177
|
|
|
178
178
|
|
|
179
|
-
## How to Use Winloop with Fastapi
|
|
179
|
+
## How to Use Winloop with Fastapi
|
|
180
180
|
|
|
181
181
|
This was a cool little script I put together Just to make fastapi that much faster to handle
|
|
182
182
|
|
|
183
183
|
```python
|
|
184
184
|
|
|
185
|
+
# TODO this code example is deprecated
|
|
185
186
|
from fastapi import FastAPI
|
|
186
187
|
from fastapi.responses import HTMLResponse
|
|
187
|
-
import winloop
|
|
188
|
+
import winloop
|
|
188
189
|
import uvicorn
|
|
189
|
-
import asyncio
|
|
190
|
-
import datetime
|
|
190
|
+
import asyncio
|
|
191
|
+
import datetime
|
|
191
192
|
|
|
192
193
|
app = FastAPI()
|
|
193
194
|
|
|
@@ -202,7 +203,7 @@ async def test_get_request():
|
|
|
202
203
|
return HTMLResponse("<html><body><h1>FAST API WORKS WITH WINLOOP!</h1></body></html>")
|
|
203
204
|
|
|
204
205
|
|
|
205
|
-
# starllete will use asyncio.to_thread() so that this can remain asynchronous
|
|
206
|
+
# starllete will use asyncio.to_thread() so that this can remain asynchronous
|
|
206
207
|
@app.get("/date")
|
|
207
208
|
def test_dynamic_response():
|
|
208
209
|
return str(datetime.datetime.now())
|
|
@@ -219,14 +220,14 @@ if __name__ == "__main__":
|
|
|
219
220
|
```
|
|
220
221
|
|
|
221
222
|
|
|
222
|
-
## How To Use Winloop When Uvloop is not
|
|
223
|
+
## How To Use Winloop When Uvloop is not available
|
|
223
224
|
|
|
224
225
|
```python
|
|
225
226
|
|
|
226
|
-
# Here's A small Example of using winloop when uvloop is not
|
|
227
|
+
# Here's A small Example of using winloop when uvloop is not available to us
|
|
227
228
|
import sys
|
|
228
229
|
import aiohttp
|
|
229
|
-
import asyncio
|
|
230
|
+
import asyncio
|
|
230
231
|
|
|
231
232
|
async def main():
|
|
232
233
|
async with aiohttp.ClientSession("https://httpbin.org") as client:
|
|
@@ -238,11 +239,11 @@ if __name__ == "__main__":
|
|
|
238
239
|
from winloop import run
|
|
239
240
|
else:
|
|
240
241
|
# if we're on apple or linux do this instead
|
|
241
|
-
from uvloop import run
|
|
242
|
+
from uvloop import run
|
|
242
243
|
run(main())
|
|
243
244
|
```
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
|
|
246
|
+
|
|
246
247
|
## TODO-List
|
|
247
248
|
|
|
248
249
|
- Update Fastapi Example to a more recent version of fastapi
|
|
@@ -253,19 +254,19 @@ if __name__ == "__main__":
|
|
|
253
254
|
|
|
254
255
|
- Drop All `DEF` Macros, I'm currently seeking help on replacements for macros where all the variables are known about at compile-time
|
|
255
256
|
|
|
256
|
-
- Adding in the
|
|
257
|
+
- Adding in the necessary hooks for pyinstaller to compile this fast library to executable code even though hooks have been known to inflate the size of the `.exe` files. This is because calling hidden-imports for all the `__init__.py` modules might annoy some developers. (Luckily I'm aware of this issue because I've been doing this myself...)
|
|
257
258
|
|
|
258
259
|
- write a workflow for compiling libuv on different versions of windows when distributing out pypi wheels.
|
|
259
260
|
|
|
260
|
-
- write a workflow for nightly builds if
|
|
261
|
+
- write a workflow for nightly builds if necessary for verification of pull requests.
|
|
261
262
|
|
|
262
263
|
- Sphinx Styled Documentation (Maybe I'm thinking about it...)
|
|
263
264
|
|
|
264
|
-
- Update benchmarks (They are old) can't
|
|
265
|
+
- Update benchmarks (They are old) can't believe I maintained this project for over a year now...
|
|
265
266
|
|
|
266
267
|
## Videos
|
|
267
268
|
- By me: https://www.youtube.com/watch?v=tz9RYJ6aBZ8 (I might make a tutorial on how to use and install winloop it for those who have reading problems)
|
|
268
|
-
- My Presentation and Virtual Confrence: https://www.youtube.com/watch?v=Cbb6trkKWXY
|
|
269
|
+
- My Presentation and Virtual Confrence: https://www.youtube.com/watch?v=Cbb6trkKWXY
|
|
269
270
|
|
|
270
271
|
## Contributing
|
|
271
|
-
I put my heart and soul into this library ever since it began and any help is apperciated and means a lot to me.
|
|
272
|
+
I put my heart and soul into this library ever since it began and any help is apperciated and means a lot to me.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "winloop"
|
|
3
|
+
description = "Windows version of uvloop"
|
|
4
|
+
authors = [{name = "Vizonex"}]
|
|
5
|
+
requires-python = '>=3.8.0'
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = {text = "MIT License"}
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
keywords = [
|
|
10
|
+
"asyncio",
|
|
11
|
+
"networking",
|
|
12
|
+
]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Framework :: AsyncIO",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"License :: OSI Approved :: Apache Software License",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: POSIX",
|
|
20
|
+
"Operating System :: MacOS :: MacOS X",
|
|
21
|
+
"Operating System :: Microsoft :: Windows",
|
|
22
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
+
"Programming Language :: Python :: 3.8",
|
|
24
|
+
"Programming Language :: Python :: 3.9",
|
|
25
|
+
"Programming Language :: Python :: 3.10",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
29
|
+
"Topic :: System :: Networking",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
github = "https://github.com/Vizonex/Winloop"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
test = [
|
|
37
|
+
# pycodestyle is a dependency of flake8, but it must be frozen because
|
|
38
|
+
# their combination breaks too often
|
|
39
|
+
# (example breakage: https://gitlab.com/pycqa/flake8/issues/427)
|
|
40
|
+
'aiohttp>=3.8.1; python_version < "3.12"',
|
|
41
|
+
'aiohttp==3.9.0b0; python_version >= "3.12"',
|
|
42
|
+
'flake8~=5.0',
|
|
43
|
+
'psutil',
|
|
44
|
+
'pycodestyle~=2.9.0',
|
|
45
|
+
'pyOpenSSL~=23.0.0',
|
|
46
|
+
'mypy>=0.800',
|
|
47
|
+
'Cython(>=0.29.36,<0.30.0)',
|
|
48
|
+
]
|
|
49
|
+
docs = [
|
|
50
|
+
'Sphinx~=4.1.2',
|
|
51
|
+
'sphinxcontrib-asyncio~=0.3.0',
|
|
52
|
+
'sphinx_rtd_theme~=0.5.2',
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
[build-system]
|
|
56
|
+
requires = [
|
|
57
|
+
"setuptools>=60",
|
|
58
|
+
"wheel",
|
|
59
|
+
"Cython(>=0.29.36,<0.30.0)",
|
|
60
|
+
]
|
|
61
|
+
build-backend = "setuptools.build_meta"
|
|
62
|
+
|
|
63
|
+
[tool.setuptools]
|
|
64
|
+
zip-safe = false
|
|
65
|
+
packages = ["winloop"]
|
|
66
|
+
|
|
67
|
+
[tool.setuptools.exclude-package-data]
|
|
68
|
+
"*" = ["*.c", "*.h"]
|
|
69
|
+
|
|
70
|
+
[tool.cibuildwheel]
|
|
71
|
+
build-frontend = "build"
|
|
72
|
+
# Winloop comment: skip tests for now ("ImportError: cannot import name 'includes' from ... " in GitHub action)
|
|
73
|
+
#test-extras = "test"
|
|
74
|
+
#test-command = "python -m unittest discover -v {project}/tests"
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
addopts = "--capture=no --assert=plain --strict-markers --tb=native --import-mode=importlib"
|
|
78
|
+
testpaths = "tests"
|
|
79
|
+
filterwarnings = "default"
|