PyCyBase 0.1.10__cp315-cp315-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 (105) hide show
  1. cbase/__infra__.pxd +6 -0
  2. cbase/__init__.pxd +6 -0
  3. cbase/__init__.py +31 -0
  4. cbase/allocator_protocol/__infra__.pxd +65 -0
  5. cbase/allocator_protocol/__init__.pxd +65 -0
  6. cbase/allocator_protocol/__init__.py +45 -0
  7. cbase/allocator_protocol/c_allocator_protocol.c +31874 -0
  8. cbase/allocator_protocol/c_allocator_protocol.cp315-win_amd64.pyd +0 -0
  9. cbase/allocator_protocol/c_allocator_protocol.h +352 -0
  10. cbase/allocator_protocol/c_allocator_protocol.pxd +66 -0
  11. cbase/allocator_protocol/c_allocator_protocol.pyi +144 -0
  12. cbase/allocator_protocol/c_allocator_protocol.pyx +209 -0
  13. cbase/allocator_protocol/c_heap_allocator.c +38225 -0
  14. cbase/allocator_protocol/c_heap_allocator.cp315-win_amd64.pyd +0 -0
  15. cbase/allocator_protocol/c_heap_allocator.h +554 -0
  16. cbase/allocator_protocol/c_heap_allocator.pxd +105 -0
  17. cbase/allocator_protocol/c_heap_allocator.pyi +161 -0
  18. cbase/allocator_protocol/c_heap_allocator.pyx +303 -0
  19. cbase/allocator_protocol/c_nt_shm_allocator.c +33455 -0
  20. cbase/allocator_protocol/c_nt_shm_allocator.cp315-win_amd64.pyd +0 -0
  21. cbase/allocator_protocol/c_nt_shm_allocator.h +1105 -0
  22. cbase/allocator_protocol/c_nt_shm_allocator.pxd +110 -0
  23. cbase/allocator_protocol/c_nt_shm_allocator.pyx +223 -0
  24. cbase/allocator_protocol/c_shm_allocator.h +1270 -0
  25. cbase/allocator_protocol/c_shm_allocator.pxd +150 -0
  26. cbase/allocator_protocol/c_shm_allocator.pyi +299 -0
  27. cbase/allocator_protocol/c_shm_allocator.pyx +445 -0
  28. cbase/allocator_protocol/c_shm_comp.c +4654 -0
  29. cbase/allocator_protocol/c_shm_comp.cp315-win_amd64.pyd +0 -0
  30. cbase/allocator_protocol/c_shm_comp.h +49 -0
  31. cbase/allocator_protocol/c_shm_comp.pxd +46 -0
  32. cbase/allocator_protocol/c_shm_comp.pyx +1 -0
  33. cbase/backports/__infra__.pxd +17 -0
  34. cbase/backports/__init__.pxd +17 -0
  35. cbase/backports/__init__.py +9 -0
  36. cbase/backports/pydict.h +55 -0
  37. cbase/backports/pydict.pxd +5 -0
  38. cbase/backports/pylong.c +9965 -0
  39. cbase/backports/pylong.cp315-win_amd64.pyd +0 -0
  40. cbase/backports/pylong.h +79 -0
  41. cbase/backports/pylong.pxd +23 -0
  42. cbase/backports/pylong.pyx +61 -0
  43. cbase/bytemap/__infra__.pxd +42 -0
  44. cbase/bytemap/__init__.pxd +42 -0
  45. cbase/bytemap/__init__.py +21 -0
  46. cbase/bytemap/c_bytemap.c +52151 -0
  47. cbase/bytemap/c_bytemap.cp315-win_amd64.pyd +0 -0
  48. cbase/bytemap/c_bytemap.h +867 -0
  49. cbase/bytemap/c_bytemap.pxd +370 -0
  50. cbase/bytemap/c_bytemap.pyx +1760 -0
  51. cbase/bytemap/xxh3.h +55 -0
  52. cbase/bytemap/xxhash.c +42 -0
  53. cbase/bytemap/xxhash.h +7487 -0
  54. cbase/config_view.c +7253 -0
  55. cbase/config_view.cp315-win_amd64.pyd +0 -0
  56. cbase/config_view.pyx +85 -0
  57. cbase/env.c +11120 -0
  58. cbase/env.cp315-win_amd64.pyd +0 -0
  59. cbase/env.pxd +8 -0
  60. cbase/env.pyi +48 -0
  61. cbase/env.pyx +46 -0
  62. cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c +31874 -0
  63. cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h +352 -0
  64. cbase/includes/cbase/allocator_protocol/c_heap_allocator.c +38225 -0
  65. cbase/includes/cbase/allocator_protocol/c_heap_allocator.h +554 -0
  66. cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c +33455 -0
  67. cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h +1105 -0
  68. cbase/includes/cbase/allocator_protocol/c_shm_allocator.h +1270 -0
  69. cbase/includes/cbase/allocator_protocol/c_shm_comp.c +4654 -0
  70. cbase/includes/cbase/allocator_protocol/c_shm_comp.h +49 -0
  71. cbase/includes/cbase/backports/pydict.h +55 -0
  72. cbase/includes/cbase/backports/pylong.c +9965 -0
  73. cbase/includes/cbase/backports/pylong.h +79 -0
  74. cbase/includes/cbase/bytemap/c_bytemap.c +52151 -0
  75. cbase/includes/cbase/bytemap/c_bytemap.h +867 -0
  76. cbase/includes/cbase/bytemap/xxh3.h +55 -0
  77. cbase/includes/cbase/bytemap/xxhash.c +42 -0
  78. cbase/includes/cbase/bytemap/xxhash.h +7487 -0
  79. cbase/includes/cbase/config_view.c +7253 -0
  80. cbase/includes/cbase/env.c +11120 -0
  81. cbase/includes/cbase/int128.h +81 -0
  82. cbase/includes/cbase/intern_string/c_intern_string.c +28138 -0
  83. cbase/includes/cbase/intern_string/c_intern_string.h +614 -0
  84. cbase/includes/cbase/nt/pthread_nt_compat.h +102 -0
  85. cbase/includes/cbase/nt/regex_nt_compat.h +133 -0
  86. cbase/includes/cbase/nt/time_sched_nt_compat.h +32 -0
  87. cbase/int128.h +81 -0
  88. cbase/int128.pxd +15 -0
  89. cbase/intern_string/BENCHMARK.md +157 -0
  90. cbase/intern_string/__infra__.pxd +13 -0
  91. cbase/intern_string/__init__.pxd +13 -0
  92. cbase/intern_string/__init__.py +19 -0
  93. cbase/intern_string/c_intern_string.c +28138 -0
  94. cbase/intern_string/c_intern_string.cp315-win_amd64.pyd +0 -0
  95. cbase/intern_string/c_intern_string.h +614 -0
  96. cbase/intern_string/c_intern_string.pxd +121 -0
  97. cbase/intern_string/c_intern_string.pyi +376 -0
  98. cbase/intern_string/c_intern_string.pyx +765 -0
  99. cbase/nt/pthread_nt_compat.h +102 -0
  100. cbase/nt/regex_nt_compat.h +133 -0
  101. cbase/nt/time_sched_nt_compat.h +32 -0
  102. pycybase-0.1.10.dist-info/METADATA +190 -0
  103. pycybase-0.1.10.dist-info/RECORD +105 -0
  104. pycybase-0.1.10.dist-info/WHEEL +5 -0
  105. pycybase-0.1.10.dist-info/top_level.txt +1 -0
