Shared list / set / dict across processes / environments
Project description
Shared list / set / dict across processes / environments
pip install sharedbuiltinmutables
Tested against Windows 10 / Python 3.11 / Anaconda
FILE 1
from sharedbuiltinmutables import MemSharedDict, MemSharedList, MemSharedSet, cfg
# dill/pickle protocol
cfg.protocol = 5
d = MemSharedDict({3: 323}, name="d1", size=1024)
l = MemSharedList([3, 323], name="l1", size=1024)
s = MemSharedSet({3, 6, 5}, name="s1", size=1024)
d[111] = 444
d.pop(3)
d[9] = lambda h: h * 3
# to clean up: d.cleanup()
FILE 2
from sharedbuiltinmutables import MemSharedDict, MemSharedList, MemSharedSet, cfg
# dill/pickle protocol
cfg.protocol = 5
d = MemSharedDict(name="d1", size=1024)
# passing a value ( d = MemSharedDict({33:11,3:3} name="d1", size=1024) )
# won't do anything if
# the dict has already been created by another proc
#
# use instead:
# d = MemSharedDict(name="d1", size=1024)
# d.clear()
# d.update({33:11,3:3})
l = MemSharedList(name="l1", size=1024)
s = MemSharedSet(name="s1", size=1024)
# to clean up: d.cleanup()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for sharedbuiltinmutables-0.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d71a4a349edccd604b8c04fe62f07820083bf1b689615eb8e0fc857af37fd01 |
|
MD5 | a39ada9c95ca2b7336055aab4d4f6994 |
|
BLAKE2b-256 | dabc0b43e092dc74a1cdafdd447291ccad8015f26d392f2149a999008dab6faf |
Close
Hashes for sharedbuiltinmutables-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d0fee70a644d5b14a67797318f78216dec14581c2d8c15bad175f19a01cb6d |
|
MD5 | 45879012550f041853a2413c05bed100 |
|
BLAKE2b-256 | 855fa53f8cc6265cae52d6f7a18fc46929e049c30b4ae7452e471b868868eae9 |