{ "info": { "author": "Alec Nikolas Reiter", "author_email": "alecreiter@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# marshmallow-enum\n\nEnum field for use with Marshmallow.\n\n## Installation\n\n```bash\npip install --user marshmallow_enum\n```\n\nIf you're on a version before 3.4, you'll also need to install `enum34`.\n\n## Using The Field\n\nTo make use of the field, you must have an existing Enum:\n\n```python\nfrom enum import Enum\n\n\nclass StopLight(Enum):\n green = 1\n yellow = 2\n red = 3\n```\n\nThen, declare it as a field in a schema:\n\n```python\nfrom marshmallow import Schema\nfrom marshmallow_enum import EnumField\n\n\nclass TrafficStop(Schema):\n light_color = EnumField(StopLight)\n```\n\nBy default, the field will load and dump based on the _name_ given to an enum value.\n\n```python\nschema = TrafficStop()\nschema.dump({'light_color': EnumField.red}).data\n# {'light_color': 'red'}\n\nschema.load({'light_color': 'red'}).data\n# {'light_color': StopLight.red}\n```\n\n### Customizing loading and dumping behavior\n\nTo customize how an enum is serialized or deserialized, there are three options:\n\n- Setting `by_value=True`. This will cause both dumping and loading to use the value of the enum.\n- Setting `load_by=EnumField.VALUE`. This will cause loading to use the value of the enum.\n- Setting `dump_by=EnumField.VALUE`. This will cause dumping to use the value of the enum.\n\nIf either `load_by` or `dump_by` are unset, they will follow from `by_value`.\n\nAdditionally, there is `EnumField.NAME` to be explicit about the load and dump behavior, this\nis the same as leaving both `by_value` and either `load_by` and/or `dump_by` unset.\n\n### Custom Error Message\n\nA custom error message can be provided via the `error` keyword argument. It can accept three\nformat values:\n\n- `{input}`: The value provided to the schema field\n- `{names}`: The names of the individual enum members\n- `{values}`: The values of the individual enum members\n\nPreviously, the following inputs were also available but are deprecated and will be removed in 1.6:\n\n- `{name}`\n- `{value}`\n- `{choices}`\n\n\nVersion 1.5\n===========\n\nAllow unicode enum values (sergeyzsg)\nAdd support for Marshmallow 3 (svidela)\n\nVersion 1.4\n===========\n\n* Deprecate the `{choices}`, `{name}` and `{value}` format keys for custom error messages\n* Allow configure loading and dumping independently\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": "", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "marshmallow-enum", "package_url": "https://pypi.org/project/marshmallow-enum/", "platform": "", "project_url": "https://pypi.org/project/marshmallow-enum/", "project_urls": null, "release_url": "https://pypi.org/project/marshmallow-enum/1.5.1/", "requires_dist": [ "marshmallow (>=2.0.0)" ], "requires_python": "", "summary": "Enum field for Marshmallow", "version": "1.5.1" }, "last_serial": 5706474, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "e59844ff1b6c6f83cccb9e7c9b11ad1b", "sha256": "4a7ac2f1723cd733393fd44ff1952cbcb3be505cfe53ba93e2517e05967a4dbf" }, "downloads": -1, "filename": "marshmallow-enum-1.0.tar.gz", "has_sig": false, "md5_digest": "e59844ff1b6c6f83cccb9e7c9b11ad1b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1744, "upload_time": "2016-05-04T02:27:02", "url": "https://files.pythonhosted.org/packages/38/3a/da46ea5a75194e1c04cc01d47622894fea4f58743e472a1834046b2a26bb/marshmallow-enum-1.0.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "9c2f6454af357cd75a8273cc53c7fc5f", "sha256": "515e61e3d76bba4f9f3f440ff59f2a6a47be8a9cfd3b8d3cce827929cdf3ab2a" }, "downloads": -1, "filename": "marshmallow_enum-1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "9c2f6454af357cd75a8273cc53c7fc5f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2596, "upload_time": "2017-05-20T16:21:12", "url": "https://files.pythonhosted.org/packages/1e/6e/213b502c649a6f1b0c0f6fcaf39bb6252a5091a6f3c64c2139119c5cd35d/marshmallow_enum-1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e7d9b54a9a3f866d5caf3f328798878c", "sha256": "e55c77e5f4e830f6ad28dd8a716d9b047d1dc162acdf24c4a57c0a01457f2ccf" }, "downloads": -1, "filename": "marshmallow-enum-1.2.tar.gz", "has_sig": false, "md5_digest": "e7d9b54a9a3f866d5caf3f328798878c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1440, "upload_time": "2017-05-20T16:21:14", "url": "https://files.pythonhosted.org/packages/43/32/8239168a7f6a36e83492d3056f94f3841a761f46922ca545d9c78fe2a93f/marshmallow-enum-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "a4b71d792bce5ec25e1fc0d9719eae5e", "sha256": "b6abb96c36703192412f86c0a70a1130d6d03f0db24d643000d68b7f1eb385be" }, "downloads": -1, "filename": "marshmallow_enum-1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a4b71d792bce5ec25e1fc0d9719eae5e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2692, "upload_time": "2017-07-30T01:18:12", "url": "https://files.pythonhosted.org/packages/3b/fe/871319c944706e41aa15aea35419cdefffb9c7bbdc650b5616d06082ce11/marshmallow_enum-1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "189de1a5c23e5ccec2af0d6c76ca9d2a", "sha256": "f678632bd283a604388b689e0336a0e113b301dd33d82ccbf0facfd10c14b3dd" }, "downloads": -1, "filename": "marshmallow-enum-1.3.tar.gz", "has_sig": false, "md5_digest": "189de1a5c23e5ccec2af0d6c76ca9d2a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1525, "upload_time": "2017-07-30T01:18:01", "url": "https://files.pythonhosted.org/packages/3e/88/5c6b449d247b5a2c89a6b4dfd172c273ec7b4a7fa963698ab9ab52c558a2/marshmallow-enum-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "7d4889e9a3c0cdc4fc5102cc2b558065", "sha256": "82de7d525abb7b37d5a1f902604d89bbe33e9a237198827ca8d2c9a3b9bb9f9e" }, "downloads": -1, "filename": "marshmallow_enum-1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7d4889e9a3c0cdc4fc5102cc2b558065", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4807, "upload_time": "2017-08-21T03:20:32", "url": "https://files.pythonhosted.org/packages/3d/bf/578363459f82c7767bf89c4c6cf9cf37962f03b98dcbc49be6544df87bc2/marshmallow_enum-1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8f49b0a02413170aefd035b523ffe9fa", "sha256": "68bf64631b44979c7e25dcf8a335f3dda021583e2ea225c6624f62df29a61e38" }, "downloads": -1, "filename": "marshmallow-enum-1.4.tar.gz", "has_sig": false, "md5_digest": "8f49b0a02413170aefd035b523ffe9fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2849, "upload_time": "2017-08-21T03:20:33", "url": "https://files.pythonhosted.org/packages/e4/8b/da5b8b5fa745db7594dc0e86647395e01764b9732ca92940a8699bc91419/marshmallow-enum-1.4.tar.gz" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "2e5df1481c35933a9e7a0cc191013245", "sha256": "f5ad5dd187bbdca3165159db34e7b26f8a16e75e44aee5fc648ef18a2bd37b42" }, "downloads": -1, "filename": "marshmallow_enum-1.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2e5df1481c35933a9e7a0cc191013245", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4838, "upload_time": "2017-08-29T04:28:12", "url": "https://files.pythonhosted.org/packages/8b/c7/9e12f3947830d9d3c51747b6801767a33e5945596c1bcb9def2c2d365ae8/marshmallow_enum-1.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b5f7a56a85beb19038503ae3d71858cf", "sha256": "022400a2196ba55d5e6de67e6e4991e232190d25cbe26efa302c2e889e55ebf1" }, "downloads": -1, "filename": "marshmallow-enum-1.4.1.tar.gz", "has_sig": false, "md5_digest": "b5f7a56a85beb19038503ae3d71858cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3822, "upload_time": "2017-08-29T04:28:13", "url": "https://files.pythonhosted.org/packages/01/31/f65b2b7c17ab4468726090c2cd0f7cd675e8d1743a2a39a936890bb8d865/marshmallow-enum-1.4.1.tar.gz" } ], "1.5.1": [ { "comment_text": "", "digests": { "md5": "8d7f93cbd674015b878c199b82b96585", "sha256": "57161ab3dbfde4f57adeb12090f39592e992b9c86d206d02f6bd03ebec60f072" }, "downloads": -1, "filename": "marshmallow_enum-1.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d7f93cbd674015b878c199b82b96585", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4186, "upload_time": "2019-08-21T01:07:44", "url": "https://files.pythonhosted.org/packages/c6/59/ef3a3dc499be447098d4a89399beb869f813fee1b5a57d5d79dee2c1bf51/marshmallow_enum-1.5.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f4624f5b553c50895c33b5195108c10", "sha256": "38e697e11f45a8e64b4a1e664000897c659b60aa57bfa18d44e226a9920b6e58" }, "downloads": -1, "filename": "marshmallow-enum-1.5.1.tar.gz", "has_sig": false, "md5_digest": "7f4624f5b553c50895c33b5195108c10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4013, "upload_time": "2019-08-21T01:07:46", "url": "https://files.pythonhosted.org/packages/8e/8c/ceecdce57dfd37913143087fffd15f38562a94f0d22823e3c66eac0dca31/marshmallow-enum-1.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8d7f93cbd674015b878c199b82b96585", "sha256": "57161ab3dbfde4f57adeb12090f39592e992b9c86d206d02f6bd03ebec60f072" }, "downloads": -1, "filename": "marshmallow_enum-1.5.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8d7f93cbd674015b878c199b82b96585", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4186, "upload_time": "2019-08-21T01:07:44", "url": "https://files.pythonhosted.org/packages/c6/59/ef3a3dc499be447098d4a89399beb869f813fee1b5a57d5d79dee2c1bf51/marshmallow_enum-1.5.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7f4624f5b553c50895c33b5195108c10", "sha256": "38e697e11f45a8e64b4a1e664000897c659b60aa57bfa18d44e226a9920b6e58" }, "downloads": -1, "filename": "marshmallow-enum-1.5.1.tar.gz", "has_sig": false, "md5_digest": "7f4624f5b553c50895c33b5195108c10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4013, "upload_time": "2019-08-21T01:07:46", "url": "https://files.pythonhosted.org/packages/8e/8c/ceecdce57dfd37913143087fffd15f38562a94f0d22823e3c66eac0dca31/marshmallow-enum-1.5.1.tar.gz" } ] }