{"id":29105137,"url":"https://github.com/mirumee/prices","last_synced_at":"2025-06-29T01:07:39.515Z","repository":{"id":4626986,"uuid":"5771151","full_name":"mirumee/prices","owner":"mirumee","description":"Python price handling for humans.","archived":false,"fork":false,"pushed_at":"2022-10-07T12:55:57.000Z","size":104,"stargazers_count":268,"open_issues_count":5,"forks_count":41,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-06-24T00:11:49.527Z","etag":null,"topics":["currencies","currency","e-commerce","gross","money","net","prices","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mirumee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-11T21:20:38.000Z","updated_at":"2025-04-22T01:54:47.000Z","dependencies_parsed_at":"2022-09-21T18:40:17.028Z","dependency_job_id":null,"html_url":"https://github.com/mirumee/prices","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/mirumee/prices","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirumee%2Fprices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirumee%2Fprices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirumee%2Fprices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirumee%2Fprices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirumee","download_url":"https://codeload.github.com/mirumee/prices/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirumee%2Fprices/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262518515,"owners_count":23323341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["currencies","currency","e-commerce","gross","money","net","prices","python"],"created_at":"2025-06-29T01:07:37.290Z","updated_at":"2025-06-29T01:07:39.505Z","avatar_url":"https://github.com/mirumee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Prices: Python price handling for humans\n========================================\n\n[![Build Status](https://secure.travis-ci.org/mirumee/prices.png)](https://travis-ci.org/mirumee/prices) [![codecov.io](http://codecov.io/github/mirumee/prices/coverage.svg?branch=master)](http://codecov.io/github/mirumee/prices?branch=master)\n\n------\n\nMoney:\n\n```python\nfrom prices import Money\na = Money(10, 'USD')\na += Money(20, 'USD')\na.value\n# Decimal('30')\na = a.quantize()\na.value\n# Decimal('30.00')\na = Money('5.00', 'JPY')\na.quantize()\na.value\n# Decimal('5')\n```\n\nTaxed money:\n\n```python\nfrom prices import Money, TaxedMoney\np = TaxedMoney(net=Money(20, 'EUR'), gross=Money(30, 'EUR'))\np.net\n# Money('20', 'EUR')\np.gross\n# Money('30', 'EUR')\np.tax\n# Money('10', 'EUR')\np = p.quantize()\np.net\n# Money('20.00', 'EUR')\n```\n\nTaxed ranges:\n\n```python\nfrom prices import Money, TaxedMoney, TaxedMoneyRange\nprice1 = TaxedMoney(Money(1, 'USD'), Money(1, 'USD'))\nprice2 = TaxedMoney(Money(10, 'USD'), Money(10, 'USD'))\npr = TaxedMoneyRange(price1, price2)\npr.min_price\n# TaxedMoney(net=Money('1', 'USD'), gross=Money('1', 'USD'))\npr.max_price\n# TaxedMoney(net=Money('10', 'USD'), gross=Money('10', 'USD'))\nprice3 = TaxedMoney(net=Money(5, 'USD'), gross=Money(5, 'USD'))\nprice3 in pr\n# True\npr = pr.quantize()\npr.min_price.net\n# Money('1.00', 'USD')\n```\n\nTaxes:\n\n```python\nfrom decimal import Decimal\nfrom prices import Money, TaxedMoney, TaxedMoneyRange, flat_tax\np = TaxedMoney(Money('1.99', 'GBP'), Money('1.99', 'GBP'))\np = flat_tax(p, Decimal('0.23'))\np = p.quantize()\np.gross\n# Money('2.45', 'GBP')\n```\n\nWhile protecting you from all sorts of mistakes:\n\n```python\nfrom prices import Money\nMoney(10, 'USD') \u003c Money(15, 'GBP')\n# ValueError: Cannot compare amounts in 'USD' and 'GBP'\n```\n\n```python\nfrom prices import Money, TaxedMoney\nprice1 = TaxedMoney(Money(5, 'BTC'), Money(5, 'BTC'))\nprice2 = TaxedMoney(Money(7, 'INR'), Money(7, 'INR'))\nprice1 + price2\n# ValueError: Cannot add amount in 'BTC' to 'INR'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirumee%2Fprices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirumee%2Fprices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirumee%2Fprices/lists"}