socket-netty 0.3.0__tar.gz → 0.3.1__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 (50) hide show
  1. {socket_netty-0.3.0 → socket_netty-0.3.1}/PKG-INFO +19 -22
  2. {socket_netty-0.3.0 → socket_netty-0.3.1}/README.md +18 -21
  3. {socket_netty-0.3.0 → socket_netty-0.3.1}/examples/01_echo_client.py +3 -3
  4. {socket_netty-0.3.0 → socket_netty-0.3.1}/examples/01_echo_server.py +2 -2
  5. {socket_netty-0.3.0 → socket_netty-0.3.1}/examples/02_game_protocol_client.py +2 -2
  6. {socket_netty-0.3.0 → socket_netty-0.3.1}/examples/02_game_protocol_server.py +2 -2
  7. {socket_netty-0.3.0 → socket_netty-0.3.1}/pyproject.toml +2 -2
  8. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/__init__.py +8 -8
  9. socket_netty-0.3.1/socket_netty/bootstrap/__init__.py +3 -0
  10. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/bootstrap/bootstrap.py +6 -6
  11. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/buffer/__init__.py +2 -2
  12. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/buffer/allocator.py +1 -1
  13. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/buffer/bytebuf.py +1 -1
  14. socket_netty-0.3.1/socket_netty/channel/__init__.py +24 -0
  15. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/channel.py +3 -3
  16. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/channel_pipeline.py +4 -4
  17. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/datagram_channel.py +2 -2
  18. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/event_loop.py +2 -2
  19. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/protocol_adapter.py +2 -2
  20. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/exceptions.py +1 -1
  21. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/__init__.py +6 -6
  22. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/channel_handler.py +1 -1
  23. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/channel_handler_context.py +5 -5
  24. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/codec.py +4 -4
  25. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/protolib_codec.py +7 -7
  26. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/timeout.py +4 -4
  27. {socket_netty-0.3.0 → socket_netty-0.3.1}/socket_netty.egg-info/PKG-INFO +19 -22
  28. socket_netty-0.3.1/socket_netty.egg-info/SOURCES.txt +44 -0
  29. socket_netty-0.3.1/socket_netty.egg-info/top_level.txt +1 -0
  30. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_bytebuf.py +2 -2
  31. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_codec.py +2 -2
  32. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_concurrency.py +2 -2
  33. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_core_extras.py +2 -2
  34. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_echo.py +4 -4
  35. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_flow_and_allocator.py +4 -4
  36. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_network_extras.py +2 -2
  37. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_pipeline.py +3 -3
  38. {socket_netty-0.3.0 → socket_netty-0.3.1}/tests/test_tls.py +2 -2
  39. socket_netty-0.3.0/pynetty/bootstrap/__init__.py +0 -3
  40. socket_netty-0.3.0/pynetty/channel/__init__.py +0 -24
  41. socket_netty-0.3.0/socket_netty.egg-info/SOURCES.txt +0 -44
  42. socket_netty-0.3.0/socket_netty.egg-info/top_level.txt +0 -1
  43. {socket_netty-0.3.0 → socket_netty-0.3.1}/MANIFEST.in +0 -0
  44. {socket_netty-0.3.0 → socket_netty-0.3.1}/setup.cfg +0 -0
  45. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/channel_future.py +0 -0
  46. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/channel_option.py +0 -0
  47. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/channel/flow_control.py +0 -0
  48. {socket_netty-0.3.0/pynetty → socket_netty-0.3.1/socket_netty}/handler/ssl_context.py +0 -0
  49. {socket_netty-0.3.0 → socket_netty-0.3.1}/socket_netty.egg-info/dependency_links.txt +0 -0
  50. {socket_netty-0.3.0 → socket_netty-0.3.1}/socket_netty.egg-info/requires.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socket-netty
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Asynchronous networking library for Python, inspired by Netty
5
5
  Author: Button
6
6
  Keywords: networking,asyncio,netty,tcp,udp,game-server,protocol
@@ -18,7 +18,7 @@ Requires-Python: >=3.9
18
18
  Description-Content-Type: text/markdown
19
19
  Requires-Dist: protolib>=0.4.3
20
20
 
21
- # pynetty 🐍🛠️
21
+ # socket-netty 🐍🛠️
22
22
 
