{ "info": { "author": "Xinyu Zhou", "author_email": "zxytim@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# shmarray\n\n**NOTE**: If you are using Python 3.8, please turn to \n[multiprocessing.shared_memory](https://docs.python.org/3.8/library/multiprocessing.shared_memory.html#module-multiprocessing.shared_memory)\ninstead.\n\n-----\n\nshmarray is a shared numpy-array implementation utilizing\nmultiprocessing.sharedctypes. It is a quite useful small library created of\nDavid Baddeley. I found it at\nhttps://github.com/lucastheis/parallel/blob/master/shmarray.py\n\nDespite its usefulness, it not only does not come with a pip-installable\npackage, but also contains disrepaired bugs. \n\nThis repo is created as a remedy.\n\n# Installation\n```\npip install shmarray\n```\n\n# Usage\n\n`test.py`\n```python\nfrom multiprocessing import Process\nimport time\n\nimport shmarray\n\ndef worker(data):\n while True:\n data += 1\n time.sleep(1)\n\n\ndef monitor(data):\n while True:\n print(data)\n time.sleep(0.5)\n\ndata = shmarray.zeros(10)\n\nprocs = [\n Process(target=worker, args=(data, )),\n Process(target=monitor, args=(data, )),\n]\n\n\nfor p in procs:\n p.start()\n\nfor p in procs:\n p.join()\n```\n\nResult:\n```bash\n$ python3 test.py\n[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n[1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]\n[2. 2. 2. 2. 2. 2. 2. 2. 2. 2.]\n[2. 2. 2. 2. 2. 2. 2. 2. 2. 2.]\n[3. 3. 3. 3. 3. 3. 3. 3. 3. 3.]\n[3. 3. 3. 3. 3. 3. 3. 3. 3. 3.]\n[4. 4. 4. 4. 4. 4. 4. 4. 4. 4.]\n[4. 4. 4. 4. 4. 4. 4. 4. 4. 4.]\n[5. 5. 5. 5. 5. 5. 5. 5. 5. 5.]\n[5. 5. 5. 5. 5. 5. 5. 5. 5. 5.]\n[6. 6. 6. 6. 6. 6. 6. 6. 6. 6.]\n[6. 6. 6. 6. 6. 6. 6. 6. 6. 6.]\n...\n```\n\n# Under the hood\nThe code in `shmarray.py` is mostly the same as the original, I've only done a few things:\n1. fix a bug that did not pass `dtype` argument to downstream calls\n2. fix python version compatibility bugs\n3. reformat the code using [black](https://github.com/psf/black)\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zxytim/shmarray", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "shmarray", "package_url": "https://pypi.org/project/shmarray/", "platform": "", "project_url": "https://pypi.org/project/shmarray/", "project_urls": { "Homepage": "https://github.com/zxytim/shmarray" }, "release_url": "https://pypi.org/project/shmarray/0.0.3/", "requires_dist": [ "numpy" ], "requires_python": ">=3.5", "summary": "A polished shmarray, originated by David Baddeley", "version": "0.0.3" }, "last_serial": 5869524, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "2f7107e0de0ce5d8774fff88035686c1", "sha256": "0215ac135a209dcf99a32c5326048a91f7e3ba25b2b915a2fba0f4838bb0d4b9" }, "downloads": -1, "filename": "shmarray-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "2f7107e0de0ce5d8774fff88035686c1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5003, "upload_time": "2019-07-26T17:06:14", "url": "https://files.pythonhosted.org/packages/1b/7b/3e2f0aef9fb7ebcd6967279142862dd98cd82c5b78065c09af295e93a984/shmarray-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2c790bc9e8278cee1313087d71050ffe", "sha256": "8f15074bdd0cf653725a3709035e5c1f6fe55e08796b5cb10b5fc789d0a977eb" }, "downloads": -1, "filename": "shmarray-0.0.1.tar.gz", "has_sig": false, "md5_digest": "2c790bc9e8278cee1313087d71050ffe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3822, "upload_time": "2019-07-26T17:06:16", "url": "https://files.pythonhosted.org/packages/7d/94/3911d40d73643ea6f53d02b6067a990f7661a5f665f9919b31a395f396ce/shmarray-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e55f24fc328459554f9a196f5b3de11e", "sha256": "a5af77e04082bc0e666db9a45c9a44072227a2c952d5b2354060b672b754ad38" }, "downloads": -1, "filename": "shmarray-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "e55f24fc328459554f9a196f5b3de11e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5, <3.7", "size": 5264, "upload_time": "2019-07-26T17:21:07", "url": "https://files.pythonhosted.org/packages/fa/b4/08e6ec81cd389580862f3941c9374c88d9351d705ec4d47a09aa0004c1cc/shmarray-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7589a68ec134bc8e5cd0c0b3068ea47e", "sha256": "0a6f2b0a23285b77d6ebfcaf1341295e083009329ba1b56cbcaef955802a7149" }, "downloads": -1, "filename": "shmarray-0.0.2.tar.gz", "has_sig": false, "md5_digest": "7589a68ec134bc8e5cd0c0b3068ea47e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5, <3.7", "size": 4205, "upload_time": "2019-07-26T17:21:09", "url": "https://files.pythonhosted.org/packages/7f/d6/466df148c548ac0aefd153c259ee6a68751ba19f93192b4e93725493eb2f/shmarray-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "5ce0f191293396bce59b738a768698c3", "sha256": "17f22c295a44f76360437435efaa0828c158cad288c7268c51507fd4870f7919" }, "downloads": -1, "filename": "shmarray-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5ce0f191293396bce59b738a768698c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5296, "upload_time": "2019-09-22T16:01:43", "url": "https://files.pythonhosted.org/packages/66/2d/eccccb50515acaf2c0ae840dcc1776184fe6b1319b2c5c57535b99dd6c9d/shmarray-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e65fd66155557b3225db3306657e72b", "sha256": "a9810682d778a6cb051a0e3efa0076dab55c3d7dc1e3cfb7c0712cf36f19d093" }, "downloads": -1, "filename": "shmarray-0.0.3.tar.gz", "has_sig": false, "md5_digest": "0e65fd66155557b3225db3306657e72b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 4257, "upload_time": "2019-09-22T16:01:46", "url": "https://files.pythonhosted.org/packages/8f/3f/d1c9152723d257e374aa8471457b854c931230f7fee33bbc3797cfda70df/shmarray-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5ce0f191293396bce59b738a768698c3", "sha256": "17f22c295a44f76360437435efaa0828c158cad288c7268c51507fd4870f7919" }, "downloads": -1, "filename": "shmarray-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "5ce0f191293396bce59b738a768698c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 5296, "upload_time": "2019-09-22T16:01:43", "url": "https://files.pythonhosted.org/packages/66/2d/eccccb50515acaf2c0ae840dcc1776184fe6b1319b2c5c57535b99dd6c9d/shmarray-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0e65fd66155557b3225db3306657e72b", "sha256": "a9810682d778a6cb051a0e3efa0076dab55c3d7dc1e3cfb7c0712cf36f19d093" }, "downloads": -1, "filename": "shmarray-0.0.3.tar.gz", "has_sig": false, "md5_digest": "0e65fd66155557b3225db3306657e72b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 4257, "upload_time": "2019-09-22T16:01:46", "url": "https://files.pythonhosted.org/packages/8f/3f/d1c9152723d257e374aa8471457b854c931230f7fee33bbc3797cfda70df/shmarray-0.0.3.tar.gz" } ] }