winloop 0.1.3__tar.gz → 0.1.4__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.
Files changed (79) hide show
  1. {winloop-0.1.3/winloop.egg-info → winloop-0.1.4}/PKG-INFO +40 -37
  2. {winloop-0.1.3 → winloop-0.1.4}/README.md +32 -31
  3. winloop-0.1.4/setup.py +122 -0
  4. winloop-0.1.4/tests/__init__.py +0 -0
  5. {winloop-0.1.3 → winloop-0.1.4}/tests/__main__.py +1 -1
  6. {winloop-0.1.3 → winloop-0.1.4}/tests/test_aiodns.py +5 -6
  7. {winloop-0.1.3 → winloop-0.1.4}/tests/test_aiohttp.py +2 -0
  8. {winloop-0.1.3 → winloop-0.1.4}/tests/test_aiomultiprocess.py +11 -11
  9. winloop-0.1.4/tests/test_base.py +972 -0
  10. winloop-0.1.4/tests/test_context.py +791 -0
  11. {winloop-0.1.3 → winloop-0.1.4}/tests/test_cython.py +7 -4
  12. winloop-0.1.4/tests/test_dealloc.py +61 -0
  13. winloop-0.1.4/tests/test_dns.py +256 -0
  14. {winloop-0.1.3 → winloop-0.1.4}/tests/test_executors.py +5 -1
  15. winloop-0.1.4/tests/test_libuv_api.py +23 -0
  16. winloop-0.1.4/tests/test_process_spawning.py +115 -0
  17. winloop-0.1.4/tests/test_regr1.py +120 -0
  18. winloop-0.1.4/tests/test_runner.py +39 -0
  19. winloop-0.1.4/tests/test_sourcecode.py +73 -0
  20. winloop-0.1.4/tests/test_testbase.py +51 -0
  21. winloop-0.1.4/tests/test_udp.py +414 -0
  22. winloop-0.1.4/tests/test_unix.py +700 -0
  23. winloop-0.1.4/vendor/libuv/src/fs-poll.c +287 -0
  24. winloop-0.1.4/vendor/libuv/src/idna.c +560 -0
  25. winloop-0.1.4/vendor/libuv/src/inet.c +298 -0
  26. winloop-0.1.4/vendor/libuv/src/random.c +123 -0
  27. winloop-0.1.4/vendor/libuv/src/strscpy.c +38 -0
  28. winloop-0.1.4/vendor/libuv/src/strtok.c +52 -0
  29. winloop-0.1.4/vendor/libuv/src/thread-common.c +175 -0
  30. winloop-0.1.4/vendor/libuv/src/threadpool.c +418 -0
  31. winloop-0.1.4/vendor/libuv/src/timer.c +200 -0
  32. winloop-0.1.4/vendor/libuv/src/uv-common.c +1029 -0
  33. winloop-0.1.4/vendor/libuv/src/uv-data-getter-setters.c +119 -0
  34. winloop-0.1.4/vendor/libuv/src/version.c +45 -0
  35. winloop-0.1.4/vendor/libuv/src/win/async.c +98 -0
  36. winloop-0.1.4/vendor/libuv/src/win/core.c +777 -0
  37. winloop-0.1.4/vendor/libuv/src/win/detect-wakeup.c +56 -0
  38. winloop-0.1.4/vendor/libuv/src/win/dl.c +135 -0
  39. winloop-0.1.4/vendor/libuv/src/win/error.c +173 -0
  40. winloop-0.1.4/vendor/libuv/src/win/fs-event.c +598 -0
  41. winloop-0.1.4/vendor/libuv/src/win/fs.c +3426 -0
  42. winloop-0.1.4/vendor/libuv/src/win/getaddrinfo.c +383 -0
  43. winloop-0.1.4/vendor/libuv/src/win/getnameinfo.c +146 -0
  44. winloop-0.1.4/vendor/libuv/src/win/handle.c +162 -0
  45. winloop-0.1.4/vendor/libuv/src/win/loop-watcher.c +122 -0
  46. winloop-0.1.4/vendor/libuv/src/win/pipe.c +2672 -0
  47. winloop-0.1.4/vendor/libuv/src/win/poll.c +586 -0
  48. winloop-0.1.4/vendor/libuv/src/win/process-stdio.c +416 -0
  49. winloop-0.1.4/vendor/libuv/src/win/process.c +1397 -0
  50. winloop-0.1.4/vendor/libuv/src/win/signal.c +282 -0
  51. winloop-0.1.4/vendor/libuv/src/win/snprintf.c +42 -0
  52. winloop-0.1.4/vendor/libuv/src/win/stream.c +252 -0
  53. winloop-0.1.4/vendor/libuv/src/win/tcp.c +1668 -0
  54. winloop-0.1.4/vendor/libuv/src/win/thread.c +470 -0
  55. winloop-0.1.4/vendor/libuv/src/win/tty.c +2422 -0
  56. winloop-0.1.4/vendor/libuv/src/win/udp.c +1137 -0
  57. winloop-0.1.4/vendor/libuv/src/win/util.c +1707 -0
  58. winloop-0.1.4/vendor/libuv/src/win/winapi.c +147 -0
  59. winloop-0.1.4/vendor/libuv/src/win/winsock.c +575 -0
  60. {winloop-0.1.3 → winloop-0.1.4}/winloop/__init__.py +51 -46
  61. {winloop-0.1.3 → winloop-0.1.4}/winloop/_noop.py +0 -1
  62. {winloop-0.1.3 → winloop-0.1.4}/winloop/_testbase.py +99 -90
  63. {winloop-0.1.3 → winloop-0.1.4}/winloop/_version.py +1 -1
  64. {winloop-0.1.3 → winloop-0.1.4}/winloop/loop.c +51323 -50771
  65. {winloop-0.1.3 → winloop-0.1.4}/winloop/loop.pyi +15 -27
  66. {winloop-0.1.3 → winloop-0.1.4/winloop.egg-info}/PKG-INFO +40 -37
  67. winloop-0.1.4/winloop.egg-info/SOURCES.txt +72 -0
  68. winloop-0.1.3/setup.py +0 -105
  69. winloop-0.1.3/tests/__init__.py +0 -1
  70. winloop-0.1.3/winloop/includes/context.h +0 -38
  71. winloop-0.1.3/winloop.egg-info/SOURCES.txt +0 -25
  72. winloop-0.1.3/winloop.egg-info/requires.txt +0 -1
  73. {winloop-0.1.3 → winloop-0.1.4}/LICENSE-APACHE +0 -0
  74. {winloop-0.1.3 → winloop-0.1.4}/LICENSE-MIT +0 -0
  75. {winloop-0.1.3 → winloop-0.1.4}/pyproject.toml +0 -0
  76. {winloop-0.1.3 → winloop-0.1.4}/setup.cfg +0 -0
  77. {winloop-0.1.3 → winloop-0.1.4}/winloop/includes/__init__.py +0 -0
  78. {winloop-0.1.3 → winloop-0.1.4}/winloop.egg-info/dependency_links.txt +0 -0
  79. {winloop-0.1.3 → winloop-0.1.4}/winloop.egg-info/top_level.txt +0 -0
