Update dependency py-moneyed to v3 #163
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==0.8.0->==3.0Release Notes
py-moneyed/py-moneyed (py-moneyed)
v3.0Compare Source
SLE&VEDcurrencies.v2.0Compare Source
pre-commit job.
moneyed.localizationmodule that was deprecated and announced forremoval in 1.0.
check-github-workflows pre-commit hook for validating Github Action workflow files.
DEFAULT_CURRENCYandDEFAULT_CURRENCY_CODEconstants, andchange to make instantiating
Moneywithout providing a currency a type error. Thisused to result in an object with a made-up
"XYZ"currency, which could lead tosurprising behaviors and bugs.
zeroproperty toCurrencyto conveniently access the zero value of agiven currency.
v1.2Money.__add__returnsNotImplementedinstead of raising an exception when another operand has unsupported type.v1.1numericattribute values toNonefor currencies that don't have assigned ISO numeric codes:IMP,TVD,XFO,XFU.XXXcurrency, including itsnameandcountriesattributes.get_currencyreturning obsolete currencies.v1.0Compare Source
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 <http://babel.pocoo.org/en/latest/api/numbers.html#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. Thereis 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 new
format_moneyfunction, but seethe
decimal_quantizationoption (documented inbabel.numbers.format_currency <http://babel.pocoo.org/en/latest/api/numbers.html#babel.numbers.format_currency>_)Money.__str__(Money.__unicode__on Python 2) now uses newformat_moneywith the default localeLC_NUMERIC, which can producedifferent results from the old function. Use the new
format_moneyto controloutput.
On Python 2,
Money.__str__(bytestring) output has changed to be morebasic. You should use the new
format_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 canstill 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 formfor the data (e.g. upper cased strings, and names in US English only). It is
recommended to use
Currency.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__ <https://docs.python.org/3/reference/datamodel.html?highlight=__repr__#object.__repr__>_for rationale. Thanks
@davidtvs <https://github.com/davidtvs>_. This couldbe backwards incompatible if you were relying on the old output of
repr().Added
list_all_currencies()utility function.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR has been generated by Mend Renovate. View repository job log here.