@@ -0,0 +1,102 @@
1
+ #ifndef PTHREAD_NT_COMPAT_H
2
+ #define PTHREAD_NT_COMPAT_H
3
+
4
+ #ifndef _WIN32
5
+ #error "pthread_nt_compat.h is intended for Windows builds only"
6
+ #endif
7
+
8
+ #include <errno.h>
9
+ #include <limits.h>
10
+ #include <time.h>
11
+
12
+ #ifndef WIN32_LEAN_AND_MEAN
13
+ #define WIN32_LEAN_AND_MEAN
14
+ #endif
15
+ #include <windows.h>
16
+
17
+ typedef CRITICAL_SECTION pthread_mutex_t;
18
+ typedef void pthread_mutexattr_t;
19
+ typedef CONDITION_VARIABLE pthread_cond_t;
20
+ typedef void pthread_condattr_t;
21
+
22
+ static inline DWORD pthread_nt_timeout_ms(const struct timespec* abstime) {
23
+ if (!abstime) return INFINITE;
24
+
25
+ struct timespec now;
26
+ if (timespec_get(&now, TIME_UTC) != TIME_UTC) return 0;
27
+
28
+ time_t sec = abstime->tv_sec - now.tv_sec;
29
+ long nsec = abstime->tv_nsec - now.tv_nsec;
30
+ if (nsec < 0) { sec -= 1; nsec += 1000000000L; }
31
+ if (sec < 0 || (sec == 0 && nsec <= 0)) return 0;
32
+
33
+ unsigned long long ms = (unsigned long long) sec * 1000ULL;
34
+ ms += (unsigned long long) ((nsec + 999999L) / 1000000L);
35
+ if (ms > (unsigned long long) INFINITE - 1ULL) return INFINITE - 1;
36
+ return (DWORD) ms;
37
+ }
38
+
39
+ static inline int pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr) {
40
+ (void) attr;
41
+ if (!mutex) return EINVAL;
42
+ InitializeCriticalSection(mutex);
43
+ return 0;
44
+ }
45
+
46
+ static inline int pthread_mutex_lock(pthread_mutex_t* mutex) {
47
+ if (!mutex) return EINVAL;
48
+ EnterCriticalSection(mutex);
49
+ return 0;
50
+ }
51
+
52
+ static inline int pthread_mutex_unlock(pthread_mutex_t* mutex) {
53
+ if (!mutex) return EINVAL;
54
+ LeaveCriticalSection(mutex);
55
+ return 0;
56
+ }
57
+
58
+ static inline int pthread_mutex_destroy(pthread_mutex_t* mutex) {
59
+ if (!mutex) return EINVAL;
60
+ DeleteCriticalSection(mutex);
61
+ return 0;
62
+ }
63
+
64
+ static inline int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr) {
65
+ (void) attr;
66
+ if (!cond) return EINVAL;
67
+ InitializeConditionVariable(cond);
68
+ return 0;
69
+ }
70
+
71
+ static inline int pthread_cond_wait(pthread_cond_t* cond, pthread_mutex_t* mutex) {
72
+ if (!cond || !mutex) return EINVAL;
73
+ if (SleepConditionVariableCS(cond, mutex, INFINITE)) return 0;
74
+ return EINVAL;
75
+ }
76
+
77
+ static inline int pthread_cond_timedwait(pthread_cond_t* cond, pthread_mutex_t* mutex, const struct timespec* abstime) {
78
+ if (!cond || !mutex) return EINVAL;
79
+ DWORD timeout_ms = pthread_nt_timeout_ms(abstime);
80
+ if (SleepConditionVariableCS(cond, mutex, timeout_ms)) return 0;
81
+ if (GetLastError() == ERROR_TIMEOUT) return ETIMEDOUT;
82
+ return EINVAL;
83
+ }
84
+
85
+ static inline int pthread_cond_signal(pthread_cond_t* cond) {
86
+ if (!cond) return EINVAL;
87
+ WakeConditionVariable(cond);
88
+ return 0;
89
+ }
90
+
91
+ static inline int pthread_cond_broadcast(pthread_cond_t* cond) {
92
+ if (!cond) return EINVAL;
93
+ WakeAllConditionVariable(cond);
94
+ return 0;
95
+ }
96
+
97
+ static inline int pthread_cond_destroy(pthread_cond_t* cond) {
98
+ (void) cond;
99
+ return 0;
100
+ }
101
+
102
+ #endif /* PTHREAD_NT_COMPAT_H */
@@ -0,0 +1,133 @@
1
+ #ifndef REGEX_NT_COMPAT_H
2
+ #define REGEX_NT_COMPAT_H
3
+
4
+ #ifndef _WIN32
5
+ #error "regex_nt_compat.h is intended for Windows builds only"
6
+ #endif
7
+
8
+ #include <errno.h>
9
+ #include <stddef.h>
10
+
11
+ #if defined(__has_include)
12
+ #if __has_include(<Python.h>)
13
+ #include <Python.h>
14
+ #define REGEX_NT_COMPAT_HAS_PYTHON 1
15
+ #else
16
+ #define REGEX_NT_COMPAT_HAS_PYTHON 0
17
+ #endif
18
+ #else
19
+ #include <Python.h>
20
+ #define REGEX_NT_COMPAT_HAS_PYTHON 1
21
+ #endif
22
+
23
+ #ifndef REG_EXTENDED
24
+ #define REG_EXTENDED 1
25
+ #endif
26
+
27
+ #ifndef REG_NOMATCH
28
+ #define REG_NOMATCH 1
29
+ #endif
30
+
31
+ #ifndef REG_BADPAT
32
+ #define REG_BADPAT 2
33
+ #endif
34
+
35
+ typedef struct regex_t {
36
+ PyObject* compiled;
37
+ } regex_t;
38
+
39
+ typedef struct regmatch_t {
40
+ ptrdiff_t rm_so;
41
+ ptrdiff_t rm_eo;
42
+ } regmatch_t;
43
+
44
+ #if REGEX_NT_COMPAT_HAS_PYTHON
45
+
46
+ static inline int regcomp(regex_t* regex, const char* pattern, int cflags) {
47
+ (void) cflags;
48
+ if (!regex || !pattern) {
49
+ return REG_BADPAT;
50
+ }
51
+
52
+ regex->compiled = NULL;
53
+
54
+ PyGILState_STATE gil_state = PyGILState_Ensure();
55
+ PyObject* re_module = PyImport_ImportModule("re");
56
+ if (!re_module) {
57
+ PyErr_Clear();
58
+ PyGILState_Release(gil_state);
59
+ return REG_BADPAT;
60
+ }
61
+
62
+ PyObject* compiled = PyObject_CallMethod(re_module, "compile", "s", pattern);
63
+ Py_DECREF(re_module);
64
+ if (!compiled) {
65
+ PyErr_Clear();
66
+ PyGILState_Release(gil_state);
67
+ return REG_BADPAT;
68
+ }
69
+
70
+ regex->compiled = compiled;
71
+ PyGILState_Release(gil_state);
72
+ return 0;
73
+ }
74
+
75
+ static inline int regexec(const regex_t* regex, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags) {
76
+ (void) nmatch;
77
+ (void) pmatch;
78
+ (void) eflags;
79
+
80
+ if (!regex || !regex->compiled || !string) {
81
+ return REG_NOMATCH;
82
+ }
83
+
84
+ PyGILState_STATE gil_state = PyGILState_Ensure();
85
+ PyObject* match = PyObject_CallMethod(regex->compiled, "search", "s", string);
86
+ if (!match) {
87
+ PyErr_Clear();
88
+ PyGILState_Release(gil_state);
89
+ return REG_NOMATCH;
90
+ }
91
+
92
+ int result = (match == Py_None) ? REG_NOMATCH : 0;
93
+ Py_DECREF(match);
94
+ PyGILState_Release(gil_state);
95
+ return result;
96
+ }
97
+
98
+ static inline void regfree(regex_t* regex) {
99
+ if (!regex || !regex->compiled) {
100
+ return;
101
+ }
102
+
103
+ PyGILState_STATE gil_state = PyGILState_Ensure();
104
+ Py_DECREF(regex->compiled);
105
+ regex->compiled = NULL;
106
+ PyGILState_Release(gil_state);
107
+ }
108
+
109
+ #else
110
+
111
+ static inline int regcomp(regex_t* regex, const char* pattern, int cflags) {
112
+ (void) regex;
113
+ (void) pattern;
114
+ (void) cflags;
115
+ return REG_BADPAT;
116
+ }
117
+
118
+ static inline int regexec(const regex_t* regex, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags) {
119
+ (void) regex;
120
+ (void) string;
121
+ (void) nmatch;
122
+ (void) pmatch;
123
+ (void) eflags;
124
+ return REG_NOMATCH;
125
+ }
126
+
127
+ static inline void regfree(regex_t* regex) {
128
+ (void) regex;
129
+ }
130
+
131
+ #endif
132
+
133
+ #endif /* REGEX_NT_COMPAT_H */
@@ -0,0 +1,32 @@
1
+ #ifndef TIME_SCHED_NT_COMPAT_H
2
+ #define TIME_SCHED_NT_COMPAT_H
3
+
4
+ #ifndef _WIN32
5
+ #error "time_sched_nt_compat.h is intended for Windows builds only"
6
+ #endif
7
+
8
+ #include <time.h>
9
+
10
+ #ifndef WIN32_LEAN_AND_MEAN
11
+ #define WIN32_LEAN_AND_MEAN
12
+ #endif
13
+ #include <windows.h>
14
+
15
+ #ifndef CLOCK_REALTIME
16
+ #define CLOCK_REALTIME 0
17
+ #endif
18
+
19
+ static inline int clock_gettime(int clock_id, struct timespec* ts) {
20
+ (void) clock_id;
21
+ if (!ts) {
22
+ return -1;
23
+ }
24
+
25
+ return timespec_get(ts, TIME_UTC) == TIME_UTC ? 0 : -1;
26
+ }
27
+
28
+ static inline void sched_yield(void) {
29
+ SwitchToThread();
30
+ }
31
+
32
+ #endif /* TIME_SCHED_NT_COMPAT_H */
@@ -0,0 +1,190 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyCyBase
3
+ Version: 0.1.10
4
+ Summary: Common C / Cython dual interfaces (allocator protocol, SHM allocator, heap allocator) for Python HFT projects
5
+ Author-email: Han Bolun <Bolun.Han@outlook.com>
6
+ Project-URL: Homepage, https://github.com/BolunHan/PyCyBase
7
+ Project-URL: Repository, https://github.com/BolunHan/PyCyBase
8
+ Project-URL: Issues, https://github.com/BolunHan/PyCyBase/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 :: POSIX :: Linux
14
+ Requires-Python: >=3.12
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: cython
17
+ Provides-Extra: docs
18
+ Requires-Dist: mypy; extra == "docs"
19
+ Requires-Dist: sphinx; extra == "docs"
20
+ Requires-Dist: sphinx-rtd-theme; extra == "docs"
21
+ Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
22
+
23
+ # PyCyBase
24
+
25
+ [![docs](https://github.com/BolunHan/PyCyBase/actions/workflows/build-page-docs.yml/badge.svg)](https://github.com/BolunHan/PyCyBase/actions/workflows/build-page-docs.yml)
26
+ [![pypi-linux](https://github.com/BolunHan/PyCyBase/actions/workflows/publish-posix-to-pypi.yml/badge.svg)](https://github.com/BolunHan/PyCyBase/actions/workflows/publish-posix-to-pypi.yml)
27
+ [![pypi-windows](https://github.com/BolunHan/PyCyBase/actions/workflows/publish-nt-to-pypi.yml/badge.svg)](https://github.com/BolunHan/PyCyBase/actions/workflows/publish-nt-to-pypi.yml)
28
+
29
+ Common C / Cython dual interfaces for Python HFT Projects.
30
+
31
+ ## Overview
32
+
33
+ Low-level allocator infrastructure shared across HFT projects:
34
+
35
+ - **Allocator Protocol** — Pluggable memory allocation with heap, shared-memory (SHM), and raw `malloc` backends. Ref-counting, vigilant mode, thread-safety controls.
36
+ - **Heap Allocator** — In-process allocator with free-list reuse and auto-growing pages.
37
+ - **SHM Allocator** — POSIX shared-memory page allocator with fixed-address virtual region mapping for cross-process pointer stability.
38
+ - **ByteMap** — Fast xxHash3-backed hash maps for byte-string keys (ByteMap, ByteMapEx, bound variants).
39
+ - **Intern String** — FNV-1a-hashed string interning with SHM-backed cross-process pools. 1.7–2.2× speedup over Python `str`.
40
+
41
+ ## Quick Start
42
+
43
+ ```python
44
+ from cbase.allocator_protocol import AllocatorProtocol, AP_SHARED
45
+
46
+ with AP_SHARED:
47
+ alloc = AllocatorProtocol(1024)
48
+ alloc.buf[0] = b'x'
49
+ ```
50
+
51
+ ```python
52
+ from cbase.intern_string import POOL
53
+
54
+ aapl = POOL.istr("AAPL")
55
+ assert aapl is POOL.istr("AAPL") # Identity — string deduplication
56
+ ```
57
+
58
+ ```python
59
+ from cbase.bytemap import ByteMap
60
+
61
+ bm = ByteMap()
62
+ bm[b"ticker"] = b"AAPL"
63
+ assert bm[b"ticker"] == b"AAPL"
64
+ ```
65
+
66
+ ## Build & Install
67
+
68
+ PyCyBase is a Cython extension package — it **cannot** be used with `pip install -e .` (editable mode breaks Cython `.pxd` resolution for downstream projects).
69
+
70
+ ### POSIX (Linux / macOS)
71
+
72
+ ```bash
73
+ # Build extensions in-place, then install
74
+ ./build.sh -i
75
+
76
+ # Or equivalently:
77
+ make build && pip install -U . --no-build-isolation
78
+
79
+ # Or step by step:
80
+ python setup.py build_ext --inplace --verbose --force
81
+ pip install -U . --no-build-isolation
82
+ ```
83
+
84
+ **Build script reference:**
85
+
86
+ | Command | Effect |
87
+ |---------|--------|
88
+ | `./build.sh` | Clean + build in-place |
89
+ | `./build.sh -i` | Clean + build + `pip install .` |
90
+ | `./build.sh -r` | Clean + build + force-reinstall |
91
+ | `./build.sh -c` | Clean only (no build) |
92
+ | `./build.sh -a` | Deep clean (remove `.c` and `.so` files) |
93
+ | `./build.sh -l` | List all compile-time macros |
94
+ | `./build.sh -v /path/to/venv` | Use a specific venv |
95
+ | `make` or `make build` | Clean + build |
96
+ | `make install` | Build + `pip install .` |
97
+ | `make reinstall` | Build + force-reinstall |
98
+ | `make list-args` | List compile-time macros |
99
+
100
+ ### Windows (NT)
101
+
102
+ ```powershell
103
+ # Local build
104
+ .\build.ps1 -VenvPath "C:\Users\...\venv_313"
105
+
106
+ # Remote build (from Linux host):
107
+ python nt_build.py
108
+ ```
109
+
110
+ ### Compile-Time Macros
111
+
112
+ Override any macro at build time via environment variable:
113
+
114
+ ```bash
115
+ DEBUG=1 ./build.sh # Enable debug mode
116
+ DEBUG=1 make build # Same via Makefile
117
+ ```
118
+
119
+ List all available macros and defaults:
120
+
121
+ ```bash
122
+ ./build.sh -l # Auto-generates macros.json via probe.py
123
+ make list-args
124
+ python probe.py # Run the probe directly
125
+ ```
126
+
127
+ Key macros (see `macros.json` for full list):
128
+
129
+ | Macro | Default | Description |
130
+ |-------|---------|-------------|
131
+ | `AP_ALLOC_VIGILANT` | `1` | Enable bounds/canary checks |
132
+ | `AP_ALLOC_WITH_LOCK` | `1` | Thread-safety via pthread mutex |
133
+ | `AP_ALLOC_WITH_SHM` | `0` | Default to SHM allocator |
134
+ | `AP_ALLOC_WITH_FREELIST` | `1` | Free-list reuse |
135
+ | `AP_HEAP_AUTOPAGE_CAPACITY` | `64 KiB` | Default heap page size |
136
+ | `AP_HEAP_AUTOPAGE_CAPACITY_MAX` | `16 MiB` | Max heap page size |
137
+ | `AP_HEAP_EXACT_BIN_COUNT` | `8192` | Exact 8-byte-granular free-list bins |
138
+ | `AP_HEAP_LARGE_BIN_COUNT` | `9` | Pow2-class free-list bins for large blocks |
139
+ | `AP_HEAP_PAGE_EXTEND_MAX` | `128 MiB` | Max auto-page extension on bin miss |
140
+ | `AP_HEAP_EXACT_BIN_PROBE_COUNT` | `2` | Larger exact bins to probe before extending |
141
+ | `AP_SHM_AUTOPAGE_CAPACITY` | `64 KiB` | Default SHM page size |
142
+ | `AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE` | `128 GiB` | SHM virtual region |
143
+ | `AP_SHM_EXACT_BIN_COUNT` | `8192` | Exact 8-byte-granular free-list bins |
144
+ | `AP_SHM_PAGE_EXTEND_MAX` | `128 MiB` | Max auto-page extension on bin miss |
145
+
146
+ ### Using `get_include()` in Downstream Projects
147
+
148
+ ```python
149
+ from setuptools import setup, Extension
150
+ from Cython.Build import cythonize
151
+ import cbase
152
+
153
+ ext = Extension(
154
+ "my_module",
155
+ sources=["my_module.pyx"],
156
+ include_dirs=cbase.get_include(),
157
+ )
158
+ setup(ext_modules=cythonize([ext]))
159
+ ```
160
+
161
+ ## Modules
162
+
163
+ | Module | Description |
164
+ |--------|-------------|
165
+ | `cbase.env` | `EnvConfigContext` — context manager for temporary config changes |
166
+ | `cbase.allocator_protocol` | `AllocatorProtocol`, `AllocatorConfigContext`, AP sentinels |
167
+ | `cbase.allocator_protocol.c_heap_allocator` | In-process heap allocator with free-list |
168
+ | `cbase.allocator_protocol.c_shm_allocator` | POSIX shared-memory page allocator |
169
+ | `cbase.bytemap.c_bytemap` | xxHash3-backed hash maps |
170
+ | `cbase.intern_string.c_intern_string` | FNV-1a-hashed string interning |
171
+ | `cbase.backports.pylong` | Python int ↔ 128-bit integer (uint128_t/int128_t) backport |
172
+ | `cbase.backports.pydict` | PyDict_Pop backport for pre-3.13 Python |
173
+
174
+ ## Documentation
175
+
176
+ ```bash
177
+ pip install sphinx furo
178
+ cd docs
179
+ sphinx-build -M html . _build
180
+ # Or with the project venv:
181
+ ~/Projects/venv_313/bin/sphinx-build -M html . _build
182
+ ```
183
+
184
+ Open `docs/_build/html/index.html`.
185
+
186
+ Online: https://bolunhan.github.io/PyCyBase/
187
+
188
+ ## License
189
+
190
+ Proprietary.
@@ -0,0 +1,105 @@
1
+ cbase/__infra__.pxd,sha256=GHTo1d99jSDHnJ5btmrsnIPufxObGMUuydgD9HcUVt8,164
2
+ cbase/__init__.pxd,sha256=GHTo1d99jSDHnJ5btmrsnIPufxObGMUuydgD9HcUVt8,164
3
+ cbase/__init__.py,sha256=yxZdmvu0YOADidGubBK5cazOo-HeCFFCxi53kb8o-Ms,655
4
+ cbase/config_view.c,sha256=JvDWsNAcpoGYqJ9v4GZ3q3DEyL6ZrOcsx82nNoLfRWI,347855
5
+ cbase/config_view.cp315-win_amd64.pyd,sha256=7xnMTpDLQkjt92CWq9X18r0FI5IcdcgLXk6voCNpQl8,29184
6
+ cbase/config_view.pyx,sha256=aBm5140_Xy-g517snlXELZs4yd63mAtE7fTJw3TIXOw,4476
7
+ cbase/env.c,sha256=gLulMGiwWjb97ybC43x-7P7_rGyalcg7o7qgNI52GKM,457329
8
+ cbase/env.cp315-win_amd64.pyd,sha256=ptbmFISsW7MnnEumYltl8l9dt21TIr9trGBODCQUDbE,53760
9
+ cbase/env.pxd,sha256=2bdWsv4upgPCVTkMY6BRExhsZ3JDBvxiD7Qd772sMQ0,152
10
+ cbase/env.pyi,sha256=6B5tlM65MTJxffbSH9aFfhZlKpJ-RkFFq8uxVUg1nuE,1426
11
+ cbase/env.pyx,sha256=9IM97NjbyOFHu875Jx_m9MqkimuJp4uR1ysCcEdcThw,1341
12
+ cbase/int128.h,sha256=oViSxaugBvmicLRCp3u1RiWz23KzmxyIyZtvvSVtX2M,2398
13
+ cbase/int128.pxd,sha256=IbblD1oOcYMWjy0HrXxsxwL35G6xzuzaUoIxc6dU-44,520
14
+ cbase/allocator_protocol/__infra__.pxd,sha256=kXIaDKB-6jwNLs2v-yvOcJDwl6dr-xTYgM5yUuYAu5M,2059
15
+ cbase/allocator_protocol/__init__.pxd,sha256=kXIaDKB-6jwNLs2v-yvOcJDwl6dr-xTYgM5yUuYAu5M,2059
16
+ cbase/allocator_protocol/__init__.py,sha256=LO9W9K1ffBtp1aNhrh_oGdU9eWKwn40Off_G_lEB8uw,1272
17
+ cbase/allocator_protocol/c_allocator_protocol.c,sha256=oy0AcQaIKkJnKP2U3JCevMCgPj_HOAVE8W19Dj1t6Z4,1316947
18
+ cbase/allocator_protocol/c_allocator_protocol.cp315-win_amd64.pyd,sha256=2Km2261419ChI7eQqjmHxjmMPrx4nuMzKj5DcSWfYQA,152064
19
+ cbase/allocator_protocol/c_allocator_protocol.h,sha256=5HjHfzW6Vs-Eai9V3U9SCAqLfu92Q-EfwCYWWeirnFo,13232
20
+ cbase/allocator_protocol/c_allocator_protocol.pxd,sha256=cGPO4QJbBw44YgkdXoLt79FR6l480xAZhRAgchfivEU,2624
21
+ cbase/allocator_protocol/c_allocator_protocol.pyi,sha256=quToj-oxTZ8VcPUxVJ2pTTJDhZ7k7fwxB7QLcKU1LbE,4182
22
+ cbase/allocator_protocol/c_allocator_protocol.pyx,sha256=ZziuBJ32YpRVEkX8XdLPwgmOFkXjrE6_0vlrc4JWhUA,10497
23
+ cbase/allocator_protocol/c_heap_allocator.c,sha256=zEsPrSJtkv5Rcu72duOaDEmHYv0_NLAewOOQlRvuU2Y,1618009
24
+ cbase/allocator_protocol/c_heap_allocator.cp315-win_amd64.pyd,sha256=7vsElE4VpdAVS4nU_GHFmxcwVUr46d_OVb1rdR0fjLA,198144
25
+ cbase/allocator_protocol/c_heap_allocator.h,sha256=iO16PtvelOVT6DOWJqL_QUWYHiRqYxca-Z44WHInBkA,17880
26
+ cbase/allocator_protocol/c_heap_allocator.pxd,sha256=UL85bsqBFgszAqNJKdawdPaBjU0Jc8fwkhyUovJ4hJA,3885
27
+ cbase/allocator_protocol/c_heap_allocator.pyi,sha256=zR2OMuVweL_1M5Cp-Xim97JI19-WakIupgfFSCM37Zc,4654
28
+ cbase/allocator_protocol/c_heap_allocator.pyx,sha256=nYCgOixFPfIosm2biAe9CY79BORKdL0f2Ktd3cU603I,12043
29
+ cbase/allocator_protocol/c_nt_shm_allocator.c,sha256=rXaVrmzn80U-mGABIOlUqzY_xuqFjleqI8i-KrbEvVs,1389777
30
+ cbase/allocator_protocol/c_nt_shm_allocator.cp315-win_amd64.pyd,sha256=sztu3DEi6MV5JRH4dEeXiEBiuQemWES0Ux6i8aSfB3M,180224
31
+ cbase/allocator_protocol/c_nt_shm_allocator.h,sha256=8Q4_MgcU_1hDFCuzeIo3XPt_Be-g-b_CEHjwfDiMVBU,36139
32
+ cbase/allocator_protocol/c_nt_shm_allocator.pxd,sha256=LaJNy6wGx-ZQD48vL4zb0d5mgtbXSHOqOuS1Y9X1aN4,4714
33
+ cbase/allocator_protocol/c_nt_shm_allocator.pyx,sha256=X4NPr69cqRAt3sXUl27FpouQNER1lySQKy6DbOc_8HM,9521
34
+ cbase/allocator_protocol/c_shm_allocator.h,sha256=xnPRZNzfdSBAaDrtWAAQzyV6ftnxM072oG10HKgm_I0,41855
35
+ cbase/allocator_protocol/c_shm_allocator.pxd,sha256=eB6pXJwMI2dPJKqcMs7frTbj65m3-HTtEk6b19o8wbk,5786
36
+ cbase/allocator_protocol/c_shm_allocator.pyi,sha256=jgarsVbYnjWXxlp0c9CHuBee6ZgNPDwApB5J9NrJ7b8,9570
37
+ cbase/allocator_protocol/c_shm_allocator.pyx,sha256=RGaCIMFJIRMSeOys8jwuIUTBXXPAgRwgR4Pl-PqurDI,17032
38
+ cbase/allocator_protocol/c_shm_comp.c,sha256=8IjTZICZdOWxpWF-6u7zzK9JUknR_TJvTsvJWf68wPM,195302
39
+ cbase/allocator_protocol/c_shm_comp.cp315-win_amd64.pyd,sha256=VjLQTwIW4XoxgxmS_u18o23sW5f_TRH268WNoq9VAec,18944
40
+ cbase/allocator_protocol/c_shm_comp.h,sha256=WBitRJ1JpWL-H_p5suhUFoFtPkkjR9TTVgQx9yuiLMU,1968
41
+ cbase/allocator_protocol/c_shm_comp.pxd,sha256=QGYxVQjR2tWzLcPW7a6xu389dsnXZU0AKZaPRFN2P3c,1870
42
+ cbase/allocator_protocol/c_shm_comp.pyx,sha256=RkI-L73IgEIiykhdPdyfjs9lJvHBV2fCeP0cfRYcYks,121
43
+ cbase/backports/__infra__.pxd,sha256=YSYd_zFps3ql31h49XBA1f5F_VMws7vXJsyXZwidYZk,316
44
+ cbase/backports/__init__.pxd,sha256=YSYd_zFps3ql31h49XBA1f5F_VMws7vXJsyXZwidYZk,316
45
+ cbase/backports/__init__.py,sha256=BipEaRj9FY54ASY18NYomZ7DAa0csl81iIYMDELNRfI,193
46
+ cbase/backports/pydict.h,sha256=aNZ0Y1wgvG46lKS_mw4wm2vwi8OVwpow8hofg2obfKk,1741
47
+ cbase/backports/pydict.pxd,sha256=fF_Fpmb9xkGb37a2-5kq0r2Ogea_ST9gW8FmcoZvWRI,158
48
+ cbase/backports/pylong.c,sha256=gzdNXGK8YsqokyRmYPhxs2sRYaQZVcRRBejb5GooYAQ,413411
49
+ cbase/backports/pylong.cp315-win_amd64.pyd,sha256=_VrFPZCP43YPM64JjTZvhiWHWMrSExbmVlCPBXNd09w,45056
50
+ cbase/backports/pylong.h,sha256=ZpNpCBYduT1ER08p4wnR8u2B-KUzQ87bKl9S2o9krq4,2218
51
+ cbase/backports/pylong.pxd,sha256=SnC7Bx9jgAbN87KFdXnoXPTiwGMzfHVPmoSJHIIUQm8,631
52
+ cbase/backports/pylong.pyx,sha256=98PNQSJaVPcD3VgaCq_ownuMQLRVDDhP8OpBYUTSSmw,2178
53
+ cbase/bytemap/__infra__.pxd,sha256=9UzjG3AFXPFe-jVvn3Ay27RcwSgUqFQJaCX4mCE19uU,1783
54
+ cbase/bytemap/__init__.pxd,sha256=9UzjG3AFXPFe-jVvn3Ay27RcwSgUqFQJaCX4mCE19uU,1783
55
+ cbase/bytemap/__init__.py,sha256=jmVp9McBp1PFWl-Dl1cWrTTtKGlB3ZeNmeALP6OBmXA,411
56
+ cbase/bytemap/c_bytemap.c,sha256=em5sOi8AX2j-2vC5JXZmDgcgdWVGAFNBLz19hQ83VBE,2410593
57
+ cbase/bytemap/c_bytemap.cp315-win_amd64.pyd,sha256=91VRp9uQu1monhuGsjtT9vkl5-kX3eLQ5Znjb1uP0cg,311296
58
+ cbase/bytemap/c_bytemap.h,sha256=hp40nHJxEanSXPPcoE211Mg7q58hRy0e5GNS11TTES4,34874
59
+ cbase/bytemap/c_bytemap.pxd,sha256=CtoBI94K1unkgsB1ga6_umdZ7ZfAV9c9f8fEcc6Tkzo,14782
60
+ cbase/bytemap/c_bytemap.pyx,sha256=m4r2NWYzRzuJIHIwsffIxYAMZoQDVfnliAMArY0TfYM,73117
61
+ cbase/bytemap/xxh3.h,sha256=p5JnfO0ib4pi-nvNTY06dDQJlOS_0-TNPfxl0XQHep0,2449
62
+ cbase/bytemap/xxhash.c,sha256=whY6q68SdhXQhrhbRueD3yWmBiKrSpny3n__nDTUCaE,1897
63
+ cbase/bytemap/xxhash.h,sha256=w0DdoWurKi0_e3N6M7L35xLo9ZK3yjBv9EG8M9FsHPM,286913
64
+ cbase/includes/cbase/config_view.c,sha256=JvDWsNAcpoGYqJ9v4GZ3q3DEyL6ZrOcsx82nNoLfRWI,347855
65
+ cbase/includes/cbase/env.c,sha256=gLulMGiwWjb97ybC43x-7P7_rGyalcg7o7qgNI52GKM,457329
66
+ cbase/includes/cbase/int128.h,sha256=oViSxaugBvmicLRCp3u1RiWz23KzmxyIyZtvvSVtX2M,2398
67
+ cbase/includes/cbase/allocator_protocol/c_allocator_protocol.c,sha256=oy0AcQaIKkJnKP2U3JCevMCgPj_HOAVE8W19Dj1t6Z4,1316947
68
+ cbase/includes/cbase/allocator_protocol/c_allocator_protocol.h,sha256=5HjHfzW6Vs-Eai9V3U9SCAqLfu92Q-EfwCYWWeirnFo,13232
69
+ cbase/includes/cbase/allocator_protocol/c_heap_allocator.c,sha256=zEsPrSJtkv5Rcu72duOaDEmHYv0_NLAewOOQlRvuU2Y,1618009
70
+ cbase/includes/cbase/allocator_protocol/c_heap_allocator.h,sha256=iO16PtvelOVT6DOWJqL_QUWYHiRqYxca-Z44WHInBkA,17880
71
+ cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.c,sha256=rXaVrmzn80U-mGABIOlUqzY_xuqFjleqI8i-KrbEvVs,1389777
72
+ cbase/includes/cbase/allocator_protocol/c_nt_shm_allocator.h,sha256=8Q4_MgcU_1hDFCuzeIo3XPt_Be-g-b_CEHjwfDiMVBU,36139
73
+ cbase/includes/cbase/allocator_protocol/c_shm_allocator.h,sha256=xnPRZNzfdSBAaDrtWAAQzyV6ftnxM072oG10HKgm_I0,41855
74
+ cbase/includes/cbase/allocator_protocol/c_shm_comp.c,sha256=8IjTZICZdOWxpWF-6u7zzK9JUknR_TJvTsvJWf68wPM,195302
75
+ cbase/includes/cbase/allocator_protocol/c_shm_comp.h,sha256=WBitRJ1JpWL-H_p5suhUFoFtPkkjR9TTVgQx9yuiLMU,1968
76
+ cbase/includes/cbase/backports/pydict.h,sha256=aNZ0Y1wgvG46lKS_mw4wm2vwi8OVwpow8hofg2obfKk,1741
77
+ cbase/includes/cbase/backports/pylong.c,sha256=gzdNXGK8YsqokyRmYPhxs2sRYaQZVcRRBejb5GooYAQ,413411
78
+ cbase/includes/cbase/backports/pylong.h,sha256=ZpNpCBYduT1ER08p4wnR8u2B-KUzQ87bKl9S2o9krq4,2218
79
+ cbase/includes/cbase/bytemap/c_bytemap.c,sha256=em5sOi8AX2j-2vC5JXZmDgcgdWVGAFNBLz19hQ83VBE,2410593
80
+ cbase/includes/cbase/bytemap/c_bytemap.h,sha256=hp40nHJxEanSXPPcoE211Mg7q58hRy0e5GNS11TTES4,34874
81
+ cbase/includes/cbase/bytemap/xxh3.h,sha256=p5JnfO0ib4pi-nvNTY06dDQJlOS_0-TNPfxl0XQHep0,2449
82
+ cbase/includes/cbase/bytemap/xxhash.c,sha256=whY6q68SdhXQhrhbRueD3yWmBiKrSpny3n__nDTUCaE,1897
83
+ cbase/includes/cbase/bytemap/xxhash.h,sha256=w0DdoWurKi0_e3N6M7L35xLo9ZK3yjBv9EG8M9FsHPM,286913
84
+ cbase/includes/cbase/intern_string/c_intern_string.c,sha256=p9iLPnrmMMz-__WgUBhGbPAsNyOQq0YkwQ3NYdrgZ1A,1301474
85
+ cbase/includes/cbase/intern_string/c_intern_string.h,sha256=G8iWzx3gLuS6BGW1FdiEFZte1xW1-hQ49juPgRXKbjc,20420
86
+ cbase/includes/cbase/nt/pthread_nt_compat.h,sha256=x3ocJ7BkGvgQeoX7ajTC2mjfnvO4wUTdIndr6hwCviE,3032
87
+ cbase/includes/cbase/nt/regex_nt_compat.h,sha256=MgA2Lt2AEA6_DGA_UYZmIXpz0K8Rd_ggdbYsBlH7AqU,3027
88
+ cbase/includes/cbase/nt/time_sched_nt_compat.h,sha256=Hc93-Q5wwX54KiNDhq2-yZrR9y9tgGytuXX2MxrDGUM,638
89
+ cbase/intern_string/BENCHMARK.md,sha256=u3nHS7OcoiLM8g6Vj_j9u6pQd91t-gX1eSsGKKuZrY8,8449
90
+ cbase/intern_string/__infra__.pxd,sha256=piQHolVEq8ws3uqc5MJTKVBX9hzub0FPueuTOBAtIZE,304
91
+ cbase/intern_string/__init__.pxd,sha256=piQHolVEq8ws3uqc5MJTKVBX9hzub0FPueuTOBAtIZE,304
92
+ cbase/intern_string/__init__.py,sha256=AMyVENcoE1A_SF1_D3RO9s6CRCPr2IsXbfs5oqOcY3Q,315
93
+ cbase/intern_string/c_intern_string.c,sha256=p9iLPnrmMMz-__WgUBhGbPAsNyOQq0YkwQ3NYdrgZ1A,1301474
94
+ cbase/intern_string/c_intern_string.cp315-win_amd64.pyd,sha256=6cBGRJVaZDXuDnC6nte7PQX9DGJGBRkDgTWrKaXtWxs,165888
95
+ cbase/intern_string/c_intern_string.h,sha256=G8iWzx3gLuS6BGW1FdiEFZte1xW1-hQ49juPgRXKbjc,20420
96
+ cbase/intern_string/c_intern_string.pxd,sha256=Ab1-FJTqidA3P0bQSqSGOM-Ne0nJMe39JpX-ONSBcdA,4075
97
+ cbase/intern_string/c_intern_string.pyi,sha256=-6Ga6pzFv_RuOsEP0Jlb_u39VL8LYy7dfEacG-y9n8Q,11955
98
+ cbase/intern_string/c_intern_string.pyx,sha256=G3dDqTSR3jfPlXSzumKnbXTNORfNFjDVwXokjLC4cW0,30785
99
+ cbase/nt/pthread_nt_compat.h,sha256=x3ocJ7BkGvgQeoX7ajTC2mjfnvO4wUTdIndr6hwCviE,3032
100
+ cbase/nt/regex_nt_compat.h,sha256=MgA2Lt2AEA6_DGA_UYZmIXpz0K8Rd_ggdbYsBlH7AqU,3027
101
+ cbase/nt/time_sched_nt_compat.h,sha256=Hc93-Q5wwX54KiNDhq2-yZrR9y9tgGytuXX2MxrDGUM,638
102
+ pycybase-0.1.10.dist-info/METADATA,sha256=7KIdd53n0ZS2zKEMtsUhnAKV9uzdErMuJX6p0kgffHM,6933
103
+ pycybase-0.1.10.dist-info/WHEEL,sha256=vzG7iaHUv310H03WC5RS3uTU5LOhxdhkDdsyetvf8DQ,101
104
+ pycybase-0.1.10.dist-info/top_level.txt,sha256=1-AmkpeoVkkB4J_ETk_plA58n1BC02e30z4uvm_6bf8,6
105
+ pycybase-0.1.10.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: cp315-cp315-win_amd64
5
+
@@ -0,0 +1 @@
1
+ cbase