@@ -1,33 +1,36 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: winloop
3
- Version: 0.1.3
4
- Summary: An alternative library for uvloop compatibility with Windows
3
+ Version: 0.1.4
4
+ Summary: Windows version of uvloop
5
5
  Author: Vizonex
6
- License: MIT
7
- Keywords: winloop,libuv,windows,cython,fast-asyncio,uvloop-alternative
8
- Platform: Microsoft Windows
6
+ Keywords: winloop,libuv,windows,fast-asyncio,uvloop-alternative
7
+ Classifier: License :: OSI Approved :: Apache Software License
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: Microsoft :: Windows
10
+ Classifier: Programming Language :: Python :: 3.8
9
11
  Classifier: Programming Language :: Python :: 3.9
10
12
  Classifier: Programming Language :: Python :: 3.10
11
13
  Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
12
15
  Classifier: Intended Audience :: Developers
13
16
  Classifier: Framework :: AsyncIO
14
17
  Description-Content-Type: text/markdown
15
18
  License-File: LICENSE-APACHE
16
19
  License-File: LICENSE-MIT
17
- Requires-Dist: cython
18
20
 
19
21
  <img src="https://raw.githubusercontent.com/Vizonex/Winloop/main/winloop.png" width="200px"/>
20
22
  <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
23
 
