Skip to main content

PyCyBase

gitlab

GitHub Actions: ⛔ temporarily disabled — kept disabled until the GitHub Actions issue is resolved. See .github/workflows/README.md. CI runs on the GitLab mirror pipeline while disabled.

Common C / Cython dual interfaces for Python HFT Projects.

Overview

Low-level allocator infrastructure shared across HFT projects:

  • Allocator Protocol — Pluggable memory allocation with heap, shared-memory (SHM), and raw malloc backends. Ref-counting, vigilant mode, thread-safety controls.
  • Heap Allocator — In-process allocator with free-list reuse and auto-growing pages.
  • SHM Allocator — POSIX shared-memory page allocator with fixed-address virtual region mapping for cross-process pointer stability.
  • ByteMap — Fast xxHash3-backed hash maps for byte-string keys (ByteMap, ByteMapEx, bound variants).
  • Intern String — FNV-1a-hashed string interning with SHM-backed cross-process pools. 1.7–2.2× speedup over Python str.

Quick Start

from cbase.allocator_protocol import AllocatorProtocol, AP_SHARED

with AP_SHARED:
    alloc = AllocatorProtocol(1024)
    alloc.buf[0] = b'x'
from cbase.intern_string import POOL

aapl = POOL.istr("AAPL")
assert aapl is POOL.istr("AAPL")  # Identity — string deduplication
from cbase.bytemap import ByteMap

bm = ByteMap()
bm[b"ticker"] = b"AAPL"
assert bm[b"ticker"] == b"AAPL"

Build & Install

PyCyBase is a Cython extension package — it cannot be used with pip install -e . (editable mode breaks Cython .pxd resolution for downstream projects).

POSIX (Linux / macOS)

# Build extensions in-place, then install
./build.sh -i

# Or equivalently:
make build && pip install -U . --no-build-isolation

# Or step by step:
python setup.py build_ext --inplace --verbose --force
pip install -U . --no-build-isolation

Build script reference:

Command Effect
./build.sh Clean + build in-place
./build.sh -i Clean + build + pip install .
./build.sh -r Clean + build + force-reinstall
./build.sh -c Clean only (no build)
./build.sh -a Deep clean (remove .c and .so files)
./build.sh -l List all compile-time macros
./build.sh -v /path/to/venv Use a specific venv
make or make build Clean + build
make install Build + pip install .
make reinstall Build + force-reinstall
make list-args List compile-time macros

Windows (NT)

# Local build
.\build.ps1 -VenvPath "C:\Users\...\venv_313"

# Remote build (from Linux host):
python nt_build.py

Compile-Time Macros

Override any macro at build time via environment variable:

DEBUG=1 ./build.sh         # Enable debug mode
DEBUG=1 make build          # Same via Makefile

List all available macros and defaults:

./build.sh -l               # Auto-generates macros.json via probe.py
make list-args
python probe.py             # Run the probe directly

Key macros (see macros.json for full list):

Macro Default Description
AP_ALLOC_VIGILANT 1 Enable bounds/canary checks
AP_ALLOC_WITH_LOCK 1 Thread-safety via pthread mutex
AP_ALLOC_WITH_SHM 0 Default to SHM allocator
AP_ALLOC_WITH_FREELIST 1 Free-list reuse
AP_HEAP_AUTOPAGE_CAPACITY 64 KiB Default heap page size
AP_HEAP_AUTOPAGE_CAPACITY_MAX 16 MiB Max heap page size
AP_HEAP_EXACT_BIN_COUNT 8192 Exact 8-byte-granular free-list bins
AP_HEAP_LARGE_BIN_COUNT 9 Pow2-class free-list bins for large blocks
AP_HEAP_PAGE_EXTEND_MAX 128 MiB Max auto-page extension on bin miss
AP_HEAP_EXACT_BIN_PROBE_COUNT 2 Larger exact bins to probe before extending
AP_SHM_AUTOPAGE_CAPACITY 64 KiB Default SHM page size
AP_SHM_ALLOCATOR_DEFAULT_REGION_SIZE 128 GiB SHM virtual region
AP_SHM_EXACT_BIN_COUNT 8192 Exact 8-byte-granular free-list bins
AP_SHM_PAGE_EXTEND_MAX 128 MiB Max auto-page extension on bin miss

Using get_include() in Downstream Projects

from setuptools import setup, Extension
from Cython.Build import cythonize
import cbase

ext = Extension(
    "my_module",
    sources=["my_module.pyx"],
    include_dirs=cbase.get_include(),
)
setup(ext_modules=cythonize([ext]))

Modules

Module Description
cbase.env EnvConfigContext — context manager for temporary config changes
cbase.allocator_protocol AllocatorProtocol, AllocatorConfigContext, AP sentinels
cbase.allocator_protocol.c_heap_allocator In-process heap allocator with free-list
cbase.allocator_protocol.c_shm_allocator POSIX shared-memory page allocator
cbase.bytemap.c_bytemap xxHash3-backed hash maps
cbase.intern_string.c_intern_string FNV-1a-hashed string interning
cbase.backports.pylong Python int ↔ 128-bit integer (uint128_t/int128_t) backport
cbase.backports.pydict PyDict_Pop backport for pre-3.13 Python

Documentation

pip install sphinx furo
cd docs
sphinx-build -M html . _build
# Or with the project venv:
~/Projects/venv_313/bin/sphinx-build -M html . _build

Open docs/_build/html/index.html.

Online: https://bolunhan.github.io/PyCyBase/

License

Proprietary.

Metadata

