Skip to main content

Provide shared memory data structures!

Project description

Shared Memory Data Structure

This package allows you to use your data structures like numpy arrays in the shared memory environment between two or more python processes. This library simplifies the use of shared memory data structures as you don't need to manually manage shared memory.

SharedArray example:

Process #1

from shared_ds import SharedArray

# Create shared memory and put you numpy array into that memory segment.
shared_np_array = SharedArray.from_array(np_array)

shm_descriptor = shared_np_array.to_json()

Process #2

from shared_ds import SharedArray

# Attaches to existing shared memory and reads numpy array representation.
shared_np_array = SharedArray.from_json(shm_descriptor)

shm_descriptor = shared_np_array.to_json()

io.BytesIO example:

Process #1

from shared_ds import SharedBytesIO
import io

# Create shared memory and put content of passed BytesIO into that memory segment.
data_to_store = io.BytesIO(b'data which we want to store')
shared_memory = SharedBytesIO.from_bytes_io(data_to_store)

shm_descriptor = shared_memory.to_json()

Process #2

from shared_ds import SharedBytesIO

# Attaches to existing shared memory and gets io.BytesIO content.
shared_memory = SharedBytesIO.from_json(shm_descriptor)

data = shared_memory.get_data()

Currently supported data structures:

  • Numpy Array
  • io.BytesIO

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

shared_ds-0.0.5.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

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

shared_ds-0.0.5-py2.py3-none-any.whl (4.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file shared_ds-0.0.5.tar.gz.

File metadata

  • Download URL: shared_ds-0.0.5.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for shared_ds-0.0.5.tar.gz
Algorithm Hash digest
SHA256 f2f5299f5c735fa532e2abadca9814c8bad1dc9e69952b5d00547b1c15eb43d7
MD5 15e245e4c263666daeb32677918c758f
BLAKE2b-256 af020a46381401e8d650540870e9596c13d1b22160af089f3c0098ccb48f5e34

See more details on using hashes here.

File details

Details for the file shared_ds-0.0.5-py2.py3-none-any.whl.

File metadata

  • Download URL: shared_ds-0.0.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for shared_ds-0.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4d6ce53b9a549933dea6f1ce5f2953fffe6f83d556d674dab165c1cfa6c1b708
MD5 1445bba9dc18fa0a4773a8463981aa65
BLAKE2b-256 cd0237ad4c209bde3f2e746fbfd04e157b72b03343f71d58e19d4d86e9618748

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