22
24
  # Winloop
23
- An Alternative library for uvloop compatability 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.
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 avalible for windows [but windows was never compatable with uvloop.](https://github.com/MagicStack/uvloop/issues/14#issuecomment-575826367])
25
+ 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.
26
+ 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
27
 
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 compatable by carefully removing and changing parts that were not made for windows. Many hours of research went into making this library exist.
28
+ 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
29
 
28
30
  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
31
 
30
- There is a perfromance 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 performace to it's brother uvloop.
32
+ 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.
33
+
31
34
 
32
35
 
33
36
  ## How to install Winloop on your Windows Operating System
@@ -36,24 +39,23 @@ There is a perfromance increase of about 5 times vs using the `WindowsSelectorEv
36
39
  pip install winloop
37
40
  ```
38
41
 
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.
42
+ 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
43
+ to compile this library on your own.
41
44
 
42
45
  ```
43
- python setup.py build_ext --inplace
46
+ python setup.py build_ext --inplace
44
47
  ```
45
48
 
46
49
  ## Issues Reporting
47
50
 
48
51
  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
52
 
50
- ## Making pull requests
53
+ ## Making pull requests
51
54
  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
55
  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
56
 
54
57
 
55
58
 
56
-
57
59
  ```python
58
60
  try:
59
61
  import aiohttp
@@ -72,7 +74,7 @@ import sys
72
74
  class TestAioHTTP(unittest.TestCase):
73
75
  def __init__(self, methodName: str = "test_aiohttp_basic_1") -> None:
74
76
  super().__init__(methodName)
75
-
77
+
76
78
 
77
79
  def setUp(self):
78
80
  self.loop = asyncio.get_event_loop()
@@ -170,42 +172,43 @@ if __name__ == "__main__":
170
172
  # asyncio.DefaultEventLoopPolicy = asyncio.WindowsSelectorEventLoopPolicy
171
173
  # asyncio.DefaultEventLoopPolicy = asyncio.WindowsProactorEventLoopPolicy
172
174
  unittest.main()
173
- # Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
175
+ # Looks like winloop might be 3x faster than the Proctor Event Loop , THAT's A HUGE IMPROVEMENT!
174
176
  print("testing again but with winloop enabled")
175
177
  winloop.install()
176
178
  unittest.main()
177
179
  ```
178
180
 
179
- The benchmarks for the code above are as follows
181
+ The benchmarks for the code above are as follows
180
182
 
181
183
  ## Benchmarks
182
184
 
183
- ### TCP Connections
185
+ ### TCP Connections
184
186
  -------------------
185
187
 
186
- | Asyncio Event Loop Policy | Time (in Seconds) |
188
+ | Asyncio Event Loop Policy | Time (in Seconds) |
187
189
  |-----------------------------------|-----------------------|
188
190
  | WinLoopPolicy | 0.493s |
189
191
  | WindowsProactorEventLoopPolicy | 2.510s |
190
192
  | WindowsSelectorEventLoopPolicy | 2.723s |
191
193
 
192
194
 
193
- That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
195
+ That's a massive increase and jump from just TCP alone I'll be posting more benchmarks soon as
194
196
  I modify more of the current test suites made by uvloop...
195
197
 
196
198
 
197
- ## How to Use Winloop with Fastapi
199
+ ## How to Use Winloop with Fastapi
198
200
 
199
201
  This was a cool little script I put together Just to make fastapi that much faster to handle
200
202
 
201
203
  ```python
202
204
 
205
+ # TODO this code example is deprecated
203
206
  from fastapi import FastAPI
204
207
  from fastapi.responses import HTMLResponse
205
- import winloop
208
+ import winloop
206
209
  import uvicorn
207
- import asyncio
208
- import datetime
210
+ import asyncio
211
+ import datetime
209
212
 
210
213
  app = FastAPI()
211
214
 
@@ -220,7 +223,7 @@ async def test_get_request():
220
223
  return HTMLResponse("<html><body><h1>FAST API WORKS WITH WINLOOP!</h1></body></html>")
221
224
 
222
225
 
223
- # starllete will use asyncio.to_thread() so that this can remain asynchronous
226
+ # starllete will use asyncio.to_thread() so that this can remain asynchronous
224
227
  @app.get("/date")
225
228
  def test_dynamic_response():
226
229
  return str(datetime.datetime.now())
@@ -237,14 +240,14 @@ if __name__ == "__main__":
237
240
  ```
238
241
 
239
242
 
240
- ## How To Use Winloop When Uvloop is not avalible
243
+ ## How To Use Winloop When Uvloop is not available
241
244
 
242
245
  ```python
243
246
 
244
- # Here's A small Example of using winloop when uvloop is not avalible to us
247
+ # Here's A small Example of using winloop when uvloop is not available to us
245
248
  import sys
246
249
  import aiohttp
247
- import asyncio
250
+ import asyncio
248
251
 
249
252
  async def main():
250
253
  async with aiohttp.ClientSession("https://httpbin.org") as client:
@@ -256,11 +259,11 @@ if __name__ == "__main__":
256
259
  from winloop import run
257
260
  else:
258
261
  # if we're on apple or linux do this instead
259
- from uvloop import run
262
+ from uvloop import run
260
263
  run(main())
261
264
  ```
262
-
263
-
265
+
266
+
264
267
  ## TODO-List
265
268
 
266
269
  - Update Fastapi Example to a more recent version of fastapi
@@ -271,19 +274,19 @@ if __name__ == "__main__":
271
274
 
272
275
  - Drop All `DEF` Macros, I'm currently seeking help on replacements for macros where all the variables are known about at compile-time
273
276
 
274
- - Adding in the nessesary 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...)
277
+ - 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
278
 
