Change log¶
Significant or incompatible changes listed here.
Unreleased - TBA¶
3.0 (2022-11-27)¶
Added
SLE&VEDcurrencies.Removed support for Python 3.6.
Added support for Python 3.10 & 3.11.
2.0 (2021-05-26)¶
Dropped support for Python 2.7 and 3.5 and PyPy 2.
Added pyupgrade pre-commit hook.
Added black pre-commit hook and reformatted codebase.
Updated pre-commit hooks.
Replaced custom flake8, isort and check-manifest Github Action jobs with a generic pre-commit job.
Dropped the
moneyed.localizationmodule that was deprecated and announced for removal in 1.0.Added type hints along with a mypy pre-commit hook.
Added action for building and publishing releases, along with the check-github-workflows pre-commit hook for validating Github Action workflow files.
Removed undocumented
DEFAULT_CURRENCYandDEFAULT_CURRENCY_CODEconstants, and change to make instantiatingMoneywithout providing a currency a type error. This used to result in an object with a made-up"XYZ"currency, which could lead to surprising behaviors and bugs.Added
zeroproperty toCurrencyto conveniently access the zero value of a given currency.Moved to use setuptool’s declarative packaging config and PEP 517 isolated builds.
Removed requirements files and instead specified test requirements using extras.
1.2 (2021-02-23)¶
Money.__add__returnsNotImplementedinstead of raising an exception when another operand has unsupported type.
1.1 (2021-01-15)¶
Changed the
numericattribute values toNonefor currencies that don’t have assigned ISO numeric codes:IMP,TVD,XFO,XFU.Restored the previous definition for the
XXXcurrency, including itsnameandcountriesattributes.Fixed
get_currencyreturning obsolete currencies.
1.0 (2021-01-09)¶
Dropped official support for Python 2.6, 3.2, 3.3, 3.4 (mainly because our test tools don’t support them any more).
Added support for getting amount in sub units (fixed point)
Format
Moneyinstances using CLDR and Babel. This is a large change with lots of parts. Many thanks to @pooyamb for all the hard work that went into this and other related changes.Added new
moneyed.l10nmodule, containing a newformat_moneyfunction. This is a very thin wrapper around babel.numbers.format_currency and has all the same options. This allows us to get the official CLDR formats for currencies, in all the different locales.See docs in README.
Note especially that you need to specify
locale(e.g.locale="en_US"), or you will get theLC_NUMERICdefault.Deprecated the
format_moneyfunction inmoneyed.localization. There is no immediate plan to remove, but it should not be relied on. Also, this function relies on our own manually entered data for formatting of currencies in different locales. This data is very incomplete and will not be updated any more.So you need to use
moneyed.l10n.format_moneyinstead now.If you were relying on the
decimal_placesargument to the old function, there is no exact equivalent in the newformat_moneyfunction, but see thedecimal_quantizationoption (documented in babel.numbers.format_currency)Money.__str__(Money.__unicode__on Python 2) now uses newformat_moneywith the default localeLC_NUMERIC, which can produce different results from the old function. Use the newformat_moneyto control output.On Python 2,
Money.__str__(bytestring) output has changed to be more basic. You should use the newformat_moneyfunction to control output.
Get currency names from Babel data. Several changes, including:
For all built-in currencies,
Currency.namenow comes from Babel (“en_US” locale). This means there have been various corrections to currency names.If you pass a non-None
nameto theCurrencyconstructor, you can still specify any name you want.Currency.get_name(locale)has been added.
Get currency ‘countries’ from Babel data. Several changes, including:
Currency.countriesnow sources from Babel, so some names may be different.Currency.country_codeshas been added.Currency.countriesis deprecated, because it is not the most useful form for the data (e.g. upper cased strings, and names in US English only). It is recommended to useCurrency.country_codesand convert to names usingget_country_name.
Changed the repr of
Moneyso thateval(repr(money_object) == money_object(at least in some environments, and most of the typical ones). See Python docs on __repr__ for rationale. Thanks @davidtvs. This could be backwards incompatible if you were relying on the old output ofrepr().Added
list_all_currencies()utility function.
0.8 (2018-11-19)¶
Money.round([ndigits])added. Usesdecimal.ROUND_HALF_EVENby default, but this can be overridden by settingroundingin thedecimalcontext before callingMoney.round().Various fixes/additions for different locales
Division support on Python 2
DEFAULT locale is now used as a fallback to return a currency symbol if your chosen locale has no symbol set for that currency, rather than just returning the currency code.
0.7 (2017-05-08)¶
Money.__str__changed under Python 2 to use only ASCII characters. This means that currency codes, rather than symbols, are used.Lots of additional locales supported out of the box.
Python 3.5 supported
Fixed #70 - format_money error when the locale is not in the formatting definitions: the default is not used.
Various other bug fixes
0.6 and earlier¶
See VCS logs.