23
23
  Asynchronous networking library for Python, closely inspired by
24
24
  [Netty](https://netty.io) (Java). Built on top of `asyncio`, with no
@@ -60,16 +60,13 @@ Netty Py 🐍
60
60
  pip install socket-netty
61
61
  ```
62
62
 
63
- (The PyPI distribution is named `socket-netty`, but the importable
64
- package is still `pynetty` — your code stays `import pynetty`.)
65
-
66
63
  Or, for local development from a clone of this repo:
67
64
 
68
65
  ```bash
69
66
  pip install -e .
70
67
  ```
71
68
 
72
- `pynetty` declares [`protolib`](https://pypi.org/project/protolib/) as
69
+ `socket_netty` declares [`protolib`](https://pypi.org/project/protolib/) as
73
70
  an install dependency, so either install method pulls it in
74
71
  automatically — you don't need a separate install step to use
75
72
  `ProtolibCodec` below.
@@ -77,7 +74,7 @@ automatically — you don't need a separate install step to use
77
74
  ## Structure
78
75
 
79
76
  ```
80
- pynetty/
77
+ socket_netty/
81
78
  exceptions.py -> Netty-style exception hierarchy (DecoderException,
82
79
  EncoderException, CorruptedFrameException, etc.)
83
80
  buffer/ -> ByteBuf, ByteBufAllocator (Unpooled/Pooled)
@@ -93,7 +90,7 @@ pynetty/
93
90
 
94
91
  ```python
95
92
  import asyncio
96
- from pynetty import ServerBootstrap, ChannelInboundHandler
93
+ from socket_netty import ServerBootstrap, ChannelInboundHandler
97
94
 
98
95
  class EchoHandler(ChannelInboundHandler):
99
96
  async def channel_active(self, ctx):
@@ -118,13 +115,13 @@ asyncio.run(main())
118
115
 
119
116
  ## Exceptions
120
117
 
121
- pynetty raises the same exception hierarchy Netty does, under
118
+ socket_netty raises the same exception hierarchy Netty does, under
122
119
  `io.netty.*`. Every exception's `str()` is prefixed with its
123
120
  fully-qualified Java-style path, so logs and `exception_caught` output
124
121
  look exactly like a real Netty stack:
125
122
 
126
123
  ```python
127
- from pynetty import DecoderException
124
+ from socket_netty import DecoderException
128
125
 
129
126
  async def exception_caught(self, ctx, exc):
130
127
  print(exc)
@@ -155,7 +152,7 @@ raw internal error escape a codec unwrapped.
155
152
  ## Socket options
156
153
 
157
154
  ```python
158
- from pynetty import ServerBootstrap, ChannelOption
155
+ from socket_netty import ServerBootstrap, ChannelOption
159
156
 
160
157
  server = (
161
158
  ServerBootstrap()
@@ -170,7 +167,7 @@ await server.bind("0.0.0.0", 9000)
170
167
  ## TLS/SSL
171
168
 
172
169
  ```python
173
- from pynetty import ServerBootstrap, Bootstrap, SslContextBuilder
170
+ from socket_netty import ServerBootstrap, Bootstrap, SslContextBuilder
174
171
 
175
172
  # Server
176
173
  server_ctx = SslContextBuilder.for_server("cert.pem", "key.pem").build()
@@ -185,7 +182,7 @@ channel = await Bootstrap().handler(init_client).ssl(client_ctx).connect("myserv
185
182
  ## UDP
186
183
 
187
184
  ```python
188
- from pynetty import DatagramBootstrap, ChannelInboundHandler
185
+ from socket_netty import DatagramBootstrap, ChannelInboundHandler
189
186
 
190
187
  class UdpHandler(ChannelInboundHandler):
191
188
  async def channel_read(self, ctx, msg):
@@ -200,7 +197,7 @@ channel = await DatagramBootstrap().handler(
200
197
  ## Idle / Timeouts
201
198
 
202
199
  ```python
203
- from pynetty import IdleStateHandler, ReadTimeoutHandler
200
+ from socket_netty import IdleStateHandler, ReadTimeoutHandler
204
201
 
205
202
  async def on_idle(ctx, event):
206
203
  print("Idle channel:", event.state)
@@ -217,7 +214,7 @@ def init_channel(channel):
217
214
  ## EventLoopGroup (real multi-threaded concurrency)
218
215
 
219
216
  ```python
220
- from pynetty import EventLoopGroup
217
+ from socket_netty import EventLoopGroup
221
218
 
222
219
  worker_group = EventLoopGroup(num_threads=4)
223
220
  worker_group.start()
@@ -230,7 +227,7 @@ result = future.result(timeout=5) # blocking, from any thread
230
227
  ## ChannelFuture / ChannelPromise
231
228
 
232
229
  ```python
233
- from pynetty import ChannelFuture
230
+ from socket_netty import ChannelFuture
234
231
 
235
232
  future = channel.new_future()
236
233
  future.add_listener(lambda f: print("Finished:", f.is_success()))
@@ -242,7 +239,7 @@ result = await future
242
239
  ## Backpressure (WriteBufferWaterMark)
243
240
 
244
241
  ```python
245
- from pynetty import ServerBootstrap, WriteBufferWaterMark
242
+ from socket_netty import ServerBootstrap, WriteBufferWaterMark
246
243
 
247
244
  server = (
248
245
  ServerBootstrap()
@@ -263,7 +260,7 @@ order, even across `await` points (avoids race conditions on shared
263
260
  handler state):
264
261
 
265
262
  ```python
266
- from pynetty import ChannelExecutor
263
+ from socket_netty import ChannelExecutor
267
264
 
268
265
  executor = ChannelExecutor()
269
266
  executor.start()
@@ -275,7 +272,7 @@ async def channel_read(self, ctx, msg):
275
272
  ## Allocator (buffer pool)
276
273
 
277
274
  ```python
278
- from pynetty import PooledByteBufAllocator
275
+ from socket_netty import PooledByteBufAllocator
279
276
 
280
277
  allocator = PooledByteBufAllocator()
281
278
  buf = allocator.buffer(256)
@@ -289,7 +286,7 @@ allocator.release(buf) # goes back to the pool, ready to be reused
289
286
  Very common in game protocols (Minecraft, Free Fire, etc.):
290
287
 
291
288
  ```python
292
- from pynetty import LengthFieldBasedFrameDecoder, LengthFieldPrepender
289
+ from socket_netty import LengthFieldBasedFrameDecoder, LengthFieldPrepender
293
290
 
294
291
  def init_channel(channel):
295
292
  channel.pipeline.add_last("frame_decoder", LengthFieldBasedFrameDecoder(4))
@@ -313,7 +310,7 @@ out.
313
310
  `ProtolibCodec` has two framing modes, controlled by `framed`:
314
311
 
315
312
  ```python
316
- from pynetty import ServerBootstrap, ChannelInboundHandler, ProtolibCodec
313
+ from socket_netty import ServerBootstrap, ChannelInboundHandler, ProtolibCodec
317
314
 
318
315
  # framed=True (default): the codec frames the stream itself via
319
316
  # protolib's own PacketFramer (varint length-prefix, Minecraft-style).
@@ -354,7 +351,7 @@ same as the rest of the codecs in this library.
354
351
  ## ByteBuf
355
352
 
356
353
  ```python
357
- from pynetty import ByteBuf
354
+ from socket_netty import ByteBuf
358
355
 
359
356
  buf = ByteBuf()
360
357
  buf.write_varint(1000)
@@ -1,4 +1,4 @@
1
- # pynetty 🐍🛠️
1
+ # socket-netty 🐍🛠️
2
2
 
3
3
  Asynchronous networking library for Python, closely inspired by
4
4
  [Netty](https://netty.io) (Java). Built on top of `asyncio`, with no
@@ -40,16 +40,13 @@ Netty Py 🐍
40
40
  pip install socket-netty
41
41
  ```
42
42
 
43
- (The PyPI distribution is named `socket-netty`, but the importable
44
- package is still `pynetty` — your code stays `import pynetty`.)
45
-
46
43
  Or, for local development from a clone of this repo:
47
44
 
48
45
  ```bash
49
46
  pip install -e .
50
47
  ```
51
48
 
52
- `pynetty` declares [`protolib`](https://pypi.org/project/protolib/) as
49
+ `socket_netty` declares [`protolib`](https://pypi.org/project/protolib/) as
53
50
  an install dependency, so either install method pulls it in
54
51
  automatically — you don't need a separate install step to use
55
52
  `ProtolibCodec` below.
@@ -57,7 +54,7 @@ automatically — you don't need a separate install step to use
57
54
  ## Structure
58
55
 
59
56
  ```
60
- pynetty/
57
+ socket_netty/
61
58
  exceptions.py -> Netty-style exception hierarchy (DecoderException,
62
59
  EncoderException, CorruptedFrameException, etc.)
63
60
  buffer/ -> ByteBuf, ByteBufAllocator (Unpooled/Pooled)
@@ -73,7 +70,7 @@ pynetty/
73
70
 
74
71
  ```python
75
72
  import asyncio
76
- from pynetty import ServerBootstrap, ChannelInboundHandler
73
+ from socket_netty import ServerBootstrap, ChannelInboundHandler
77
74
 
78
75
  class EchoHandler(ChannelInboundHandler):
79
76
  async def channel_active(self, ctx):
@@ -98,13 +95,13 @@ asyncio.run(main())
98
95
 
99
96
  ## Exceptions
100
97
 
101
- pynetty raises the same exception hierarchy Netty does, under
98
+ socket_netty raises the same exception hierarchy Netty does, under
102
99
  `io.netty.*`. Every exception's `str()` is prefixed with its
103
100
  fully-qualified Java-style path, so logs and `exception_caught` output
104
101
  look exactly like a real Netty stack:
105
102
 
106
103
  ```python
107
- from pynetty import DecoderException
104
+ from socket_netty import DecoderException
108
105
 
109
106
  async def exception_caught(self, ctx, exc):
110
107
  print(exc)
@@ -135,7 +132,7 @@ raw internal error escape a codec unwrapped.
135
132
  ## Socket options
136
133
 
137
134
  ```python
138
- from pynetty import ServerBootstrap, ChannelOption
135
+ from socket_netty import ServerBootstrap, ChannelOption
139
136
 
140
137
  server = (
141
138
  ServerBootstrap()
@@ -150,7 +147,7 @@ await server.bind("0.0.0.0", 9000)
150
147
  ## TLS/SSL
151
148
 
152
149
  ```python
153
- from pynetty import ServerBootstrap, Bootstrap, SslContextBuilder
150
+ from socket_netty import ServerBootstrap, Bootstrap, SslContextBuilder
154
151
 
155
152
  # Server
156
153
  server_ctx = SslContextBuilder.for_server("cert.pem", "key.pem").build()
@@ -165,7 +162,7 @@ channel = await Bootstrap().handler(init_client).ssl(client_ctx).connect("myserv
165
162
  ## UDP
166
163
 
167
164
  ```python
168
- from pynetty import DatagramBootstrap, ChannelInboundHandler
165
+ from socket_netty import DatagramBootstrap, ChannelInboundHandler
169
166
 
170
167
  class UdpHandler(ChannelInboundHandler):
171
168
  async def channel_read(self, ctx, msg):
@@ -180,7 +177,7 @@ channel = await DatagramBootstrap().handler(
180
177
  ## Idle / Timeouts
181
178
 
182
179
  ```python
183
- from pynetty import IdleStateHandler, ReadTimeoutHandler
180
+ from socket_netty import IdleStateHandler, ReadTimeoutHandler
184
181
 
185
182
  async def on_idle(ctx, event):
186
183
  print("Idle channel:", event.state)
@@ -197,7 +194,7 @@ def init_channel(channel):
197
194
  ## EventLoopGroup (real multi-threaded concurrency)
198
195
 
199
196
  ```python
200
- from pynetty import EventLoopGroup
197
+ from socket_netty import EventLoopGroup
201
198
 
202
199
  worker_group = EventLoopGroup(num_threads=4)
203
200
  worker_group.start()
@@ -210,7 +207,7 @@ result = future.result(timeout=5) # blocking, from any thread
210
207
  ## ChannelFuture / ChannelPromise
211
208
 
212
209
  ```python
213
- from pynetty import ChannelFuture
210
+ from socket_netty import ChannelFuture
214
211
 
215
212
  future = channel.new_future()
216
213
  future.add_listener(lambda f: print("Finished:", f.is_success()))
@@ -222,7 +219,7 @@ result = await future
222
219
  ## Backpressure (WriteBufferWaterMark)
223
220
 
224
221
  ```python
225
- from pynetty import ServerBootstrap, WriteBufferWaterMark
222
+ from socket_netty import ServerBootstrap, WriteBufferWaterMark
226
223
 
227
224
  server = (
228
225
  ServerBootstrap()
@@ -243,7 +240,7 @@ order, even across `await` points (avoids race conditions on shared
243
240
  handler state):
244
241
 
245
242
  ```python
246
- from pynetty import ChannelExecutor
243
+ from socket_netty import ChannelExecutor
247
244
 
248
245
  executor = ChannelExecutor()
249
246
  executor.start()
@@ -255,7 +252,7 @@ async def channel_read(self, ctx, msg):
255
252
  ## Allocator (buffer pool)
256
253
 
257
254
  ```python
258
- from pynetty import PooledByteBufAllocator
255
+ from socket_netty import PooledByteBufAllocator
259
256
 
260
257
  allocator = PooledByteBufAllocator()
261
258
  buf = allocator.buffer(256)
@@ -269,7 +266,7 @@ allocator.release(buf) # goes back to the pool, ready to be reused
269
266
  Very common in game protocols (Minecraft, Free Fire, etc.):
270
267
 
271
268
  ```python
272
- from pynetty import LengthFieldBasedFrameDecoder, LengthFieldPrepender
269
+ from socket_netty import LengthFieldBasedFrameDecoder, LengthFieldPrepender
273
270
 
274
271
  def init_channel(channel):
275
272
  channel.pipeline.add_last("frame_decoder", LengthFieldBasedFrameDecoder(4))
@@ -293,7 +290,7 @@ out.
293
290
  `ProtolibCodec` has two framing modes, controlled by `framed`:
294
291
 
295
292
  ```python
296
- from pynetty import ServerBootstrap, ChannelInboundHandler, ProtolibCodec
293
+ from socket_netty import ServerBootstrap, ChannelInboundHandler, ProtolibCodec
297
294
 
298
295
  # framed=True (default): the codec frames the stream itself via
299
296
  # protolib's own PacketFramer (varint length-prefix, Minecraft-style).
@@ -334,7 +331,7 @@ same as the rest of the codecs in this library.
334
331
  ## ByteBuf
335
332
 
336
333
  ```python
337
- from pynetty import ByteBuf
334
+ from socket_netty import ByteBuf
338
335
 
339
336
  buf = ByteBuf()
340
337
  buf.write_varint(1000)
@@ -7,11 +7,11 @@ Uso:
7
7
  """
8
8
 
9
9
  import sys
10
- sys.path.insert(0, "/home/claude/pynetty")
10
+ sys.path.insert(0, "/home/claude/socket_netty")
11
11
 
12
12
  import asyncio
13
13
 
14
- from pynetty import Bootstrap, ChannelInboundHandler
14
+ from socket_netty import Bootstrap, ChannelInboundHandler
15
15
 
16
16
 
17
17
  class ClientHandler(ChannelInboundHandler):
@@ -35,7 +35,7 @@ async def main():
35
35
  channel = await Bootstrap().handler(init_channel).connect("127.0.0.1", 9000)
36
36
  print(f"[client] conectado a {channel.remote_address()}")
37
37
 
38
- mensajes = [b"hola", b"como estas", b"pynetty rifa \xf0\x9f\x9b\xa0"]
38
+ mensajes = [b"hola", b"como estas", b"socket_netty rifa \xf0\x9f\x9b\xa0"]
39
39
  for m in mensajes:
40
40
  await channel.write(m)
41
41
  respuesta = await asyncio.wait_for(handler.received.get(), timeout=5)
@@ -10,11 +10,11 @@ Uso:
10
10
  """
11
11
 
12
12
  import sys
13
- sys.path.insert(0, "/home/claude/pynetty")
13
+ sys.path.insert(0, "/home/claude/socket_netty")
14
14
 
15
15
  import asyncio
16
16
 
17
- from pynetty import ServerBootstrap, ChannelInboundHandler, ChannelOption
17
+ from socket_netty import ServerBootstrap, ChannelInboundHandler, ChannelOption
18
18
 
19
19
 
20
20
  class EchoHandler(ChannelInboundHandler):
@@ -8,11 +8,11 @@ Uso:
8
8
  """
9
9
 
10
10
  import sys
11
- sys.path.insert(0, "/home/claude/pynetty")
11
+ sys.path.insert(0, "/home/claude/socket_netty")
12
12
 
13
13
  import asyncio
14
14
 
15
- from pynetty import (
15
+ from socket_netty import (
16
16
  Bootstrap,
17
17
  ChannelInboundHandler,
18
18
  ChannelOutboundHandler,
@@ -18,11 +18,11 @@ Uso:
18
18
  """
19
19
 
20
20
  import sys
21
- sys.path.insert(0, "/home/claude/pynetty")
21
+ sys.path.insert(0, "/home/claude/socket_netty")
22
22
 
23
23
  import asyncio
24
24
 
25
- from pynetty import (
25
+ from socket_netty import (
26
26
  ServerBootstrap,
27
27
  ChannelInboundHandler,
28
28
  ChannelOutboundHandler,
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "socket-netty"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Asynchronous networking library for Python, inspired by Netty"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -29,4 +29,4 @@ dependencies = [
29
29
  ]
30
30
 
31
31
  [tool.setuptools.packages.find]
32
- include = ["pynetty", "pynetty.*"]
32
+ include = ["socket_netty", "socket_netty.*"]
@@ -1,10 +1,10 @@
1
1
  """
2
- pynetty: an event-driven asynchronous I/O library inspired by Netty
2
+ socket_netty: an event-driven asynchronous I/O library inspired by Netty
3
3
  (Java), built on top of asyncio.
4
4
 
5
5
  Typical usage (server):
6
6
 
7
- from pynetty import ServerBootstrap, ChannelInboundHandler
7
+ from socket_netty import ServerBootstrap, ChannelInboundHandler
8
8
 
9
9
  class EchoHandler(ChannelInboundHandler):
10
10
  async def channel_read(self, ctx, msg):
@@ -18,7 +18,7 @@ Typical usage (server):
18
18
  await server.serve_forever()
19
19
  """
20
20
 
21
- from pynetty.buffer import (
21
+ from socket_netty.buffer import (
22
22
  ByteBuf,
23
23
  IndexOutOfBoundsError,
24
24
  ByteBufAllocator,
@@ -27,7 +27,7 @@ from pynetty.buffer import (
27
27
  DEFAULT_UNPOOLED,
28
28
  DEFAULT_POOLED,
29
29
  )
30
- from pynetty.channel import (
30
+ from socket_netty.channel import (
31
31
  Channel,
32
32
  ChannelPipeline,
33
33
  DuplicateHandlerNameError,
@@ -43,7 +43,7 @@ from pynetty.channel import (
43
43
  DatagramChannel,
44
44
  DatagramBootstrap,
45
45
  )
46
- from pynetty.handler import (
46
+ from socket_netty.handler import (
47
47
  ChannelHandler,
48
48
  ChannelInboundHandler,
49
49
  ChannelOutboundHandler,
@@ -64,8 +64,8 @@ from pynetty.handler import (
64
64
  WriteTimeoutHandler,
65
65
  WriteTimeoutError,
66
66
  )
67
- from pynetty.bootstrap import ServerBootstrap, Bootstrap
68
- from pynetty.exceptions import (
67
+ from socket_netty.bootstrap import ServerBootstrap, Bootstrap
68
+ from socket_netty.exceptions import (
69
69
  NettyException,
70
70
  ChannelException,
71
71
  CodecException,
@@ -76,7 +76,7 @@ from pynetty.exceptions import (
76
76
  TimeoutException,
77
77
  )
78
78
 
79
- __version__ = "0.3.0"
79
+ __version__ = "0.3.1"
80
80
 
81
81
  __all__ = [
82
82
  # exceptions
@@ -0,0 +1,3 @@
1
+ from socket_netty.bootstrap.bootstrap import ServerBootstrap, Bootstrap
2
+
3
+ __all__ = ["ServerBootstrap", "Bootstrap"]
@@ -12,12 +12,12 @@ import asyncio
12
12
  import ssl as ssl_module
13
13
  from typing import Any, Callable, Dict, Optional
14
14
 
15
- from pynetty.channel.channel import Channel
16
- from pynetty.channel.protocol_adapter import _ChannelProtocol
17
- from pynetty.channel.channel_option import ChannelOption, apply_socket_options
18
- from pynetty.channel.flow_control import WriteBufferWaterMark
19
- from pynetty.channel.event_loop import EventLoopGroup
20
- from pynetty.exceptions import ChannelException
15
+ from socket_netty.channel.channel import Channel
16
+ from socket_netty.channel.protocol_adapter import _ChannelProtocol
17
+ from socket_netty.channel.channel_option import ChannelOption, apply_socket_options
18
+ from socket_netty.channel.flow_control import WriteBufferWaterMark
19
+ from socket_netty.channel.event_loop import EventLoopGroup
20
+ from socket_netty.exceptions import ChannelException
21
21
 
22
22
 
23
23
  ChannelInitializer = Callable[[Channel], "asyncio.Future | None"]
@@ -1,5 +1,5 @@
1
- from pynetty.buffer.bytebuf import ByteBuf, IndexOutOfBoundsError
2
- from pynetty.buffer.allocator import (
1
+ from socket_netty.buffer.bytebuf import ByteBuf, IndexOutOfBoundsError
2
+ from socket_netty.buffer.allocator import (
3
3
  ByteBufAllocator,
4
4
  UnpooledByteBufAllocator,
5
5
  PooledByteBufAllocator,
@@ -20,7 +20,7 @@ import threading
20
20
  from collections import defaultdict
21
21
  from typing import Dict, List
22
22
 
23
- from pynetty.buffer.bytebuf import ByteBuf
23
+ from socket_netty.buffer.bytebuf import ByteBuf
24
24
 
25
25
 
26
26
  class ByteBufAllocator:
@@ -11,7 +11,7 @@ from __future__ import annotations
11
11
  import struct
12
12
  from typing import Union
13
13
 
14
- from pynetty.exceptions import IndexOutOfBoundsError, CorruptedFrameException
14
+ from socket_netty.exceptions import IndexOutOfBoundsError, CorruptedFrameException
15
15
 
16
16
  __all__ = ["ByteBuf", "IndexOutOfBoundsError"]
17
17
 
@@ -0,0 +1,24 @@
1
+ from socket_netty.channel.channel import Channel
2
+ from socket_netty.channel.channel_pipeline import ChannelPipeline, DuplicateHandlerNameError
3
+ from socket_netty.channel.channel_future import ChannelFuture, ChannelPromise
4
+ from socket_netty.channel.event_loop import EventLoop, EventLoopGroup
5
+ from socket_netty.channel.channel_option import ChannelOption, apply_socket_options
6
+ from socket_netty.channel.flow_control import WriteBufferWaterMark, ChannelExecutor, FlowControlInboundHandler
7
+ from socket_netty.channel.datagram_channel import DatagramChannel, DatagramBootstrap
8
+
9
+ __all__ = [
10
+ "Channel",
11
+ "ChannelPipeline",
12
+ "DuplicateHandlerNameError",
13
+ "ChannelFuture",
14
+ "ChannelPromise",
15
+ "EventLoop",
16
+ "EventLoopGroup",
17
+ "ChannelOption",
18
+ "apply_socket_options",
19
+ "WriteBufferWaterMark",
20
+ "ChannelExecutor",
21
+ "FlowControlInboundHandler",
22
+ "DatagramChannel",
23
+ "DatagramBootstrap",
24
+ ]
@@ -9,9 +9,9 @@ from __future__ import annotations
9
9
  import asyncio
10
10
  from typing import Any, Dict, Optional
11
11
 
12
- from pynetty.channel.channel_pipeline import ChannelPipeline
13
- from pynetty.channel.channel_future import ChannelFuture
14
- from pynetty.exceptions import ChannelException
12
+ from socket_netty.channel.channel_pipeline import ChannelPipeline
13
+ from socket_netty.channel.channel_future import ChannelFuture
14
+ from socket_netty.exceptions import ChannelException
15
15
 
16
16
 
17
17
  class Channel:
@@ -8,16 +8,16 @@ from __future__ import annotations
8
8
 
9
9
  from typing import Any, Dict, TYPE_CHECKING
10
10
 
11
- from pynetty.exceptions import DuplicateHandlerNameError
12
- from pynetty.handler.channel_handler import (
11
+ from socket_netty.exceptions import DuplicateHandlerNameError
12
+ from socket_netty.handler.channel_handler import (
13
13
  ChannelHandler,
14
14
  ChannelInboundHandler,
15
15
  ChannelOutboundHandler,
16
16
  )
17
- from pynetty.handler.channel_handler_context import ChannelHandlerContext
17
+ from socket_netty.handler.channel_handler_context import ChannelHandlerContext
18
18
 
19
19
  if TYPE_CHECKING:
20
- from pynetty.channel.channel import Channel
20
+ from socket_netty.channel.channel import Channel
21
21
 
22
22
 
23
23
  class ChannelPipeline:
@@ -12,8 +12,8 @@ from __future__ import annotations
12
12
  import asyncio
13
13
  from typing import Any, Optional, Tuple
14
14
 
15
- from pynetty.channel.channel_pipeline import ChannelPipeline
16
- from pynetty.exceptions import ChannelException
15
+ from socket_netty.channel.channel_pipeline import ChannelPipeline
16
+ from socket_netty.exceptions import ChannelException
17
17
 
18
18
  Address = Tuple[str, int]
19
19
 
@@ -33,7 +33,7 @@ class EventLoop:
33
33
  execution "wheel").
34
34
  """
35
35
 
36
- def __init__(self, name: str = "pynetty-eventloop") -> None:
36
+ def __init__(self, name: str = "socket_netty-eventloop") -> None:
37
37
  self.name = name
38
38
  self._loop: Optional[asyncio.AbstractEventLoop] = None
39
39
  self._thread: Optional[threading.Thread] = None
@@ -119,7 +119,7 @@ class EventLoopGroup:
119
119
  worker_group = EventLoopGroup(4) # processes channel I/O
120
120
  """
121
121
 
122
- def __init__(self, num_threads: int = 1, name_prefix: str = "pynetty-worker") -> None:
122
+ def __init__(self, num_threads: int = 1, name_prefix: str = "socket_netty-worker") -> None:
123
123
  if num_threads < 1:
124
124
  raise ValueError("num_threads must be >= 1")
125
125
  self._loops: List[EventLoop] = [
@@ -11,8 +11,8 @@ from __future__ import annotations
11
11
  import asyncio
12
12
  from typing import Callable, Optional
13
13
 
14
- from pynetty.channel.channel import Channel
15
- from pynetty.channel.flow_control import WriteBufferWaterMark
14
+ from socket_netty.channel.channel import Channel
15
+ from socket_netty.channel.flow_control import WriteBufferWaterMark
16
16
 
17
17
 
18
18
  class _ChannelProtocol(asyncio.Protocol):
@@ -13,7 +13,7 @@ from __future__ import annotations
13
13
 
14
14
 
15
15
  class NettyException(Exception):
16
- """Base class for all pynetty exceptions; mirrors io.netty.channel.ChannelException lineage."""
16
+ """Base class for all socket_netty exceptions; mirrors io.netty.channel.ChannelException lineage."""
17
17
 
18
18
  netty_path: str = "io.netty.channel.ChannelException"
19
19
 
@@ -1,4 +1,4 @@
1
- from pynetty.handler.channel_handler import (
1
+ from socket_netty.handler.channel_handler import (
2
2
  ChannelHandler,
3
3
  ChannelInboundHandler,
4
4
  ChannelOutboundHandler,
@@ -6,15 +6,15 @@ from pynetty.handler.channel_handler import (
6
6
  ChannelOutboundHandlerAdapter,
7
7
  SimpleChannelInboundHandler,
8
8
  )
9
- from pynetty.handler.channel_handler_context import ChannelHandlerContext
10
- from pynetty.handler.codec import (
9
+ from socket_netty.handler.channel_handler_context import ChannelHandlerContext
10
+ from socket_netty.handler.codec import (
11
11
  LengthFieldBasedFrameDecoder,
12
12
  LengthFieldPrepender,
13
13
  ByteToMessageCodec,
14
14
  )
15
- from pynetty.handler.protolib_codec import ProtolibCodec
16
- from pynetty.handler.ssl_context import SslContextBuilder
17
- from pynetty.handler.timeout import (
15
+ from socket_netty.handler.protolib_codec import ProtolibCodec
16
+ from socket_netty.handler.ssl_context import SslContextBuilder
17
+ from socket_netty.handler.timeout import (
18
18
  IdleState,
19
19
  IdleStateEvent,
20
20
  IdleStateHandler,