ppc64le/linux/: preshed-3.0.13+ppc64le1 metadata and description

Homepage Simple index

Cython hash table that trusts the keys are pre-hashed

author Explosion
author_email [email protected]
classifiers
  • Environment :: Console
  • Intended Audience :: Developers
  • Intended Audience :: Science/Research
  • License :: OSI Approved :: MIT License
  • Operating System :: POSIX :: Linux
  • Operating System :: MacOS :: MacOS X
  • Operating System :: Microsoft :: Windows
  • Programming Language :: Cython
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • Programming Language :: Python :: 3.13
  • Programming Language :: Python :: 3.14
  • Programming Language :: Python :: Free Threading :: 2 - Beta
  • Topic :: Scientific/Engineering
  • Environment :: MetaData :: IBM Python Ecosystem
description_content_type text/markdown
dynamic
  • author
  • author-email
  • classifier
  • description
  • description-content-type
  • home-page
  • license
  • license-file
  • requires-dist
  • requires-python
  • summary
license MIT
license_file
  • LICENSE
requires_dist
  • cymem<2.1.0,>=2.0.2
  • murmurhash<1.1.0,>=0.28.0
requires_python >=3.9,<3.15
File Tox results History
preshed-3.0.13+ppc64le1-cp310-cp310-manylinux_2_31_ppc64le.whl
Size
817 KB
Type
Python Wheel
Python
3.10
preshed-3.0.13+ppc64le1-cp311-cp311-manylinux_2_31_ppc64le.whl
Size
862 KB
Type
Python Wheel
Python
3.11
preshed-3.0.13+ppc64le1-cp312-cp312-manylinux_2_31_ppc64le.whl
Size
886 KB
Type
Python Wheel
Python
3.12
preshed-3.0.13+ppc64le1-cp313-cp313-manylinux_2_31_ppc64le.whl
Size
861 KB
Type
Python Wheel
Python
3.13
preshed-3.0.13+ppc64le1-cp314-cp314-manylinux_2_31_ppc64le.whl
Size
864 KB
Type
Python Wheel
Python
3.14

preshed: Cython Hash Table for Pre-Hashed Keys

Simple but high performance Cython hash table mapping pre-randomized keys to void* values. Inspired by Jeff Preshing.

All Python APIs provded by the BloomFilter and PreshMap classes are thread-safe on both the GIL-enabled build and the free-threaded build of Python 3.14 and newer. If you use the C API or the PreshCounter class, you must provide external synchronization if you use the data structures by this library in a multithreaded environment.

tests pypi Version conda Version Python wheels

Installation

pip install preshed --only-binary preshed

Or with conda:

conda install -c conda-forge preshed

Usage

PreshMap

A hash map for pre-hashed keys, mapping uint64 to uint64 values.

from preshed.maps import PreshMap

map = PreshMap()                  # create with default size
map = PreshMap(initial_size=1024) # create with initial capacity (must be power of 2)

map[key] = value        # set a value
value = map[key]        # get a value (returns None if missing)
value = map.pop(key)    # remove and return a value
del map[key]            # delete a key
key in map              # membership test
len(map)                # number of entries

for key in map:                    # iterate over keys
    pass
for key, value in map.items():     # iterate over key-value pairs
    pass
for value in map.values():         # iterate over values
    pass

BloomFilter

A probabilistic set for fast membership testing of integer keys.

from preshed.bloom import BloomFilter

bloom = BloomFilter(size=1024, hash_funcs=23)  # explicit parameters
bloom = BloomFilter.from_error_rate(10000, error_rate=1e-4)  # auto-sized

bloom.add(42)          # add a key
42 in bloom            # membership test (may have false positives)

data = bloom.to_bytes()            # serialize
bloom.from_bytes(data)             # deserialize in-place

PreshCounter

A counter backed by a hash map, for counting occurrences of uint64 keys.

from preshed.counter import PreshCounter

counter = PreshCounter()

counter.inc(key, 1)       # increment key by 1
count = counter[key]      # get current count
len(counter)              # number of buckets

for key, count in counter: # iterate over entries
    pass

counter.smooth()           # apply Good-Turing smoothing
prob = counter.prob(key)   # get smoothed probability

Cython API

All classes expose a C-level API via .pxd files for use in Cython extensions. The low-level MapStruct and BloomStruct functions operate on raw structs and can be called without the GIL:

from preshed.maps cimport PreshMap, map_get, map_set, map_iter, key_t
from preshed.bloom cimport BloomFilter, bloom_add, bloom_contains

cdef PreshMap table = PreshMap()

# Low-level nogil access (requires external synchronization)
cdef void* value
with nogil:
    value = map_get(table.c_map, some_key)

Export Classification Notice

The software hosted on this website consists of publicly available open‑source packages. To the extent U.S. export regulations apply, software that is publicly available as described in 15 C.F.R. §§ 734.7 (for non-encryption software) or 742.15(b) (for encryption software) is not subject to the Export Administration Regulations (EAR). Users are responsible for complying with all applicable export laws and regulations.