276
279
  - write a workflow for compiling libuv on different versions of windows when distributing out pypi wheels.
277
280
 
278
- - write a workflow for nightly builds if nessesary for verification of pull requests.
281
+ - write a workflow for nightly builds if necessary for verification of pull requests.
279
282
 
280
283
  - Sphinx Styled Documentation (Maybe I'm thinking about it...)
281
284
 
282
- - Update benchmarks (They are old) can't belive I maintained this project for over a year now...
285
+ - Update benchmarks (They are old) can't believe I maintained this project for over a year now...
283
286
 
284
287
  ## Videos
285
288
  - 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
289
+ - My Presentation and Virtual Confrence: https://www.youtube.com/watch?v=Cbb6trkKWXY
287
290
 
288
291
  ## 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.
292
+ 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 compatability 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 avalible for windows [but windows was never compatable with uvloop.](https://github.com/MagicStack/uvloop/issues/14#issuecomment-575826367])
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 compatable by carefully removing and changing parts that were not made for windows. Many hours of research went into making this library exist.
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 perfromance 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 performace to it's brother uvloop.
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 avalible
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 avalible to us
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 nessesary 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
+ - 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 nessesary for verification of pull requests.
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 belive I maintained this project for over a year now...
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.
winloop-0.1.4/setup.py ADDED
@@ -0,0 +1,122 @@
1
+ import sys
2
+
3
+ vi = sys.version_info
4
+ if vi < (3, 8):
5
+ raise RuntimeError('winloop requires Python 3.8 or greater')
6
+
7
+ if sys.platform not in ('win32', 'cygwin', 'cli'):
8
+ raise RuntimeError('winloop only supports Windows at the moment,'
9
+ ' install uvloop on Linux, MacOS, etc.')
10
+
11
+ from setuptools import Extension, setup, find_packages
12
+ import pathlib
13
+ import sys
14
+
15
+ from Cython.Build import cythonize
16
+
17
+
18
+ HERE = pathlib.Path("winloop")
19
+ _ROOT = pathlib.Path(__file__).parent
20
+
21
+
22
+ def get_c_files():
23
+ path = pathlib.Path("vendor", "libuv", "src")
24
+
25
+ def c_files(p: pathlib.Path):
26
+ for i in p.iterdir():
27
+ if i.is_dir():
28
+ pass
29
+ if i.name.endswith(".c"):
30
+ yield i
31
+
32
+ for c in c_files(path):
33
+ yield c.as_posix()
34
+ for c in c_files(path / "win"):
35
+ yield c.as_posix()
36
+
37
+
38
+ # This is a temporary test solution and is not the official file yet but this
39
+ # is to display/show what I'm currently using to compile the winloop library...
40
+ try:
41
+ long_description = (HERE.parent / 'readme.md').open("r").read()
42
+ except Exception:
43
+ long_description = ""
44
+
45
+ # "Thank goodness we don't have to dig out the libpath ourselves I almost
46
+ # vomited" - Vizonex
47
+ Windows_Libraries = [
48
+ "Shell32.lib",
49
+ "Ws2_32.lib",
50
+ "Advapi32.lib",
51
+ "iphlpapi.lib",
52
+ "WSock32.lib",
53
+ "Userenv.lib",
54
+ "User32.lib",
55
+ "Dbghelp.lib",
56
+ "Ole32.lib"
57
+ ]
58
+
59
+ c_files = list(get_c_files())
60
+
61
+ ext = [
62
+ Extension(
63
+ "winloop.loop",
64
+ ["winloop\\loop.pyx"] + c_files,
65
+ include_dirs=["vendor/libuv/src", "vendor/libuv/src/win",
66
+ "vendor/libuv/include"],
67
+ # NOTE uv_a.lib will be user-compiled when
68
+ # I've fixed the install there's still been some problems with
69
+ # compiling fs-poll.c on it's own...
70
+ extra_link_args=Windows_Libraries,
71
+ # I have some macros setup for now to help me
72
+ # with debugging -Vizonex
73
+ library_dirs=["winloop"],
74
+ define_macros=[
75
+ ("WIN32_LEAN_AND_MEAN", 1),
76
+ ("_WIN32_WINNT", "0x0602")
77
+ ]
78
+ )
79
+ ]
80
+
81
+ with open(str(_ROOT / 'winloop' / '_version.py')) as f:
82
+ for line in f:
83
+ if line.startswith('__version__ ='):
84
+ _, _, version = line.partition('=')
85
+ VERSION = version.strip(" \n'\"")
86
+ break
87
+ else:
88
+ raise RuntimeError(
89
+ 'unable to read the version from winloop/_version.py')
90
+
91
+
92
+ setup(
93
+ name="winloop",
94
+ author="Vizonex",
95
+ version=VERSION,
96
+ description="Windows version of uvloop",
97
+ ext_modules=cythonize(ext),
98
+ keywords=[
99
+ "winloop",
100
+ "libuv",
101
+ "windows",
102
+ "fast-asyncio",
103
+ "uvloop-alternative"
104
+ ],
105
+ # Credit to godlygeek for helping me fix the setup.py file
106
+ packages=find_packages(include="winloop*"),
107
+ include_package_data=True,
108
+ long_description_content_type='text/markdown',
109
+ long_description=long_description,
110
+ classifiers=[
111
+ 'License :: OSI Approved :: Apache Software License',
112
+ 'License :: OSI Approved :: MIT License',
113
+ 'Operating System :: Microsoft :: Windows',
114
+ 'Programming Language :: Python :: 3.8',
115
+ 'Programming Language :: Python :: 3.9',
116
+ 'Programming Language :: Python :: 3.10',
117
+ 'Programming Language :: Python :: 3.11',
118
+ 'Programming Language :: Python :: 3.12',
119
+ 'Intended Audience :: Developers',
120
+ 'Framework :: AsyncIO'
121
+ ]
122
+ )
File without changes
@@ -13,4 +13,4 @@ def suite():
13
13
  if __name__ == '__main__':
14
14
  runner = unittest.runner.TextTestRunner()
15
15
  result = runner.run(suite())
16
- sys.exit(not result.wasSuccessful())
16
+ sys.exit(not result.wasSuccessful())
@@ -1,5 +1,6 @@
1
- # NOTE: I forked the aiodns Repository you will have to use that for now
2
- # or wait for the pull request I recently made to go through: https://github.com/saghul/aiodns/pull/116
1
+ # NOTE: I forked the aiodns Repository you will have to use that for now
2
+ # or wait for the pull request I recently made to go through:
3
+ # https://github.com/saghul/aiodns/pull/116
3
4
 
4
5
  try:
5
6
  import aiodns
@@ -8,10 +9,7 @@ except ImportError:
8
9
  else:
9
10
  skip_tests = False
10
11
 
11
- import asyncio
12
- import sys
13
12
  import unittest
14
- import weakref
15
13
 
16
14
  from winloop import _testbase as tb
17
15
 
@@ -36,6 +34,7 @@ class Test_UV_Aiodns(_TestAiodns, tb.UVTestCase):
36
34
  pass
37
35
 
38
36
 
39
- @unittest.skip("aiodns needs a SelectorEventLoop on Windows. See more: https://github.com/saghul/aiodns/issues/86")
37
+ @unittest.skip("aiodns needs a SelectorEventLoop on Windows."
38
+ " See more: https://github.com/saghul/aiodns/issues/86")
40
39
  class Test_AIO_Aiodns(_TestAiodns, tb.AIOTestCase):
41
40
  pass
@@ -15,6 +15,7 @@ from winloop import _testbase as tb
15
15
 
16
16
  # TODO: Fix or patch DeprecationWarning
17
17
 
18
+
18
19
  class _TestAioHTTP:
19
20
 
20
21
  def test_aiohttp_basic_1(self):
@@ -127,5 +128,6 @@ class Test_UV_AioHTTP(_TestAioHTTP, tb.UVTestCase):
127
128
  class Test_AIO_AioHTTP(_TestAioHTTP, tb.AIOTestCase):
128
129
  pass
129
130
 
131
+
130
132
  if __name__ == "__main__":
131
133
  unittest.main()
@@ -1,5 +1,6 @@
1
1
  try:
2
- import aiomultiprocess, multiprocessing
2
+ import aiomultiprocess
3
+ import multiprocessing
3
4
  except ImportError:
4
5
  skip_tests = True
5
6
  else:
@@ -8,26 +9,28 @@ import unittest
8
9
  import winloop
9
10
  import random
10
11
  import asyncio
11
- import os
12
12
  from winloop import _testbase as tb
13
13
 
14
14
 
15
15
  async def test_func(sleep: float):
16
- return await asyncio.sleep(sleep)
16
+ return await asyncio.sleep(sleep)
17
+
17
18
 
18
19
  def my_map():
19
20
  return [random.uniform(0.005, 1) for _ in range(7)]
20
21
 
22
+
21
23
  class _Test_Multiprocessing():
22
24
  """Used for Testing aiomultiprocessing"""
23
25
 
24
26
  def test_proccess_spawning(self):
25
-
26
- # See: https://github.com/Vizonex/Winloop/issues/11#issuecomment-1922659521
27
+
28
+ # See:
29
+ # https://github.com/Vizonex/Winloop/issues/11#issuecomment-1922659521
27
30
  self.processes = set()
28
31
  # There must be at least 2 pids setup for this to be correctly ran...
29
32
  total_proccesses = 2
30
-
33
+
31
34
  async def test():
32
35
  async with aiomultiprocess.Pool(total_proccesses) as pool:
33
36
  self.processes.update(p.pid for p in pool.processes)
@@ -36,8 +39,6 @@ class _Test_Multiprocessing():
36
39
  self.assertEqual(len(self.processes), total_proccesses)
37
40
 
38
41
  self.loop.run_until_complete(test())
39
-
40
-
41
42
 
42
43
 
43
44
  @unittest.skipIf(skip_tests, "no aiomultiproccess module")
@@ -51,10 +52,9 @@ class Test_AIO_AioMultiprocess(_Test_Multiprocessing, tb.AIOTestCase):
51
52
 
52
53
 
53
54
  if __name__ == "__main__":
54
- # I have confirmed that multiproccessing is supported so no need to continue with trying... - Vizonex...
55
+ # I have confirmed that multiproccessing is supported so no need
56
+ # to continue with trying... - Vizonex...
55
57
  multiprocessing.freeze_support()
56
58
  # aiomultiprocess.set_start_method("spawn")
57
59
  winloop.install()
58
60
  unittest.main()
59
-
60
-