{ "info": { "author": "yedpodtrzitko", "author_email": "yedpodtrzitko@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# Mypy non-float Decimal plugin\n\nRestricts passing float numbers to Decimal\n\n## Why?\n\n[The implementation of floating point numbers](https://docs.python.org/3/tutorial/floatingpoint.html) \ncan cause imprecisions in results. To avoid this problem you can use `Decimal` type, \nhowever you still need to avoid passing `float` as its parameter:\n\n```\n>>> Decimal(1.02)\nDecimal(\"1.020000000000000017763568394002504646778106689453125\")\n>>> Decimal(\"1.02\")\nDecimal(\"1.02\")\n```\n\nThis plugin is meant to spot occurrences where `float` is passed to `Decimal` in your code.\n\n## Usage\n\n- install plugin\n\n```\npip install mypy-nonfloat-decimal\n```\n\n- add it into list of mypy plugins in your mypy config (`mypy.ini`)\n\n```\n[mypy]\nplugins=mypy_nonfloat_decimal\n```\n\n- upon running mypy will detect `float` passed to `Decimal` and report it as an error (`example.py`):\n\n\n```\nfrom decimal import Decimal\nDecimal(1.02)\n```\n\n```\n$ mypy --config-file ./mypy.ini ./example.py\n\nexample.py:2: error: Invalid type passed to Decimal (expected \"Union[int, str, Decimal]\"), got float instead\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": "mypy-nonfloat-decimal", "package_url": "https://pypi.org/project/mypy-nonfloat-decimal/", "platform": "", "project_url": "https://pypi.org/project/mypy-nonfloat-decimal/", "project_urls": null, "release_url": "https://pypi.org/project/mypy-nonfloat-decimal/0.1.2/", "requires_dist": [ "mypy (>=0.720)" ], "requires_python": ">=3.6,<4.0", "summary": "Mypy plugin to prevent passing float type to Decimal to avoid imprecisions.", "version": "0.1.2" }, "last_serial": 5987315, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "951c30d6ddd06a493d4ef99f3f6a92c0", "sha256": "2654bd8e4c60dadef626d737c07a6c829725417c65b6dd9fbd66a3d1dc105a91" }, "downloads": -1, "filename": "mypy_nonfloat_decimal-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "951c30d6ddd06a493d4ef99f3f6a92c0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 2784, "upload_time": "2019-10-14T07:00:29", "url": "https://files.pythonhosted.org/packages/df/fb/b07f40455fdd9703a1607f7acfc2a967c186537e5bdfe065bd6ecc00a695/mypy_nonfloat_decimal-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "560566e73ccf9f20ddb6615777b1dbc9", "sha256": "306168795c0cd312ee0ad692831598a5d873704764e129947f03f334f804df11" }, "downloads": -1, "filename": "mypy-nonfloat-decimal-0.1.1.tar.gz", "has_sig": false, "md5_digest": "560566e73ccf9f20ddb6615777b1dbc9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 2436, "upload_time": "2019-10-14T06:55:51", "url": "https://files.pythonhosted.org/packages/a6/c2/d9b6bb46b4d8b9e4c951e11eeed387a09560108faf468ba18980168c4063/mypy-nonfloat-decimal-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "25f8e671e65e6e1d78cc96027b906b9d", "sha256": "0732d157fdfd380039d41b946e652a0fcc55960f48f7fb0f1021ed33d726092a" }, "downloads": -1, "filename": "mypy_nonfloat_decimal-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "25f8e671e65e6e1d78cc96027b906b9d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 2785, "upload_time": "2019-10-14T07:02:38", "url": "https://files.pythonhosted.org/packages/04/2d/2bea6e714e34d603d99d5d069f93ab1e8c5fa225a64b1808a9f8aec75b20/mypy_nonfloat_decimal-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fe289b27226051eecaf3e91539c5c797", "sha256": "b03d01032bca542c2408a3c50aa1ed8e8502a4048810519cb3e05bd9e9d89db2" }, "downloads": -1, "filename": "mypy-nonfloat-decimal-0.1.2.tar.gz", "has_sig": false, "md5_digest": "fe289b27226051eecaf3e91539c5c797", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 2437, "upload_time": "2019-10-14T07:02:36", "url": "https://files.pythonhosted.org/packages/30/a1/b01678d30da470edec1c756059301b2378dbcf1c8d7eb6ac0f1aca096181/mypy-nonfloat-decimal-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "25f8e671e65e6e1d78cc96027b906b9d", "sha256": "0732d157fdfd380039d41b946e652a0fcc55960f48f7fb0f1021ed33d726092a" }, "downloads": -1, "filename": "mypy_nonfloat_decimal-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "25f8e671e65e6e1d78cc96027b906b9d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 2785, "upload_time": "2019-10-14T07:02:38", "url": "https://files.pythonhosted.org/packages/04/2d/2bea6e714e34d603d99d5d069f93ab1e8c5fa225a64b1808a9f8aec75b20/mypy_nonfloat_decimal-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fe289b27226051eecaf3e91539c5c797", "sha256": "b03d01032bca542c2408a3c50aa1ed8e8502a4048810519cb3e05bd9e9d89db2" }, "downloads": -1, "filename": "mypy-nonfloat-decimal-0.1.2.tar.gz", "has_sig": false, "md5_digest": "fe289b27226051eecaf3e91539c5c797", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 2437, "upload_time": "2019-10-14T07:02:36", "url": "https://files.pythonhosted.org/packages/30/a1/b01678d30da470edec1c756059301b2378dbcf1c8d7eb6ac0f1aca096181/mypy-nonfloat-decimal-0.1.2.tar.gz" } ] }