{ "info": { "author": "Joe Black", "author_email": "me@joeblack.nyc", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "\nPricing\n=======\n\n\n.. image:: https://travis-ci.org/joeblackwaslike/pricing.svg?branch=master\n :target: https://travis-ci.org/joeblackwaslike/pricing\n :alt: Build Status\n\n.. image:: https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat\n :target: https://github.com/joeblackwaslike/pricing\n :alt: Github Repo\n\n.. image:: https://img.shields.io/pypi/v/pricing.svg\n :target: https://pypi.python.org/pypi/pricing\n :alt: Pypi Version\n\n.. image:: https://img.shields.io/pypi/l/pricing.svg\n :target: https://pypi.python.org/pypi/pricing\n :alt: Pypi License\n\n.. image:: https://img.shields.io/pypi/wheel/pricing.svg\n :target: https://pypi.python.org/pypi/pricing\n :alt: Pypi Wheel\n\n.. image:: https://img.shields.io/pypi/pyversions/pricing.svg\n :target: https://pypi.python.org/pypi/pricing\n :alt: Pypi Versions\n\n\nMaintainer\n----------\n\nJoe Black | me@joeblack.nyc | `github `_\n\nIntroduction\n------------\n\nPricing classes and tools with CLDR-backed locale-aware formatting and currency exchange. Easy to extend/customize since it's built on ZCA.\n\nDefine your custom currencies and exchange's in your project's ZCML and you're golden.\n\nInstallation\n------------\n\n.. code-block:: shell\n\n pip3 install pricing\n\nUsage\n-----\n\nBasic\n^^^^^\n\n.. code-block:: python\n\n >>> from pricing import Price\n ... Price('2.22', 'USD')\n EUR 2.22\n\n >>> Price('2.34223434', 'BTC')\n BTC 2.34223434\n\n >>> m = Price(2, 'USD')\n ... m.amount\n Decimal('2')\n ... m.currency\n 'USD'\n\n >>> m = Price('2.22', 'EUR')\n ... m / 2\n EUR 1.11\n >>> m + Price('7.77', 'EUR')\n EUR 9.99\n\nFormatting\n^^^^^^^^^^\n\n.. code-block:: python\n\n >>> m = Price('1234.567', 'EUR')\n ... str(m)\n 'EUR 1,234.57'\n\n >>> m.format()\n '\u20ac1,234.57'\n\nPayment URI's\n^^^^^^^^^^^^^\n\nCreate BIP21 and EIP681 compatible payment URI's.\n\n.. code-block:: python\n\n >>> from pricing.uris import BIP21PaymentURI\n ... BIP21PaymentURI(\n ... 'bitcoin',\n ... address='19kxPokCjD6tUU3sHaLZgEQBkRsCTBt3jj',\n ... amount='4.32345').to_uri()\n 'bitcoin:19kxPokCjD6tUU3sHaLZgEQBkRsCTBt3jj?amount=4.32345'\n\n.. code-block:: python\n\n >>> from pricing.uris import EIP681PaymentURI\n ... EIP681PaymentURI(\n ... 'ethereum',\n ... address='077a7506b69e37e4f6852577190f04a35df9a36c',\n ... value='4.32345').to_uri()\n 'ethereum:0x077a7506b69e37e4f6852577190f04a35df9a36c?value=4.32345'\n\nCurrency Exchange\n^^^^^^^^^^^^^^^^^\n\nCurrency exchange works by \"installing\" a **backend** class that implements the ``IExchangeBackend`` interface.\n\nXPrice\n^^^^^^\n\nYou can use ``money.XPrice`` (a subclass of Price), for automatic currency conversion while adding, subtracting, and dividing money objects (+, +=, -, -=, /, //). This is useful when aggregating lots of money objects with heterogeneous currencies. The currency of the leftmost object has priority.\n\n.. code-block:: python\n\n from pricing import XPrice\n\n # Register backend and rates as above...\n a = XPrice(1, 'AAA')\n b = XPrice(1, 'BBB')\n\n assert sum([a, b]) == XPrice('1.25', 'AAA')\n\nExtending and customization\n^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nYou can use ZCML to configure custom currencyFormats and exchanges, create a new file called ``currency.zcml``\\ , and follow the example below to configure.\n\n.. code-block:: xml\n\n \n\n \n\n \n \n \n \n\n \n \n\n \n\nThen include ``currency.zcml`` in your ``configure.zcml`` file:\n\n.. code-block:: xml\n\n \n\nFields\n^^^^^^\n\nIncluded are custom fields for ``zope.schema`` and ``attrs`` based classes. Checkout ``money.fields``.\n\nExceptions\n----------\n\n``PriceException(Exception)``\n Base class for all exceptions.\n\n``CurrencyMismatch(PriceException, ValueError)``\n Thrown when mixing different currencies, e.g. ``Price(2, 'EUR') + Price(2, 'USD')``. Price objects must be converted first to the same currency, or XPrice could be used for automatic conversion.\n\n``InvalidOperandType(PriceException, TypeError)``\n Thrown when attempting invalid operations, e.g. multiplication between money objects.\n\n``ExchangeError(PriceException)``\n Base class for exchange exceptions.\n\n``ExchangeBackendNotInstalled(ExchangeError)``\n Thrown if a conversion is attempted, but there is no backend available.\n\n``ExchangeRateNotFound(ExchangeError)``\n The installed backend failed to provide a suitable exchange rate between the origin and target currencies.\n\nHierarchy\n^^^^^^^^^\n\n\n* ``PriceException``\n\n * ``CurrencyMismatch``\n * ``InvalidOperandType``\n * ``ExchangeError``\n\n * ``ExchangeBackendNotInstalled``\n * ``ExchangeRateNotFound``\n\nChanges\n-------\n\n\n* `CHANGELOG `_\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/joeblackwaslike/pricing/tarball/v1.0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/joeblackwaslike/pricing", "keywords": "money,price,pricing,currency,cryptocurrency,bitcoin,exchange,rates,ranges,formats", "license": "MIT", "maintainer": "Joe Black", "maintainer_email": "me@joeblack.nyc", "name": "pricing", "package_url": "https://pypi.org/project/pricing/", "platform": "", "project_url": "https://pypi.org/project/pricing/", "project_urls": { "Download": "https://github.com/joeblackwaslike/pricing/tarball/v1.0.1", "Homepage": "https://github.com/joeblackwaslike/pricing" }, "release_url": "https://pypi.org/project/pricing/1.0.1/", "requires_dist": [ "zope.interface (>=4.5.0)", "zope.configuration (>=4.1.0)", "zope.component (>=4.4.1)", "requests (>=2.18.4)", "zulu (>=0.12.0)", "attrs (>=18.1.0)", "babel (>=2.5.3)", "boltons (>=18.0.0)" ], "requires_python": "", "summary": "Python Pricing Package", "version": "1.0.1" }, "last_serial": 3857749, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f029a85ad3c9a543c1d8cf05d178dfb4", "sha256": "f49f34d27a0ee299d868594a09efd3d107e7ba53d1f4b2c685026a260fa473cc" }, "downloads": -1, "filename": "pricing-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f029a85ad3c9a543c1d8cf05d178dfb4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 27375, "upload_time": "2018-05-13T00:23:35", "url": "https://files.pythonhosted.org/packages/6d/e1/f51b5ed04d3d23db122e2f2c4ddbbac66a53356084674a36a95901c462ee/pricing-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "83e18147613d04d51a21198c696a25ac", "sha256": "89af08a16e70aea785ee314d2305c20a0d0dbbbc1546da5e68943a295ecb4e16" }, "downloads": -1, "filename": "pricing-1.0.0.tar.gz", "has_sig": false, "md5_digest": "83e18147613d04d51a21198c696a25ac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22792, "upload_time": "2018-05-13T00:23:37", "url": "https://files.pythonhosted.org/packages/ff/55/a6b955ced6ddb068917e524ef9c13b878e27f697286b59dc5f69b5b6852c/pricing-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ebcdf109f65201964fcddecf211135e9", "sha256": "88f444ff0f1de678d1d7666459ffffcf456d8f1e9af9ab77cd9375ad1534e1eb" }, "downloads": -1, "filename": "pricing-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ebcdf109f65201964fcddecf211135e9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29321, "upload_time": "2018-05-13T01:34:17", "url": "https://files.pythonhosted.org/packages/9d/a4/f92d423c06d1cda66e51bbf8919b456f3c26f6ce505a001232b44f818c86/pricing-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "33825de5402d1f6eaa5281fcb9617f12", "sha256": "58dfed2fdf152b4e629cc12b15951c12f4b9146a31a6b6c3f7536eafee015259" }, "downloads": -1, "filename": "pricing-1.0.1.tar.gz", "has_sig": false, "md5_digest": "33825de5402d1f6eaa5281fcb9617f12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24234, "upload_time": "2018-05-13T01:34:19", "url": "https://files.pythonhosted.org/packages/8c/11/8ebdc16eaa6628f7f34710e27f568bb477377739ab4357a0b43a3d18f924/pricing-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ebcdf109f65201964fcddecf211135e9", "sha256": "88f444ff0f1de678d1d7666459ffffcf456d8f1e9af9ab77cd9375ad1534e1eb" }, "downloads": -1, "filename": "pricing-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ebcdf109f65201964fcddecf211135e9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 29321, "upload_time": "2018-05-13T01:34:17", "url": "https://files.pythonhosted.org/packages/9d/a4/f92d423c06d1cda66e51bbf8919b456f3c26f6ce505a001232b44f818c86/pricing-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "33825de5402d1f6eaa5281fcb9617f12", "sha256": "58dfed2fdf152b4e629cc12b15951c12f4b9146a31a6b6c3f7536eafee015259" }, "downloads": -1, "filename": "pricing-1.0.1.tar.gz", "has_sig": false, "md5_digest": "33825de5402d1f6eaa5281fcb9617f12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24234, "upload_time": "2018-05-13T01:34:19", "url": "https://files.pythonhosted.org/packages/8c/11/8ebdc16eaa6628f7f34710e27f568bb477377739ab4357a0b43a3d18f924/pricing-1.0.1.tar.gz" } ] }