wepoll 0.1.1__tar.gz → 0.1.2__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.
- wepoll-0.1.2/PKG-INFO +26 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/README.md +6 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/pyproject.toml +2 -1
- wepoll-0.1.2/tests/test_wepoll_cyares.py +44 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/__init__.py +12 -13
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/_wepoll.c +1012 -574
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/_wepoll.pyx +18 -8
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/loop.py +7 -2
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/selector.py +8 -5
- wepoll-0.1.2/wepoll.egg-info/PKG-INFO +26 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll.egg-info/SOURCES.txt +1 -0
- wepoll-0.1.1/PKG-INFO +0 -9
- wepoll-0.1.1/wepoll.egg-info/PKG-INFO +0 -9
- {wepoll-0.1.1 → wepoll-0.1.2}/MANIFEST.in +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/setup.cfg +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/setup.py +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/tests/test_wepoll_eventloop.py +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/tests/test_wepoll_selectors.py +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/vendor/wepoll/wepoll.c +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/vendor/wepoll/wepoll.h +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/__init__.pxd +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/_wepoll.pxd +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/_wepoll.pyi +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/flags.py +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll/socket.pxd +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll.egg-info/dependency_links.txt +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll.egg-info/not-zip-safe +0 -0
- {wepoll-0.1.1 → wepoll-0.1.2}/wepoll.egg-info/top_level.txt +0 -0
wepoll-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wepoll
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Cython adaptation of the wepoll C Library providing epoll selectors to windows
|
|
5
|
+
Author-email: Vizonex <VizonexBusiness@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: homepage, https://github.com/Vizonex/pywepoll
|
|
8
|
+
Project-URL: repository, https://github.com/Vizonex/pywepoll.git
|
|
9
|
+
Requires-Python: >=3.9
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# PyWepoll
|
|
13
|
+
[](https://badge.fury.io/py/wepoll)
|
|
14
|
+

|
|
15
|
+
[](https://opensource.org/licenses/MIT)
|
|
16
|
+
|
|
17
|
+
A Python Port of the wepoll C Library meant to help give windows support for epoll objects in python. Code was based on CPython's implementation mixed with the old _epoll.pyx twisted source code. (If I can refind it I'll try to archive it for someone to look through.)
|
|
18
|
+
|
|
19
|
+
## How this project came to be
|
|
20
|
+
Originally this was C Library was going to be utilized in [winloop](https://github.com/Vizonex/winloop) for dealing with `UVPoll` objects but the idea was scrapped when I didn't realize that the License was actually MIT LICENSE Friendly and I was still a bit of a noob at low-level coding. Knowing about this project for a couple of years I wanted to experiemnt with it using [cyares](https://github.com/Vizonex/cyares) to see if it would help with polling sockets if needed to be done manually without socket handles or event-threads to see if it would provide one of the slowest Operating Systems a little performance boost over the standard `select` function that python provides.
|
|
21
|
+
|
|
22
|
+
Currently as is the library is experimental and I wouldn't call it beta or production ready yet unlike cyares which is in it's beta phase and does a really good job performance-wise.
|
|
23
|
+
The Code is based off the old twisted module
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
# PyWepoll
|
|
2
|
+
[](https://badge.fury.io/py/wepoll)
|
|
3
|
+

|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
2
6
|
A Python Port of the wepoll C Library meant to help give windows support for epoll objects in python. Code was based on CPython's implementation mixed with the old _epoll.pyx twisted source code. (If I can refind it I'll try to archive it for someone to look through.)
|
|
3
7
|
|
|
4
8
|
## How this project came to be
|
|
@@ -7,3 +11,5 @@ Originally this was C Library was going to be utilized in [winloop](https://gith
|
|
|
7
11
|
Currently as is the library is experimental and I wouldn't call it beta or production ready yet unlike cyares which is in it's beta phase and does a really good job performance-wise.
|
|
8
12
|
The Code is based off the old twisted module
|
|
9
13
|
|
|
14
|
+
|
|
15
|
+
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "wepoll"
|
|
3
3
|
description = "Cython adaptation of the wepoll C Library providing epoll selectors to windows"
|
|
4
|
-
version = "0.1.
|
|
4
|
+
version = "0.1.2"
|
|
5
5
|
authors = [
|
|
6
6
|
{ name = "Vizonex", email = "VizonexBusiness@gmail.com" }
|
|
7
7
|
]
|
|
8
|
+
readme = "README.md"
|
|
8
9
|
license = {text = "MIT License"}
|
|
9
10
|
requires-python = ">=3.9"
|
|
10
11
|
dependencies = []
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from cyares import Channel
|
|
2
|
+
from cyares.channel import CYARES_SOCKET_BAD
|
|
3
|
+
from wepoll import EpollSelector
|
|
4
|
+
from wepoll import epoll, EPOLLIN, EPOLLOUT
|
|
5
|
+
from socket import AF_INET
|
|
6
|
+
READ = EPOLLIN
|
|
7
|
+
WRITE = EPOLLOUT
|
|
8
|
+
|
|
9
|
+
# based off pycares's testsuite
|
|
10
|
+
|
|
11
|
+
class TestCyaresWepoll:
|
|
12
|
+
channel: Channel
|
|
13
|
+
def wait(self):
|
|
14
|
+
# The function were really testing is this wait function
|
|
15
|
+
poll = epoll()
|
|
16
|
+
while True:
|
|
17
|
+
r, w = self.channel.getsock()
|
|
18
|
+
if not r and not w:
|
|
19
|
+
break
|
|
20
|
+
for rs in r:
|
|
21
|
+
poll.register(rs, EPOLLIN)
|
|
22
|
+
for ws in w:
|
|
23
|
+
poll.register(ws, EPOLLOUT)
|
|
24
|
+
|
|
25
|
+
timeout = self.channel.timeout()
|
|
26
|
+
if timeout == 0.0:
|
|
27
|
+
self.channel.process_fd(
|
|
28
|
+
CYARES_SOCKET_BAD, CYARES_SOCKET_BAD
|
|
29
|
+
)
|
|
30
|
+
continue
|
|
31
|
+
for fd, event in poll.poll(timeout):
|
|
32
|
+
if event & ~EPOLLIN:
|
|
33
|
+
self.channel.process_write_fd(fd)
|
|
34
|
+
if event & ~EPOLLOUT:
|
|
35
|
+
self.channel.process_read_fd(fd)
|
|
36
|
+
|
|
37
|
+
def test_resolve(self):
|
|
38
|
+
self.channel = Channel(event_thread=False, servers=["8.8.8.8", "8.8.4.4"])
|
|
39
|
+
fut = self.channel.gethostbyname("python.org", AF_INET)
|
|
40
|
+
self.wait()
|
|
41
|
+
self.channel.cancel()
|
|
42
|
+
assert fut.result()
|
|
43
|
+
|
|
44
|
+
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
from ._wepoll import epoll
|
|
2
|
-
from .loop import WepollEventLoop
|
|
3
|
-
from .selector import EpollSelector
|
|
4
2
|
from .flags import EPOLLERR as EPOLLERR
|
|
5
3
|
from .flags import EPOLLHUP as EPOLLHUP
|
|
6
4
|
from .flags import EPOLLIN as EPOLLIN
|
|
@@ -13,25 +11,26 @@ from .flags import EPOLLRDHUP as EPOLLRDHUP
|
|
|
13
11
|
from .flags import EPOLLRDNORM as EPOLLRDNORM
|
|
14
12
|
from .flags import EPOLLWRBAND as EPOLLWRBAND
|
|
15
13
|
from .flags import EPOLLWRNORM as EPOLLWRNORM
|
|
16
|
-
|
|
14
|
+
from .loop import WepollEventLoop
|
|
15
|
+
from .selector import EpollSelector
|
|
17
16
|
|
|
18
17
|
__author__ = "Vizonex"
|
|
19
|
-
__version__ = "0.1.
|
|
18
|
+
__version__ = "0.1.2"
|
|
20
19
|
__all__ = (
|
|
21
|
-
"__author__",
|
|
22
|
-
"__version__",
|
|
23
|
-
"EPOLLIN",
|
|
24
|
-
"EPOLLPRI",
|
|
25
|
-
"EPOLLOUT",
|
|
26
20
|
"EPOLLERR",
|
|
27
21
|
"EPOLLHUP",
|
|
28
|
-
"
|
|
29
|
-
"EPOLLWRBAND",
|
|
22
|
+
"EPOLLIN",
|
|
30
23
|
"EPOLLMSG",
|
|
31
|
-
"EPOLLRDHUP",
|
|
32
24
|
"EPOLLONESHOT",
|
|
33
|
-
"
|
|
25
|
+
"EPOLLOUT",
|
|
26
|
+
"EPOLLPRI",
|
|
27
|
+
"EPOLLRDHUP",
|
|
28
|
+
"EPOLLWRBAND",
|
|
29
|
+
"EPOLLWRNORM",
|
|
34
30
|
"EpollSelector",
|
|
35
31
|
"WepollEventLoop",
|
|
32
|
+
"__author__",
|
|
33
|
+
"__version__",
|
|
34
|
+
"epoll",
|
|
36
35
|
)
|
|
37
36
|
|