PyEventEngine 0.6.0.post3__cp314-cp314t-win_amd64.whl

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 (52) hide show
  1. event_engine/__infra__.pxd +2 -0
  2. event_engine/__init__.pxd +2 -0
  3. event_engine/__init__.py +37 -0
  4. event_engine/base/__infra__.pxd +9 -0
  5. event_engine/base/__init__.pxd +9 -0
  6. event_engine/base/__init__.py +82 -0
  7. event_engine/base/c_allocator_protocol.c +10825 -0
  8. event_engine/base/c_allocator_protocol.cp314t-win_amd64.pyd +0 -0
  9. event_engine/base/c_allocator_protocol.h +23 -0
  10. event_engine/base/c_allocator_protocol.pxd +31 -0
  11. event_engine/base/c_allocator_protocol.pyx +99 -0
  12. event_engine/capi/__infra__.pxd +189 -0
  13. event_engine/capi/__init__.pxd +189 -0
  14. event_engine/capi/__init__.py +84 -0
  15. event_engine/capi/c_engine.c +28719 -0
  16. event_engine/capi/c_engine.cp314t-win_amd64.pyd +0 -0
  17. event_engine/capi/c_engine.h +393 -0
  18. event_engine/capi/c_engine.pxd +84 -0
  19. event_engine/capi/c_engine.pyi +424 -0
  20. event_engine/capi/c_engine.pyx +560 -0
  21. event_engine/capi/c_event.c +19929 -0
  22. event_engine/capi/c_event.cp314t-win_amd64.pyd +0 -0
  23. event_engine/capi/c_event.h +342 -0
  24. event_engine/capi/c_event.pxd +159 -0
  25. event_engine/capi/c_event.pyi +226 -0
  26. event_engine/capi/c_event.pyx +387 -0
  27. event_engine/capi/c_topic.c +30986 -0
  28. event_engine/capi/c_topic.cp314t-win_amd64.pyd +0 -0
  29. event_engine/capi/c_topic.h +1007 -0
  30. event_engine/capi/c_topic.pxd +147 -0
  31. event_engine/capi/c_topic.pyi +580 -0
  32. event_engine/capi/c_topic.pyx +725 -0
  33. event_engine/capi/fallback_engine.py +670 -0
  34. event_engine/includes/event_engine/base/c_allocator_protocol.c +10825 -0
  35. event_engine/includes/event_engine/base/c_allocator_protocol.h +23 -0
  36. event_engine/includes/event_engine/capi/c_engine.c +28719 -0
  37. event_engine/includes/event_engine/capi/c_engine.h +393 -0
  38. event_engine/includes/event_engine/capi/c_event.c +19929 -0
  39. event_engine/includes/event_engine/capi/c_event.h +342 -0
  40. event_engine/includes/event_engine/capi/c_topic.c +30986 -0
  41. event_engine/includes/event_engine/capi/c_topic.h +1007 -0
  42. event_engine/native/__init__.py +60 -0
  43. event_engine/native/_event.py +420 -0
  44. event_engine/native/_topic.py +171 -0
  45. event_engine/native/engine.py +746 -0
  46. event_engine/native/event.py +467 -0
  47. event_engine/native/topic.py +945 -0
  48. pyeventengine-0.6.0.post3.dist-info/METADATA +189 -0
  49. pyeventengine-0.6.0.post3.dist-info/RECORD +52 -0
  50. pyeventengine-0.6.0.post3.dist-info/WHEEL +5 -0
  51. pyeventengine-0.6.0.post3.dist-info/licenses/LICENSE +21 -0
  52. pyeventengine-0.6.0.post3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,189 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyEventEngine
