{ "info": { "author": "Robert Harder", "author_email": "rob@iharder.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: Public Domain", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "netmem\n======\n\n.. image:: https://img.shields.io/pypi/pyversions/netmem.svg\n :target: https://pypi.python.org/pypi/netmem\n :alt: Python versions supported\n\n.. image:: https://img.shields.io/pypi/v/netmem.svg\n :target: https://pypi.python.org/pypi/netmem\n :alt: current version on PyPI\n\n.. image:: https://img.shields.io/travis/rharder/netmem.svg?style=flat-square\n :target: https://travis-ci.org/rharder/netmem\n :alt: build status\n\nBasic memory synchronization across the network in Python.\n\nThis package has a network-synchronized dictionary that runs\non ``asyncio`` event loops. It supports binding to the\ndictionary similar to ``tk.Variable()`` and is also compatible\nwith ``tkinter`` and its event loops.\n\nInstallation\n------------\n\nThe easiest way is to just open your favorite terminal and type ::\n\n pip install netmem\n\nAlternatively you can clone this repo and install it with ::\n\n python setup.py install\n\nRequirements\n------------\n\n- The amazing aiohttp library\n- Python v3.5+\n\nThe basis for ``netmem`` is asynchronous IO and event loops, so I\napologize to Python v2.x users and for that matter, Python v3.4.\nAlthough Python v3.4 supports ``asyncio``, I really like\nthe ``async for`` and ``async with`` constructs introduced in v3.5,\nand I use them in a number of places. Since Python is already on\nv3.6 at the time of this writing, I do not feel too terribly bad\nleaving v3.4 behind.\n\nUsage\n-----\n\nHere is the smallest meaningful example I can come up with.\nRun it on two different computers on the same network. ::\n\n import tkinter as tk\n import netmem\n\n def main():\n print(\"Run this on two different computers.\")\n mem = netmem.NetworkMemory()\n mem.connect_on_new_thread(netmem.UdpConnector(local_addr=(\"225.0.0.1\", 9991)))\n\n tk1 = tk.Tk()\n lbl = tk.Label(tk1, text=\"Favorite operating system:\")\n lbl.pack()\n txt = tk.Entry(tk1, textvariable=mem.tk_var(\"fav_os\"))\n txt.pack()\n\n tk1.mainloop()\n\n\n if __name__ == \"__main__\":\n main()\n\nYou can bind a listener to the ``NetworkMemory`` object to be notified when \na value changes, such as when an update arrives over the network. The listener\nworks like the following code snippet. ::\n\n def memory_changed(netmem_dict, key, old_val, new_val)\n print(\"Update {}:{}\".format(key, new_val))\n\n def main():\n mem = netmem.NetworkMemory()\n mem.add_listener(memory_changed)\n mem[\"foo\"] = \"bar\"\n\nThe output from this would be the following ::\n\n Update foo:bar\n\nIncidentally the underlying ``BindableDict`` class is pretty handy on its own, \nwithout even the network synchronizing capabilities.\n\n\nData Structure\n--------------\n\n``NetworkMemory`` subclasses a Python dictionary, so you can access the\ndata within it as you do any dictionary object. Additionally you can\nbind listeners to NetworkMemory (because in fact it subclasses a\nbindable dictionary, which is something I borrowed from other code\nI wrote).\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/rharder/netmem/tarball/0.2.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rharder/netmem", "keywords": "network", "license": "Public Domain", "maintainer": "", "maintainer_email": "", "name": "netmem", "package_url": "https://pypi.org/project/netmem/", "platform": "", "project_url": "https://pypi.org/project/netmem/", "project_urls": { "Download": "https://github.com/rharder/netmem/tarball/0.2.4", "Homepage": "https://github.com/rharder/netmem" }, "release_url": "https://pypi.org/project/netmem/0.2.4/", "requires_dist": null, "requires_python": "", "summary": "A network-synchronized dictionary.", "version": "0.2.4" }, "last_serial": 2670257, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "52b44172139181e803dfa4eea5250c10", "sha256": "0633b0012bee89e197b592eb20cc83d16fed7eb4b999911a1c50326d726f9e3b" }, "downloads": -1, "filename": "netmem-0.1.0.zip", "has_sig": false, "md5_digest": "52b44172139181e803dfa4eea5250c10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12877, "upload_time": "2017-01-31T23:12:40", "url": "https://files.pythonhosted.org/packages/a5/58/55f31a322d0f3ce119b71229e6eec546d4e016a0fc8e3ca8a9fe27c057f7/netmem-0.1.0.zip" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "64a67f8d7dad420ac1cf107b293caa45", "sha256": "fdef2135944370356e5f6ab145a87baa939af8d55aff8e98bc2ae1412400f839" }, "downloads": -1, "filename": "netmem-0.1.1.zip", "has_sig": false, "md5_digest": "64a67f8d7dad420ac1cf107b293caa45", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14473, "upload_time": "2017-02-01T13:32:39", "url": "https://files.pythonhosted.org/packages/07/ad/2585f27c9d4eee0f7a364610f256981802f3a7a1dc10e1985f0ae2e94306/netmem-0.1.1.zip" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "0c8c8ac5322c503c6ea07b8d84481dee", "sha256": "d83a667d894d7971cd1216fd6b9626b3131dbfdc556f487dfba2a658e8b6aba7" }, "downloads": -1, "filename": "netmem-0.2.0.zip", "has_sig": false, "md5_digest": "0c8c8ac5322c503c6ea07b8d84481dee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16594, "upload_time": "2017-02-02T15:28:00", "url": "https://files.pythonhosted.org/packages/c7/8b/db5cab79037cfe972616f84b52281c4c5a51e9f6b662a4642d12a332fb00/netmem-0.2.0.zip" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "cec0ec4c5962d47588a4d75fef0e1442", "sha256": "a8fb37cab8fd1bb1be74dd7903e44e7255b1c75d4984f71edf498746cce81d28" }, "downloads": -1, "filename": "netmem-0.2.1.zip", "has_sig": false, "md5_digest": "cec0ec4c5962d47588a4d75fef0e1442", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16748, "upload_time": "2017-02-02T15:39:52", "url": "https://files.pythonhosted.org/packages/a3/c9/52ed63300c3e2c7bc537cd01950bccb31b5e13f1840b3ceae03694494cbc/netmem-0.2.1.zip" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "c8de186534002ebdb5ede51622db3692", "sha256": "0b03de601548b3cdf695eddb0a2934702a68612dece55d1879001d3bfb5d1b8c" }, "downloads": -1, "filename": "netmem-0.2.2.zip", "has_sig": false, "md5_digest": "c8de186534002ebdb5ede51622db3692", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16653, "upload_time": "2017-02-03T18:57:40", "url": "https://files.pythonhosted.org/packages/97/ea/83cbcf21c87f829492ca5c43e26ffef215b839356062f068ea7959fb9f1e/netmem-0.2.2.zip" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "e65fa0fad20109bb8ac0b2b580d994e3", "sha256": "d60325c5f44e3a9b1e939837100ce36273c7e124d649071f2ace1fa9ff9cb112" }, "downloads": -1, "filename": "netmem-0.2.3.zip", "has_sig": false, "md5_digest": "e65fa0fad20109bb8ac0b2b580d994e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20782, "upload_time": "2017-02-22T23:04:47", "url": "https://files.pythonhosted.org/packages/d2/14/f9fa8350047e5f7fd897c88012146f6dd2333eba1af7119726fd1e0b8a53/netmem-0.2.3.zip" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "597fa748fbb281fa15c5a2b4f1f00816", "sha256": "84eb2bd1f58f3e1fe52516d568f5847c358d06bd30029802ac082d170da01044" }, "downloads": -1, "filename": "netmem-0.2.4.tar.gz", "has_sig": false, "md5_digest": "597fa748fbb281fa15c5a2b4f1f00816", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13809, "upload_time": "2017-02-27T07:10:04", "url": "https://files.pythonhosted.org/packages/c9/ae/8fdaec238ecc275beca0b658611efda8100fb29100ad28ba11299a6841a6/netmem-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "597fa748fbb281fa15c5a2b4f1f00816", "sha256": "84eb2bd1f58f3e1fe52516d568f5847c358d06bd30029802ac082d170da01044" }, "downloads": -1, "filename": "netmem-0.2.4.tar.gz", "has_sig": false, "md5_digest": "597fa748fbb281fa15c5a2b4f1f00816", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13809, "upload_time": "2017-02-27T07:10:04", "url": "https://files.pythonhosted.org/packages/c9/ae/8fdaec238ecc275beca0b658611efda8100fb29100ad28ba11299a6841a6/netmem-0.2.4.tar.gz" } ] }