Skip to main content

np-shared-array

Utility for sharing numpy arrays between processes. This can be useful if you have a background process performing a calculation and main process on an API which can query the array.

Usage:

from np_shared_array import create_shared_array, SharedNumpyArray
from multiprocessing import Process


def worker(shared_array: SharedNumpyArray):
    array = shared_array.to_numpy()
    with shared_array.lock:
        array[0][0] = 1


def main():
    shape = [10, 10]
    shared_array = create_shared_array(shape)
    array = shared_array.to_numpy()
    p = Process(
        target=worker,
        args=(shared_array,)
    )
    p.start()
    p.join()
    with shared_array.lock:
        print(array[0][0])


if __name__ == "__main__":
    main()

Metadata

Release files for np-shared-array 1.0.0

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

Source distribution (sdist)

Source distribution for np-shared-array 1.0.0
File Size Uploaded
np_shared_array-1.0.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for np-shared-array 1.0.0
File Interpreter ABI Platform
np_shared_array-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / np_shared_array-1.0.0.tar.gz

Download URL np_shared_array-1.0.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4b6e44eb2d14378425d9bcc39d17b5fcfd646132c24d677c6cc86bad1e288e1f
BLAKE2b-256 checksum
How to use checksums
0976c571217a6257dd3348f9d7f6eb00f0a7a961d93d253c9a72ab506ec66f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / np_shared_array-1.0.0-py3-none-any.whl

Download URL np_shared_array-1.0.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd4c89b6c260a21e2988602e6ec887dac6e528a2b2f95c6d9b71ad063848f81e
BLAKE2b-256 checksum
How to use checksums
77c8ab232d93dd788ba2b34b09f8b69db83d443d586caffcc4215e26bcd9fdb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.1

2 release files

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