3
+ Version: 0.6.0.post3
4
+ Summary: Python Basic EventEngine
5
+ Author-email: Han Bolun <Bolun.Han@outlook.com>
6
+ Project-URL: Homepage, https://github.com/BolunHan/PyEventEngine
7
+ Project-URL: Repository, https://github.com/BolunHan/PyEventEngine
8
+ Project-URL: Issues, https://github.com/BolunHan/PyEventEngine/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Classifier: Operating System :: OS Independent
14
+ Requires-Python: >=3.12
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
18
+
19
+ # PyEventEngine
20
+
21
+ [![docs](https://github.com/BolunHan/PyEventEngine/actions/workflows/build-page-docs.yml/badge.svg)](https://github.com/BolunHan/PyEventEngine/actions/workflows/build-page-docs.yml)
22
+ [![pypi-linux](https://github.com/BolunHan/PyEventEngine/actions/workflows/publish-posix-to-pypi.yml/badge.svg)](https://github.com/BolunHan/PyEventEngine/actions/workflows/publish-posix-to-pypi.yml)
23
+ [![pypi-windows](https://github.com/BolunHan/PyEventEngine/actions/workflows/publish-nt-to-pypi.yml/badge.svg)](https://github.com/BolunHan/PyEventEngine/actions/workflows/publish-nt-to-pypi.yml)
24
+
25
+ High-performance, topic-driven event engine for Python with a Cython-accelerated core and a native Python fallback.
26
+
27
+ - Fast publish/subscribe event routing by topic (exact + generic wildcard/pattern matching)
28
+ - Clean, typed API with drop-in fallback when C extensions are unavailable
29
+ - Built-in timers, handler stats (EventHookEx), and convenient formatting helpers
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ # From PyPI (pre-compiled wheels available)
35
+ pip install PyEventEngine
36
+
37
+ # From source (requires C compiler + Cython ≥ 3.0)
38
+ git clone https://github.com/BolunHan/PyEventEngine.git
39
+ cd PyEventEngine
40
+
41
+ # Build + install
42
+ ./build.sh -i
43
+
44
+ # Or via Makefile:
45
+ make build && pip install -U . --no-build-isolation
46
+
47
+ # Or step by step:
48
+ python setup.py build_ext --inplace --verbose --force
49
+ pip install -U . --no-build-isolation
50
+ ```
51
+
52
+ See the [Installation Guide](https://bolunhan.github.io/PyEventEngine/installation.html) for platform-specific prerequisites, compile-time macros, and troubleshooting.
53
+
54
+ ## Quick Start
55
+
56
+ ```python
57
+ import time
58
+ from event_engine import EventEngine, Topic
59
+
60
+ # Create and start the engine
61
+ engine = EventEngine(capacity=8192)
62
+ engine.start()
63
+
64
+ # Register a handler for an exact topic
65
+ exact = Topic('Demo.Hello')
66
+
67
+ def hello_handler(name: str, topic=None):
68
+ print(f"Hello {name} from {topic.value if topic else 'N/A'}")
69
+
70
+ engine.register_handler(exact, hello_handler)
71
+
72
+ # Publish a message
73
+ engine.put(exact, 'World')
74
+
75
+ # Clean up
76
+ time.sleep(0.1)
77
+ engine.stop()
78
+ engine.clear()
79
+ ```
80
+
81
+ ### Generic topics (wildcards/patterns)
82
+
83
+ ```python
84
+ import time
85
+ from event_engine import Topic, EventEngine
86
+
87
+ engine = EventEngine()
88
+ pattern = Topic('Demo.{what}')
89
+
90
+ calls = []
91
+
92
+ def f(what: str, topic=None):
93
+ calls.append((what, topic.value))
94
+
95
+ engine.register_handler(pattern, f)
96
+
97
+ engine.start()
98
+ engine.put(Topic('Demo.Test'), 'a test sub-topic')
99
+ engine.put(Topic('Demo.Live'), 'a live sub-topic')
100
+ time.sleep(0.1) # allow time for processing
101
+ engine.stop()
102
+
103
+ print(calls) # [('a test sub-topic', 'Demo.Test'), ('a live sub-topic', 'Demo.Live')]
104
+ ```
105
+
106
+ ### Timers (EventEngineEx)
107
+
108
+ ```python
109
+ import time
110
+ from event_engine import EventEngineEx, Topic
111
+
112
+ engine = EventEngineEx(capacity=4096)
113
+ engine.start()
114
+
115
+ # Create a 1-second timer topic and subscribe
116
+ timer_topic = engine.get_timer(1.0)
117
+ engine.register_handler(timer_topic, lambda **kw: print('tick', kw))
118
+
119
+ time.sleep(3)
120
+ engine.stop()
121
+ engine.clear()
122
+ ```
123
+
124
+ ### Logging
125
+
126
+ By default, the package uses a colored logger under `event_engine.base`. To integrate with your
127
+ application's logging, call `set_logger` once after import — it propagates to submodules.
128
+
129
+ ```python
130
+ import logging
131
+ from event_engine import set_logger
132
+
133
+ logger = logging.getLogger('MyApp')
134
+ logger.setLevel(logging.INFO)
135
+ set_logger(logger)
136
+ ```
137
+
138
+ ### Fallback behavior
139
+
140
+ On import, the package tries to use the Cython implementation (`event_engine.capi`). If that fails
141
+ (e.g., no compiler available), it automatically falls back to the native Python implementation
142
+ (`event_engine.native`). Check the active backend:
143
+
144
+ ```python
145
+ from event_engine import USING_FALLBACK
146
+ print('Using native fallback?', USING_FALLBACK)
147
+ ```
148
+
149
+ ## Development
150
+
151
+ ```bash
152
+ # Clone and build in-place
153
+ git clone https://github.com/BolunHan/PyEventEngine.git
154
+ cd PyEventEngine
155
+ ./build.sh -i
156
+
157
+ # Run tests
158
+ python -m pytest demo/
159
+
160
+ # Performance benchmarks
161
+ python demo/native_performance_test.py
162
+ python demo/capi_performance_test.py # requires compiled extensions
163
+ ```
164
+
165
+ ### Build scripts
166
+
167
+ | Command | Effect |
168
+ |---|---|
169
+ | `./build.sh -i` | Clean + build + install |
170
+ | `./build.sh -l` | List compile-time macros |
171
+ | `make build` | Clean + build in-place |
172
+ | `make clean-all` | Deep clean (removes `.c`/`.so`) |
173
+
174
+ ## Documentation
175
+
176
+ Full documentation: **https://bolunhan.github.io/PyEventEngine/**
177
+
178
+ Build locally:
179
+
180
+ ```bash
181
+ pip install sphinx furo sphinx-autodoc-typehints
182
+ cd docs
183
+ sphinx-build -M html . _build
184
+ # Open _build/html/index.html
185
+ ```
186
+
187
+ ## License
188
+
189
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,52 @@
1
+ event_engine/__infra__.pxd,sha256=mkSbWvhdjeO2QB9DK60VxK8IKoMjxIX42XCPy7ZHyLM,44
2
+ event_engine/__init__.pxd,sha256=mkSbWvhdjeO2QB9DK60VxK8IKoMjxIX42XCPy7ZHyLM,44
3
+ event_engine/__init__.py,sha256=hZKxHrA9fBg8Tl2EBFKE-u-JVrNdTY9fdRpwnRdgE7c,945
4
+ event_engine/base/__infra__.pxd,sha256=1oNFIPAoOiMw3kNVcRR0vvbMSfsc-baH9vGTO-awut4,304
5
+ event_engine/base/__init__.pxd,sha256=1oNFIPAoOiMw3kNVcRR0vvbMSfsc-baH9vGTO-awut4,304
6
+ event_engine/base/__init__.py,sha256=inHjf2pLIXNIcJzoyviHS-yY001b8zKMtjyaVpNPNl8,2785
7
+ event_engine/base/c_allocator_protocol.c,sha256=3iAEsog5ks7leI4UGtQQ5GcDvcMpPFyB3jsRTogp_54,473067
8
+ event_engine/base/c_allocator_protocol.cp314t-win_amd64.pyd,sha256=Yz5moNDJ2l7UtChl90I8JlzRTMImQDQTVujdUlQw5-M,54272
9
+ event_engine/base/c_allocator_protocol.h,sha256=6iYXcv6eBOrt-sVuaRPqOkpBmttp_wgxsyxeL9DXeOw,691
10
+ event_engine/base/c_allocator_protocol.pxd,sha256=ZuWU_xplWqRzMYnzZjeTaJFARM7x8veQLcu5v9NrlFw,896
11
+ event_engine/base/c_allocator_protocol.pyx,sha256=ADyuqpMiulJyQ-XaXWK5JNYWlSOLguo3LCw-6xIIMqY,3924
12
+ event_engine/capi/__infra__.pxd,sha256=CyqVdnondUr_u1zrObZEDC70XhECp5lhJh8b69Fu5rM,4618
13
+ event_engine/capi/__init__.pxd,sha256=CyqVdnondUr_u1zrObZEDC70XhECp5lhJh8b69Fu5rM,4618
14
+ event_engine/capi/__init__.py,sha256=89snKU4TlUOqpLfjOzcABxBCeU0lBCQpYZ9DTF9n2Lw,2643
15
+ event_engine/capi/c_engine.c,sha256=cze38juojiBlvS2fGpSATXoDFFW9RrNitqkORpQFw64,1293075
16
+ event_engine/capi/c_engine.cp314t-win_amd64.pyd,sha256=lMLPBJcOARmwb4UVwdNoXFB0U4o_VzA-JvcZujYdPVU,188928
17
+ event_engine/capi/c_engine.h,sha256=UkqXF0qi9gL-DgdkCzr2wP6_1Omi488LnwhPu6-l09E,13904
18
+ event_engine/capi/c_engine.pxd,sha256=Z4BEj3iNussS4zjWLJHNbB4PyT7_zpaVfmtdw8grbo4,3223
19
+ event_engine/capi/c_engine.pyi,sha256=3JU3HD-Z4k2UA5ThQoZwAhOauX1fm4dJ0abQeFZe98s,14128
20
+ event_engine/capi/c_engine.pyx,sha256=ArJRVYabhpvrjUQH3W_2yOt3USG2MiY7NW9sNZbz2wo,21694
21
+ event_engine/capi/c_event.c,sha256=JLoWUUPE13sU7hyMAqueTxYUb9a-nw1EtYxRJ-v2HX8,884830
22
+ event_engine/capi/c_event.cp314t-win_amd64.pyd,sha256=gob_IBIpKTv3BizeZOe7NIBEuG8HaLurOEDXpoZKi_M,108032
23
+ event_engine/capi/c_event.h,sha256=eEV9K_yPWQvs1B5eJxGsTJp-2pefD9z3rlieDalRh2E,13428
24
+ event_engine/capi/c_event.pxd,sha256=jbso3p_ztQRzFWNHefNPGIm1SAz44UKl2JEgJwI1QPg,5992
25
+ event_engine/capi/c_event.pyi,sha256=3raoTHbPP3Y7tQwkOCmYB9KU_uD8kgQTJIwLtfGq-zc,6139
26
+ event_engine/capi/c_event.pyx,sha256=9LpJ9ZxVtvOi_hiTGIOGCI_QZjuYlNTzPWCNPwaoAXg,14848
27
+ event_engine/capi/c_topic.c,sha256=n4O2QhSFQ3RIGS9_yz3KihSDuLy_Vf7uN2olLXtA2Cg,1380594
28
+ event_engine/capi/c_topic.cp314t-win_amd64.pyd,sha256=mJ9Hb1ZSuXKo9LSyHbwXtH5cDOZAio6v6xcRQqyX-Iw,197632
29
+ event_engine/capi/c_topic.h,sha256=iPrpEWaXifbE2jhtL1vA4xIs5b1eZ3Xlt_mZ4pNi9OM,35077
30
+ event_engine/capi/c_topic.pxd,sha256=uLn4PTEXFOEBXE5wWq2ya4fS9Xl1oANV4q5ZO_dSL8A,4277
31
+ event_engine/capi/c_topic.pyi,sha256=ygFi7IP7vdw2NwbF8v8K-TVM_d8M1YBzfp0RXFeWsU4,20624
32
+ event_engine/capi/c_topic.pyx,sha256=VOTw7XDWG_kHRddzGmeXPJMThlPSXFNTgdbkoCkib04,26855
33
+ event_engine/capi/fallback_engine.py,sha256=NXLTFBUOdN3IS3uhs3n3n5b_7UuLOl29ek0OWiEG7tU,22236
34
+ event_engine/includes/event_engine/base/c_allocator_protocol.c,sha256=3iAEsog5ks7leI4UGtQQ5GcDvcMpPFyB3jsRTogp_54,473067
35
+ event_engine/includes/event_engine/base/c_allocator_protocol.h,sha256=6iYXcv6eBOrt-sVuaRPqOkpBmttp_wgxsyxeL9DXeOw,691
36
+ event_engine/includes/event_engine/capi/c_engine.c,sha256=cze38juojiBlvS2fGpSATXoDFFW9RrNitqkORpQFw64,1293075
37
+ event_engine/includes/event_engine/capi/c_engine.h,sha256=UkqXF0qi9gL-DgdkCzr2wP6_1Omi488LnwhPu6-l09E,13904
38
+ event_engine/includes/event_engine/capi/c_event.c,sha256=JLoWUUPE13sU7hyMAqueTxYUb9a-nw1EtYxRJ-v2HX8,884830
39
+ event_engine/includes/event_engine/capi/c_event.h,sha256=eEV9K_yPWQvs1B5eJxGsTJp-2pefD9z3rlieDalRh2E,13428
40
+ event_engine/includes/event_engine/capi/c_topic.c,sha256=n4O2QhSFQ3RIGS9_yz3KihSDuLy_Vf7uN2olLXtA2Cg,1380594
41
+ event_engine/includes/event_engine/capi/c_topic.h,sha256=iPrpEWaXifbE2jhtL1vA4xIs5b1eZ3Xlt_mZ4pNi9OM,35077
42
+ event_engine/native/__init__.py,sha256=bbbBlekcobSXwToov7Uk71ns9ziGrj1Aw_nO3FjZ844,1932
43
+ event_engine/native/_event.py,sha256=VS6JRK8pLR6neFzboivTh0N-BEblM0-0TFioW8UAvyg,15224
44
+ event_engine/native/_topic.py,sha256=HReVjvnHBoxVPemEpoDL_TzFtMoI_aHYtI836epWZ2w,5355
45
+ event_engine/native/engine.py,sha256=7H_oM_CEp-XuLnPqbS1fMIr-37VX6hXTHbHxMUFsBYw,25661
46
+ event_engine/native/event.py,sha256=15aCQoJ6388J4gbNCwh6GChbbPeA9AIOgfUIQloJuxg,16358
47
+ event_engine/native/topic.py,sha256=T0dVOo4JUT91Vu_bJFhlMZDx46lspSwAplGApQ0jzuc,35352
48
+ pyeventengine-0.6.0.post3.dist-info/licenses/LICENSE,sha256=BvUA2EP_6vsOvstZaraqnwzshM9CeDAqXSZEa5WxdEg,1087
49
+ pyeventengine-0.6.0.post3.dist-info/METADATA,sha256=rDg_cSap2NvrsDTSz9EBGjMPjOpGFjbN4y4AwGUlzhc,5429
50
+ pyeventengine-0.6.0.post3.dist-info/WHEEL,sha256=1E0gszQps7BnHucFFSWKxP1l1R1l3Xb3HouMURv4ztU,102
51
+ pyeventengine-0.6.0.post3.dist-info/top_level.txt,sha256=rIh2LcDfofRLIIqMSlulp5yAXTf1DNOmlofiyIHuylQ,13
52
+ pyeventengine-0.6.0.post3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314t-win_amd64
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Bolun Han
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ event_engine