Skip to main content

A dictionary-like object that is friendly with multiprocessing and uses key-value databases (e.g., RocksDB) as the underlying storage.

Project description

hugedict PyPI Documentation

hugedict provides a drop-in replacement for dictionary objects that are too big to fit in memory. hugedict's dictionary-like objects implement typing.Mapping and typing.MutableMapping interfaces using key-value databases (e.g., RocksDB) as the underlying storage. Moreover, they are friendly with Python's multiprocessing.

Installation

From PyPI (using pre-built binaries):

pip install hugedict

To compile the source, run: maturin build -r inside the project directory. You need Rust, Maturin, CMake and CLang (to build Rust-RocksDB).

Features

  1. Create a mutable mapping backed by RocksDB
from functools import partial
from hugedict.prelude import RocksDBDict, RocksDBOptions

# replace [str, str] for the types of keys and values you want
# as well as deser_key, deser_value, ser_value
mapping: MutableMapping[str, str] = RocksDBDict(
    path=dbpath,  # path (str) to db file
    options=RocksDBOptions(create_if_missing=create_if_missing),  # whether to create database if missing, check other options
    deser_key=partial(str, encoding="utf-8"),  # decode the key from memoryview
    deser_value=partial(str, encoding="utf-8"),  # decode the value from memoryview
    ser_value=str.encode,  # encode the value to bytes
    readonly=False,  # open database in read only mode
    secondary_mode=False,  # open database in secondary mode
    secondary_path=None,  # when secondary_mode is True, it's a string pointing to a directory for storing data required to operate in secondary mode
)
  1. Load huge data from files into RocksDB in parallel: from hugedict.prelude import rocksdb_load. This function creates SST files in parallel, ingests into the db and (optionally) compacts them.

  2. Cache a function when doing parallel processing

from hugedict.prelude import Parallel

pp = Parallel()

@pp.cache_func("/tmp/test.db")
def heavy_computing(seconds: float):
    time.sleep(seconds)
    return seconds * 2