Release files for PyCyBase 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for PyCyBase 0.2.7
File Actions
pycybase-0.2.7-cp315-cp315t-win_amd64.whl CPython 3.15 CPython 3.15 free-threading Windows x86-64 Details for pycybase-0.2.7-cp315-cp315t-win_amd64.whl
pycybase-0.2.7-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pycybase-0.2.7-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pycybase-0.2.7-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for pycybase-0.2.7-cp315-cp315-win_amd64.whl
pycybase-0.2.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pycybase-0.2.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pycybase-0.2.7-cp314-cp314t-win_amd64.whl CPython 3.14 CPython 3.14 free-threading Windows x86-64 Details for pycybase-0.2.7-cp314-cp314t-win_amd64.whl
pycybase-0.2.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pycybase-0.2.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pycybase-0.2.7-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for pycybase-0.2.7-cp314-cp314-win_amd64.whl
pycybase-0.2.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pycybase-0.2.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pycybase-0.2.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for pycybase-0.2.7-cp313-cp313-win_amd64.whl
pycybase-0.2.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 Details for pycybase-0.2.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
pycybase-0.2.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for pycybase-0.2.7-cp312-cp312-win_amd64.whl
pycybase-0.2.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.17+ x86-64 Details for pycybase-0.2.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Total release size: 75.5 MB

Release files / pycybase-0.2.7-cp315-cp315t-win_amd64.whl

Download URL pycybase-0.2.7-cp315-cp315t-win_amd64.whl
Size 4.1 MB
Tags CPython 3.15 CPython 3.15 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
b7300dc225d3a143218c7549769663e0dda6663452ae41b33cfd290f9031b38f
BLAKE2b-256 checksum
How to use checksums
f06f1f3aa923ab9eaaed0f6ca6c591c1f78463fbd855e89eec62ab52fbca744b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.6 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
15b039374470bfc6af767a6a1fd5562b0a92a2ab1ad634d8f58d96fc7cf64f3c
BLAKE2b-256 checksum
How to use checksums
e6ef7836605cf34173623e6c49d4803c2a2eb515befe9e85021a5c29f56b9276
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pycybase-0.2.7-cp315-cp315-win_amd64.whl

Download URL pycybase-0.2.7-cp315-cp315-win_amd64.whl
Size 4.0 MB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
1b176f955c4ed4ba83ca8e5cbe6fa172a98fb11af5db66819907e8acc6da80c1
BLAKE2b-256 checksum
How to use checksums
20c3cedf1ccda8eb4747ca6f96a9296907c70335f90699411623047babe4fee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.5 MB
Tags CPython 3.15 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
17ec7e92aa8abce14363e974f8eaa94004e901804978e3017d0e4838025e1bac
BLAKE2b-256 checksum
How to use checksums
e1d669b88c55bb07da573b296ef72c4b0ba5eecec5a194e3e2b8b4170307eddb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pycybase-0.2.7-cp314-cp314t-win_amd64.whl

Download URL pycybase-0.2.7-cp314-cp314t-win_amd64.whl
Size 4.1 MB
Tags CPython 3.14 CPython 3.14 free-threading Windows x86-64
SHA-256 checksum
How to use checksums
e8799b6708e36fc27ed068ef172f5cc4747bcf4def18fcfd35e6010b8df2bc84
BLAKE2b-256 checksum
How to use checksums
0c963d71ade610202a9494f7d2f8f39c7a4125abdbb332d666d631262053d1cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.6 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
09351d1cea4cc4122121bff9046031af9d70b71b6310c5451463e30a3119dbfe
BLAKE2b-256 checksum
How to use checksums
67e1532184b948ad26c83eae30a59da2cc9a76aea294fb5010cac052e200238f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pycybase-0.2.7-cp314-cp314-win_amd64.whl

Download URL pycybase-0.2.7-cp314-cp314-win_amd64.whl
Size 4.0 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
5d14c69a735a54e60bf4c772df94fce86af7b6efada6d2f56cd269db6602affd
BLAKE2b-256 checksum
How to use checksums
479783a62e6f8b15e682da1bc8c5f4aa9d376683925402d78ba6ff235b8a3137
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.5 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b0656e8be5e41d22aad4e7a38f10aa9d652775d47e6925d884ba283b32ab17be
BLAKE2b-256 checksum
How to use checksums
686d3ef90015147ec2d3686f845825c8ffa2c8afbb0773d77b1b5b0aeca98d83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pycybase-0.2.7-cp313-cp313-win_amd64.whl

Download URL pycybase-0.2.7-cp313-cp313-win_amd64.whl
Size 4.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
2fdd95442c33b9ab2e6ddad1315e5e35079c8ce35191f80700fad97893007241
BLAKE2b-256 checksum
How to use checksums
c7e92f79120647bf0503bcdcfe181d1a30d1bd87e84d3b2798e1a59f779d23ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.5 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
da898b3feece8e71c56c0acb8f22c966f3b520871885334dceec9c8914fb35ad
BLAKE2b-256 checksum
How to use checksums
5b4abfea9ade8a30bd1fbd02d1ffc04cb7258e045e48ec38d192b069937d3031
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / pycybase-0.2.7-cp312-cp312-win_amd64.whl

Download URL pycybase-0.2.7-cp312-cp312-win_amd64.whl
Size 4.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
717e2e0dd21a1606fffd574ff23593d82c8ae41c2d128725178123308601f496
BLAKE2b-256 checksum
How to use checksums
97cd965599ff1d4cd96cf9d1c9ba099786d61e59ef18f463d879c4073b33d270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / pycybase-0.2.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl

Download URL pycybase-0.2.7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Size 8.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1da6ce9e8131ea9a1e34b3171601d0a8029df06aa9f9d662e9b077f1c597b7ff
BLAKE2b-256 checksum
How to use checksums
41a1bb5f73c55472a776260d3fcb91aa16ab7451381992a63e27cd553ddfd9bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for PyCyBase 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page