{ "info": { "author": "Dean Serenevy", "author_email": "dean@serenevy.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development" ], "description": "amethyst-core\n=============\n\nA sober python base library for python 2.7 or python 3. (`Full Documentation`_)\n\n.. _`Full Documentation`: https://python-amethyst-core.readthedocs.io/en/latest/index.html\n\n.. CAUTION:: EXPERIMENTAL CODE. The interface to this library is not yet\n stable. At this time, improvements will be made to the interface without\n regard to backward compatibility. Backward-incompatible changes will not\n necessarily be documented in the changelog, and changes may be added\n which eat your puppy.\n\n\nA Generic Serializable Object\n-----------------------------\n\nThe primary product of this module is a base python object class designed\nfor easy serialization. JSON serialization and de-serialization come for\nfree for attributes of (most of the) core python object types.\n\nA Basic Class:\n\n.. code:: python\n\n from amethyst.core import Object, Attr\n\n class MyObject(Object):\n foo = Attr(int)\n bar = Attr(isa=str).strip()\n\n myobj = MyObject(foo=\"23\")\n print(myobj.foo + 1) # => 24\n\n\nValidation / Coersion\n^^^^^^^^^^^^^^^^^^^^^\n\n.. code:: python\n\n class MyObject(Object):\n amethyst_verifyclass = False # don't check json for class name\n foo = Attr(int) # coerce to int\n bar = Attr(isa=str).strip() # ensure str then strip whitespace\n\n\nValidated\n\"\"\"\"\"\"\"\"\"\n\n* constructors\n\n .. code:: python\n\n myobj = MyObject({ \"foo\": \"23\", \"bar\": \"Hello \" })\n myobj = MyObject(foo=\"23\", bar=\"Hello \")\n print(isinstance(myobj.foo, int)) # True\n print(myobj.bar) # \"Hello\"\n\n* assignment\n\n .. code:: python\n\n myobj[\"foo\"] = \"23\" # Converts to int\n myobj[\"foo\"] = \"Not an int\" # Raises exception\n myobj.foo = \"23\" # Converts to int\n myobj.foo = \"Not an int\" # Raises exception\n\n* set and update methods\n\n .. code:: python\n\n myobj.set(\"foo\", value) # Convert to int or raise exception\n myobj.update(foo=value) # Convert to int or raise exception\n myobj.setdefault(\"foo\", value) # Convert or raise only if foo unset\n\n* loading fresh from dict or json\n\n .. code:: python\n\n # Converts and trims\n myobj.load_data({\"foo\": \"23\", \"bar\": \"Hello \"})\n\n # Converts and trims\n myobj = MyObject.newFromJSON('{\"foo\": \"23\", \"bar\": \"Hello \"}')\n myobj.fromJSON('{\"foo\": \"23\", \"bar\": \"Hello \"}')\n\n\nNot Validated\n\"\"\"\"\"\"\"\"\"\"\"\"\"\n\n .. code:: python\n\n myobj.direct_set(\"foo\", \"Not an int\") # DANGER: Not an exception!\n myobj.direct_update(foo=\"Not an int\") # DANGER: Not an exception!\n\n\nSerialization\n^^^^^^^^^^^^^\n\nJSON text can be produced and loaded, even for nested objects.\n\n.. code:: python\n\n json_string = myobj.toJSON()\n myobj2 = MyObject.newFromJSON(json_string)\n\nOther serialization libraries can easily be used as well.\n\n.. code:: python\n\n yaml_string = yaml.dump(myobj.deflate_data())\n myobj2 = MyObject.inflate_new(yaml.safe_load(yaml_string))\n\n\nBy default the JSON serializer injects type hints to ensure that objects\nare de-serialized into the correct class:\n\n.. code:: python\n\n # print(MyObject(foo=23, bar=\"plugh\").toJSON())\n {\"__class__\": \"__mymodule.MyObject__\", \"foo\": 23, \"bar\": \"plugh\"}\n\nWhen building an object from JSON, the constructor will look for these\nhints and raise a ValueError if the type hint is missing or imported into\nthe wrong class.\n\n.. code:: python\n\n # These raise ValueError\n MyObject.newFromJSON('{\"foo\":23, \"bar\":\"plugh\"}')\n MyObject.newFromJSON('{\"__class__\": \"__mymodule.MyOtherObject__\", \"foo\":23}')\n\nClass verification can be skipped by passing `verifyclass=False` to the loader.\n\n.. code:: python\n\n myobj = MyObject.newFromJSON('{\"foo\":23, \"bar\":\"plugh\"}', verifyclass=False)\n\n\nIf you want no munging or class verification at all, set the class parameters:\n\n.. code:: python\n\n class MyObject(Object):\n amethyst_includeclass = False\n amethyst_verifyclass = False\n\n foo = Attr(int)\n bar = Attr(isa=str).strip()\n\n # No extra class info due to modified defaults:\n myobj = MyObject.newFromJSON('{\"foo\":\"23\", \"bar\":\"plugh\"}')\n print(myobj.toJSON())\n # => { \"foo\": 23, \"bar\": \"plugh\" }\n\n\nEcosystem integration\n---------------------\n\nWorks with `sqlite3.Row` objects:\n\n.. code:: python\n\n import sqlite3\n conn = sqlite3.connect(myfile)\n conn.row_factory = sqlite3.Row\n for row in conn.execute('SELECT * FROM mytable')\n obj = MyObject(row)\n ...\n\nWorks with `six.iteritems()`:\n\n.. code:: python\n\n import six\n for k, v in six.iteritems(myobj):\n ...\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/duelafn/python-amethyst-core", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "amethyst-core", "package_url": "https://pypi.org/project/amethyst-core/", "platform": "", "project_url": "https://pypi.org/project/amethyst-core/", "project_urls": { "Homepage": "https://github.com/duelafn/python-amethyst-core" }, "release_url": "https://pypi.org/project/amethyst-core/0.8.5/", "requires_dist": null, "requires_python": "", "summary": "A sober python base library", "version": "0.8.5" }, "last_serial": 5812499, "releases": { "0.6.4": [ { "comment_text": "", "digests": { "md5": "92cce4af54357e7a3598219d772985a1", "sha256": "d03c3498ad0dd94cea28fa86b5606fcdabda95eec032eb1f3fc5ed85bab5e030" }, "downloads": -1, "filename": "amethyst_core-0.6.4-py2-none-any.whl", "has_sig": false, "md5_digest": "92cce4af54357e7a3598219d772985a1", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20795, "upload_time": "2019-03-22T14:39:41", "url": "https://files.pythonhosted.org/packages/2e/fe/3468412a6c544dceb7abb9520e5c5be107b3c26146703fcc820de31fc70a/amethyst_core-0.6.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b08778f4591982d244b12a25a2c9be94", "sha256": "299ccf9853ab08b0e5c7c7b87631557f65e79c840313496b440ddee109ee0123" }, "downloads": -1, "filename": "amethyst_core-0.6.4-py3-none-any.whl", "has_sig": false, "md5_digest": "b08778f4591982d244b12a25a2c9be94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20798, "upload_time": "2019-03-22T14:39:43", "url": "https://files.pythonhosted.org/packages/56/7d/e46e78e524d1532d68b3537c44ca81afca45cb3d8f8c94ecbe8199d242bf/amethyst_core-0.6.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8a9277d8223643380da2faf57a5c8612", "sha256": "d45ff1107ee6f4ad79e7c59e384153be37785cb0ed5369a6c88ec552fa5d11b8" }, "downloads": -1, "filename": "amethyst-core-0.6.4.tar.gz", "has_sig": false, "md5_digest": "8a9277d8223643380da2faf57a5c8612", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23863, "upload_time": "2019-03-22T14:39:45", "url": "https://files.pythonhosted.org/packages/ac/40/6661b39308095af1cf2ef71a5d3a23de30cf9e30c3a9966973a073eb8085/amethyst-core-0.6.4.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "db58d4df8cd3b61a2e6c6f600f8f958a", "sha256": "8d3201fc93d893e578894f30bb83ca6a79ada01f29140dacf763a0e84442f7ae" }, "downloads": -1, "filename": "amethyst_core-0.7.0-py2-none-any.whl", "has_sig": false, "md5_digest": "db58d4df8cd3b61a2e6c6f600f8f958a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20206, "upload_time": "2019-04-30T03:44:34", "url": "https://files.pythonhosted.org/packages/8c/dd/3fcc3b044eb1d110021846185aed7269e472966bd8f107c5af293f0efa58/amethyst_core-0.7.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb485bf02d515eef5edbf99fd383bafd", "sha256": "b3bb2528b16f43e50dad99fbac28396ff202dcdd9844300dc49764a2518e9800" }, "downloads": -1, "filename": "amethyst_core-0.7.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eb485bf02d515eef5edbf99fd383bafd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20207, "upload_time": "2019-04-30T03:44:38", "url": "https://files.pythonhosted.org/packages/5e/40/0abea90ff38fd61869205bfe0c299b1ce1737862de54422661894e47d457/amethyst_core-0.7.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b9d2477adf21765f730585d0d70092d", "sha256": "125387b01afed2a71e4ab13c02d29fcf2431e87a1b56fdc9f3be232ab05d9250" }, "downloads": -1, "filename": "amethyst-core-0.7.0.tar.gz", "has_sig": false, "md5_digest": "3b9d2477adf21765f730585d0d70092d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25453, "upload_time": "2019-04-30T03:44:42", "url": "https://files.pythonhosted.org/packages/e7/39/fb4e5e97e4e238ba7e1730b4f86ad002d19f500a5165ec156daef263a74a/amethyst-core-0.7.0.tar.gz" } ], "0.7.1": [ { "comment_text": "", "digests": { "md5": "5873ddc9b914c7602bed6176b5388945", "sha256": "16964fd655db9cd6e4a35841d074736fc12983acacf86a162a2e16c576e44cd0" }, "downloads": -1, "filename": "amethyst_core-0.7.1-py2-none-any.whl", "has_sig": false, "md5_digest": "5873ddc9b914c7602bed6176b5388945", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20576, "upload_time": "2019-05-20T13:15:04", "url": "https://files.pythonhosted.org/packages/e7/8c/7a9fa4baa3db83e94749e8031aaeae3baf3c1162677cc7023ea82e51eaed/amethyst_core-0.7.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c9de1e5c93c364d90b3127363f5a3304", "sha256": "fe91a6070bb62c2c37b201b49c06fe485dd2f23e5b280897a53d71dcd28dad6f" }, "downloads": -1, "filename": "amethyst_core-0.7.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c9de1e5c93c364d90b3127363f5a3304", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20578, "upload_time": "2019-05-20T13:15:06", "url": "https://files.pythonhosted.org/packages/f3/4b/62c05f0a9723147eea4669b56b94908d402f7678595a271a88d87b4f6b26/amethyst_core-0.7.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d44904f1967b36f464c9b3c8f7fea4de", "sha256": "b3bc2ecebcbcefd2972d7e17be037f2ec9af69e513ce2693872b47f94289b7ca" }, "downloads": -1, "filename": "amethyst-core-0.7.1.tar.gz", "has_sig": false, "md5_digest": "d44904f1967b36f464c9b3c8f7fea4de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26219, "upload_time": "2019-05-20T13:15:07", "url": "https://files.pythonhosted.org/packages/87/b6/229ede7f181a033c988f5b4555088a07565ddac5b7c21d95128efe69d7eb/amethyst-core-0.7.1.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "9d477c2ed5d06d5866c481dc857e678a", "sha256": "f4f87316a6d6f9ad0089a31b6887d4a216dbff99345272b0ca46182337ae0aa0" }, "downloads": -1, "filename": "amethyst_core-0.8.0-py2-none-any.whl", "has_sig": false, "md5_digest": "9d477c2ed5d06d5866c481dc857e678a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20574, "upload_time": "2019-06-07T17:14:18", "url": "https://files.pythonhosted.org/packages/90/61/8a5e1f069463d403220503ccc9e3cf2bbccb02f6906a34c56891dae04b9b/amethyst_core-0.8.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b603891586e902439d9b1e86b1ff99a9", "sha256": "eaf2961cb57b107059cf97035020d490d61bc86aab88bfaebc9eab07955d22a9" }, "downloads": -1, "filename": "amethyst_core-0.8.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b603891586e902439d9b1e86b1ff99a9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20578, "upload_time": "2019-06-07T17:14:19", "url": "https://files.pythonhosted.org/packages/f7/ec/df4ba0f03f02c427ffd1780ebd947928904ca059907901f251ad7ec49ec2/amethyst_core-0.8.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ba7cf7cb65315923ffe5587e6ed27873", "sha256": "c85b03039928cdbbc7370bd0a8a6ed853765e7894f854adbd9307fce7c3a47c7" }, "downloads": -1, "filename": "amethyst-core-0.8.0.tar.gz", "has_sig": false, "md5_digest": "ba7cf7cb65315923ffe5587e6ed27873", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26324, "upload_time": "2019-06-07T17:14:21", "url": "https://files.pythonhosted.org/packages/08/b3/c91d691486db75a75cdd233e2239fbd76b63414d9ac6157f0694cf5d0768/amethyst-core-0.8.0.tar.gz" } ], "0.8.5": [ { "comment_text": "", "digests": { "md5": "817da71aa344aaf30d7e1cc521e2de57", "sha256": "030914e8d704973e4d5491a4c47c86aa55ab166f2fdb3544fab0375a09398bd5" }, "downloads": -1, "filename": "amethyst_core-0.8.5-py2-none-any.whl", "has_sig": false, "md5_digest": "817da71aa344aaf30d7e1cc521e2de57", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 23384, "upload_time": "2019-09-11T03:02:57", "url": "https://files.pythonhosted.org/packages/d0/b0/f9c21de51a4331e9b67c331f59342c1da29fbbca402db45e1b4d1a525607/amethyst_core-0.8.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "30c987059c315692a2c8aee02bf5573a", "sha256": "d1f903f371c179884d65612ec28c02193ba3572ed5147178a72099b9b78dc60a" }, "downloads": -1, "filename": "amethyst_core-0.8.5-py3-none-any.whl", "has_sig": false, "md5_digest": "30c987059c315692a2c8aee02bf5573a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23386, "upload_time": "2019-09-11T03:02:58", "url": "https://files.pythonhosted.org/packages/95/bb/6fb554a487af1f0569d3c7d95cf064fa570e12d1ad47cd628afb55286eac/amethyst_core-0.8.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "59506535ec0f888ff96f524c0c4d37b5", "sha256": "76df09edf51db1ea9853526d5f2132936062e0df12364e2ed6614ad5de3bc984" }, "downloads": -1, "filename": "amethyst-core-0.8.5.tar.gz", "has_sig": false, "md5_digest": "59506535ec0f888ff96f524c0c4d37b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36033, "upload_time": "2019-09-11T03:03:00", "url": "https://files.pythonhosted.org/packages/4f/94/46ac192a89d686f696f5a17ac9557e9561a0cdc731b2c83085debe16d2c7/amethyst-core-0.8.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "817da71aa344aaf30d7e1cc521e2de57", "sha256": "030914e8d704973e4d5491a4c47c86aa55ab166f2fdb3544fab0375a09398bd5" }, "downloads": -1, "filename": "amethyst_core-0.8.5-py2-none-any.whl", "has_sig": false, "md5_digest": "817da71aa344aaf30d7e1cc521e2de57", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 23384, "upload_time": "2019-09-11T03:02:57", "url": "https://files.pythonhosted.org/packages/d0/b0/f9c21de51a4331e9b67c331f59342c1da29fbbca402db45e1b4d1a525607/amethyst_core-0.8.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "30c987059c315692a2c8aee02bf5573a", "sha256": "d1f903f371c179884d65612ec28c02193ba3572ed5147178a72099b9b78dc60a" }, "downloads": -1, "filename": "amethyst_core-0.8.5-py3-none-any.whl", "has_sig": false, "md5_digest": "30c987059c315692a2c8aee02bf5573a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23386, "upload_time": "2019-09-11T03:02:58", "url": "https://files.pythonhosted.org/packages/95/bb/6fb554a487af1f0569d3c7d95cf064fa570e12d1ad47cd628afb55286eac/amethyst_core-0.8.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "59506535ec0f888ff96f524c0c4d37b5", "sha256": "76df09edf51db1ea9853526d5f2132936062e0df12364e2ed6614ad5de3bc984" }, "downloads": -1, "filename": "amethyst-core-0.8.5.tar.gz", "has_sig": false, "md5_digest": "59506535ec0f888ff96f524c0c4d37b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36033, "upload_time": "2019-09-11T03:03:00", "url": "https://files.pythonhosted.org/packages/4f/94/46ac192a89d686f696f5a17ac9557e9561a0cdc731b2c83085debe16d2c7/amethyst-core-0.8.5.tar.gz" } ] }