output = pp.map(heavy_computing, [0.5, 1, 0.7, 0.3, 0.6], n_processes=3)
  1. Create dictionary backed by Sqlite: hugedict.sqlite.SqliteDict
  2. Chain multiple dictionaries: hugedict.chained_mapping.ChainedMapping
  3. Cache a dictionary so previously accessed keys are stored in memory: hugedict.cachedict.CacheDict or called hugedict.types.HugeMapping.cache

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hugedict-2.14.2.tar.gz (15.4 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hugedict-2.14.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

hugedict-2.14.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp313-cp313-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp313-cp313-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.13macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

hugedict-2.14.2-cp312-cp312-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp312-cp312-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.12macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

hugedict-2.14.2-cp311-cp311-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp311-cp311-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.11macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

hugedict-2.14.2-cp310-cp310-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp310-cp310-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.10macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

hugedict-2.14.2-cp39-cp39-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp39-cp39-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.9macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

hugedict-2.14.2-cp38-cp38-win_amd64.whl (3.3 MB view details)

Uploaded CPython 3.8Windows x86-64

hugedict-2.14.2-cp38-cp38-manylinux_2_35_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.35+ x86-64

hugedict-2.14.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

hugedict-2.14.2-cp38-cp38-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl (8.0 MB view details)

Uploaded CPython 3.8macOS 10.14+ universal2 (ARM64, x86-64)macOS 10.14+ x86-64macOS 11.0+ ARM64

File details

Details for the file hugedict-2.14.2.tar.gz.

File metadata

  • Download URL: hugedict-2.14.2.tar.gz
  • Upload date:
  • Size: 15.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hugedict-2.14.2.tar.gz
Algorithm Hash digest
SHA256 5791aa33a2d0328422309b3002869fbe90dcb666651547cefafed5f64c36a44f
MD5 692c86b78683f073b823c85de634e54d
BLAKE2b-256 6529f52ffc0914aa54ecee1565f15c3830e59771bf8a12592ab12cfc9264eddc

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f61c916c3f59bb9edeed89f356e5580dac064cc8b607569e1ff142ffb6c2e3d1
MD5 096e58bc8ad1fb1356f13c5048f9f0f6
BLAKE2b-256 2e2ede7efad55ba96a231e0706a76c006b4186475df311751fde6fa740094b61

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ed0a5b6cf9f4401f1bedd626b43706a87d461a837b41b70779345822432116e
MD5 d63a6b6b08e8ddfe18503b64743754b6
BLAKE2b-256 0f77787c9b34f95af18428e6f6ddb39b47ccfc6b254e68258c8ee6f4228e1245

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f441bd8737bcc4f904acacf54adf0a969179da0f9f82b4335684326b906d765c
MD5 ae5c39348677cdafcb01c9200fabd906
BLAKE2b-256 988a1628c63c5b7c3857bbede9d2b7509a6d64c4da4be91e0d589e03c60eb2c0

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 dd23eaa42f7127ac19093597fec70c1341cc742a1e5900853ffeb2a4af614e96
MD5 774efdd4156bbb38392c8335c2a4e006
BLAKE2b-256 08e2dad8b3abe647781d06f6a64d4c40062bc5b1f5af76134873f3d2fb3ed52a

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp313-cp313-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp313-cp313-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 a9c32daeff191555c06041a24fcfbaee3bcecce4ec78fc2fac0a1a38ec74728d
MD5 7fb78dbfbd7c20a5ff5b2ee989013d8e
BLAKE2b-256 8d9cbf5fcb18ae2165f4b95d45c2b6d47cc11295170dfc605b6e95f27979a5d2

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bc72f32def0dc742974ef3d9c6d54944669e74c0aceb00adadb58588e64f281d
MD5 1ed6a3754d6edadc7a5e4fa449f449b4
BLAKE2b-256 b2fac3e82c23dc4d097db6f588b9980bfb6cc8890b14efecbae7ba376003617a

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 832416072d9ce61c729b6803fa51a55b0f6b21a7f461b9a95839dc597d606194
MD5 5e6fcd9bfc679cc280079006ba9fa59b
BLAKE2b-256 301d599e29de8b87d8dc9ab46cdd89a33f1066635a5b8690190f815a477ba87b

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp312-cp312-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp312-cp312-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 6541d6077827acc9b76f5d0ef5148eddb70ef5cc2477774fdd231d0c8cec78e1
MD5 00faa810b57a73ed73847976c032a742
BLAKE2b-256 806a4d4bda92b355321f2ae3ff984c67f5b5936ef6bca2873c4af6ca09e70339

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 92211a095d536c63667dbf7caef3c8a3c79595d639ce8193a63baea64e306d9a
MD5 c8df160803457759cf66132733cf56dc
BLAKE2b-256 6212396a36a0f285b9cbd21ab6e2a4b167166f193d589bd5fce21477cba7cc89

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd966493747d01a2ef47b8e25cc8afc0c4daab02639a52f03bb9b906129e0223
MD5 7c0d8194be16a69564cce0a50465b80e
BLAKE2b-256 ece49ccd6fda2ba0e865f86fe14555024810685b947fc7fec6d40653acb34871

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp311-cp311-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp311-cp311-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 f11414b34d8fa79ecf6989e44de44ba82ba2da85917fadd1ec3e74e93220c9a6
MD5 78d8593702e69e7b9a67ab7794884e8d
BLAKE2b-256 5bf92d1752824402d148ee017b96d54695c6e82f6d827c1168af8de56b50b788

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 25de06053e5d92dc8fe61f556a8b645845eae2831895268706b13826cc454706
MD5 848ccb14cd8a3c9ac41c2f0b7b55374d
BLAKE2b-256 8b606d1a6d44eabdf6d5d100c9777985e84f65b005e83501b360bd1aae7c9d50

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d7d414ba27246035380d252fffcf1f781fc5ce915abe0a4ec308c29e73b2bf90
MD5 1df9c53247620b89038d897444a1fb8f
BLAKE2b-256 437ed3fee04bc0a42edeff9b9867ac00fd59bc97780b54faf773d8183411a027

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp310-cp310-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp310-cp310-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 090f8eaff7533ebec2c9daf9541528c95e4b567ccfa163574169d9d9f2bc142b
MD5 d65c4aa0436a5e2efd05227052381f79
BLAKE2b-256 c6bdcc826012f755e127213b475f811df5f62a4120111961fdf9ea8d801348a7

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 7df1cc53064981cc5495a0659cc19ebb5cd8d21716e867a87efbda71d1d71d2c
MD5 1769cfd869f1fd7f3dc37091269090d2
BLAKE2b-256 16031c342cdb9b39c1553a1db0575b403cfc1ee095b1519e935b4064206c6c35

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4db8feccd02f6e9ff5591ae33e1d868b7b448032f900b36c35fab593d093639e
MD5 f34fa76077acebc88ab237ceb3702d9d
BLAKE2b-256 d5562f737b2592b0dd5e43e19280b1d0525a0405725707b09be32dcedaf1a33d

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp39-cp39-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp39-cp39-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 da67e1c5815f851d4e7fca076e09e1fa9e20cbec1547fd24dbc052d7b976df85
MD5 cd6fd7195504d06ffa795e2eb54ff599
BLAKE2b-256 eecd439ee1517653a3b9c2cf409ae48ca74c864e36166645de83fbd3f7006ea5

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: hugedict-2.14.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for hugedict-2.14.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 7e195f15069ca41f3e02373ff60143ae1f21442af8c2cb7219a04b29f2f95f29
MD5 5318d90bd23d749b895b06f99cebbe34
BLAKE2b-256 76be935ec1f03ccbceedb8b69a822559d9c827296f4ee9f177b2211039d6d42d

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp38-cp38-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp38-cp38-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 19426bbbd64ac9693cea67eb163d1682af36eb103187985fe59077bd5c844f80
MD5 27f965d2bec2b874ea23877e8dd434c6
BLAKE2b-256 555a4ab80bcbf9e9f5a9ab589eb7fecab657133a29fb0d498692aa0b10429271

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a34b5f16d86903a99f0e8b211134429d51dcf789a9368b679adc07ea9c42b381
MD5 7f208fd7b99744f72f7c44eee7863088
BLAKE2b-256 c43d7887524c79ed57803ec2a4333213d005908bcac88222e930acedb0c39472

See more details on using hashes here.

File details

Details for the file hugedict-2.14.2-cp38-cp38-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl.

File metadata

File hashes

Hashes for hugedict-2.14.2-cp38-cp38-macosx_10_14_x86_64.macosx_11_0_arm64.macosx_10_14_universal2.whl
Algorithm Hash digest
SHA256 ce64e7b705806ee9b7787eea598a4e69c0ba9879427f9dacd22fc11ef111c20e
MD5 44b90dcaaab3a58bc1dc3a2dfe5df73d
BLAKE2b-256 4fb0f70c27bd82999b86d0604f1d53222ddef99086f15c8430a213330f6fc598

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page