chenyikun
Small utilities from my projects. The first module handles exact money amounts for cross-border e-commerce.
pip install chenyikun
Money
Amounts are stored as integers in the currency's minor unit, so there is no floating-point error. Minor units follow ISO 4217: USD has 2 decimal places, JPY has 0, KWD has 3.
from chenyikun import Money, convert, fx_consistent
price = Money.parse("49.99", "USD") # Money(amount_minor=4999, currency='USD')
print(price) # 49.99 USD
eur = convert(price, "EUR", "0.9235") # rounded to the cent, banker's rounding by default
print(eur) # 46.17 EUR
fx_consistent(price, Money(4616, "EUR"), "0.9235") # True: within 1 minor unit
Money(100, "EUR") + Money(100, "USD") # raises CurrencyMismatchError
Money.parserejects amounts with more decimal places than the currency allows, and rejects floats.convertrounds to the target currency's minor unit (ROUND_HALF_EVENunless you pass another mode).fx_consistentchecks a charged amount against a source amount and an exchange rate.
License
MIT
Metadata
Release files for chenyikun 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chenyikun-0.1.0.tar.gz | 13.7 kB | Without provenance | Details for chenyikun-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chenyikun-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for chenyikun-0.1.0-py3-none-any.whl |
Total release size: 18.2 kB
Release files / chenyikun-0.1.0.tar.gz
| Download URL | chenyikun-0.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8142bffd71a4ee95b80e5c21d0f16667afa4a77bc58c9dc45690002ccfbb5db5
|
|
BLAKE2b-256 checksum How to use checksums |
3c847da73fa89b8e07e37fdf47c04d5b8a51df123da419861d8924483a459649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / chenyikun-0.1.0-py3-none-any.whl
| Download URL | chenyikun-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
44255c0e4b1e3cd46f8644d1f2e633e7f41f9e07d8f801b2f74682ec327f56da
|
|
BLAKE2b-256 checksum How to use checksums |
7b388336e1ff0bd5c1d05645a2355d254180e3920b375389da1e77fe8c66455d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for chenyikun 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.