{ "info": { "author": "Yu Yang", "author_email": "yyangplus@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "# pyshm - Python share memory library\n[![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://opensource.org/licenses/BSD-2-Clause)\n[![Build Status](https://travis-ci.org/yuyang0/pyshm.svg?branch=master)](https://travis-ci.org/yuyang0/pyshm)\n\npyshm is a python library that used to pass memory block between multiple processes.\nit exports three modules:\n\n1. shm: mainly used to create share memory between multiple process(using `mmap`)\n2. mempool: A memory pool is an allocator of fixed-size memory blocks. In python\n memory block is represented as a buffer-like object.\n3. ring: lockless FIFO queue in share memory. user can use `Ring` to manage the\n memory blocks allocated from Mempool\n\n## installation and usage\n\nyou can install pyshm using setuptools or pip:\n\n pip install pyshm\n\nor:\n\n python setup.py install\n\n## usage\n\n1. create share memory\n\n from pyshm import ShareMem\n\n test_shm = ShareMem(64*1024*1024) # 64M\n\npls note: these code should execute before `fork`\n\n2. using mempool\n\n from pyshm import mempool\n count = 4\n mp = mempool.Mempool(count, 4, shm=test_shm)\n\n pid = os.fork()\n if pid == 0:\n for i in range(count):\n buf = mp.get()\n struct.pack_into(\"=i\", buf, 0, i)\n mp.put(buf)\n else:\n cid, status = os.wait()\n assert pid == cid\n for i in range(count):\n buf = mp.get()\n v, = struct.unpack_from(\"=i\", buf)\n assert v == i\n mp.cleanup()\n\n`get` used to get memory block(a buffer-like object), `put` returns the memory block to the mempool\n\n3. using ring\n\nring can used to pass the memory block(get from mempool) to the other process.\nit proviod `enqueue` and `dequeue`, one process enequeue and the other process `dequeue`", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yuyang0/pyshm", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "pyshm", "package_url": "https://pypi.org/project/pyshm/", "platform": "", "project_url": "https://pypi.org/project/pyshm/", "project_urls": { "Homepage": "https://github.com/yuyang0/pyshm" }, "release_url": "https://pypi.org/project/pyshm/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "python share memory library", "version": "0.0.1" }, "last_serial": 3209579, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4c73ed9aa20a9a6504c6838f94e7f7f4", "sha256": "9f19a55f4783e1c8b51cf3002515d17ef23fd1e059a8117fcbe414c229f2360a" }, "downloads": -1, "filename": "pyshm-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4c73ed9aa20a9a6504c6838f94e7f7f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18235, "upload_time": "2017-09-28T09:46:12", "url": "https://files.pythonhosted.org/packages/2a/73/d95c8bd6181669b12262b099189e824d1fc3b454957795a0d0d53af95754/pyshm-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4c73ed9aa20a9a6504c6838f94e7f7f4", "sha256": "9f19a55f4783e1c8b51cf3002515d17ef23fd1e059a8117fcbe414c229f2360a" }, "downloads": -1, "filename": "pyshm-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4c73ed9aa20a9a6504c6838f94e7f7f4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18235, "upload_time": "2017-09-28T09:46:12", "url": "https://files.pythonhosted.org/packages/2a/73/d95c8bd6181669b12262b099189e824d1fc3b454957795a0d0d53af95754/pyshm-0.0.1.tar.gz" } ] }