spellmoney 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- spellmoney-1.0.0/.gitignore +11 -0
- spellmoney-1.0.0/CONTRIBUTING.md +87 -0
- spellmoney-1.0.0/LICENSE +21 -0
- spellmoney-1.0.0/PKG-INFO +161 -0
- spellmoney-1.0.0/README.md +127 -0
- spellmoney-1.0.0/pyproject.toml +65 -0
- spellmoney-1.0.0/src/spellmoney/__init__.py +517 -0
- spellmoney-1.0.0/src/spellmoney/monedas.py +179 -0
- spellmoney-1.0.0/src/spellmoney/py.typed +1 -0
- spellmoney-1.0.0/tests/test_spellmoney.py +232 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Contribuir a spellmoney (Python)
|
|
2
|
+
|
|
3
|
+
*[Read this in English](#contributing-to-spellmoney-python-english)*
|
|
4
|
+
|
|
5
|
+
Gracias por tu interés en mejorar `spellmoney`. Si el cambio es sobre la lógica de idiomas o el catálogo de monedas, tenlo en cuenta: existe un [puerto a JavaScript](https://github.com/brandriver-bit/spellmoney-js) que comparte los mismos datos y debe reflejar el mismo comportamiento, así que conviene aplicarlo en ambos para mantenerlos sincronizados.
|
|
6
|
+
|
|
7
|
+
## Antes de nada
|
|
8
|
+
|
|
9
|
+
El repositorio corre automáticamente las pruebas (`pytest`) en cada Pull Request, sobre Python 3.9 a 3.13. Si tu cambio hace fallar una prueba, o le faltan pruebas, te va a aparecer marcado en rojo antes de que se revise.
|
|
10
|
+
|
|
11
|
+
## Formas de ayudar
|
|
12
|
+
|
|
13
|
+
### 1. Reportar un error o pedir algo
|
|
14
|
+
|
|
15
|
+
Abre un [Issue](../../issues) describiendo qué esperabas que pasara y qué pasó en realidad.
|
|
16
|
+
|
|
17
|
+
### 2. Agregar o corregir el nombre de una moneda
|
|
18
|
+
|
|
19
|
+
Los nombres de moneda viven en `src/spellmoney/monedas.py`. Para agregar una moneda en un idioma que todavía no la tiene, agrega la entrada correspondiente ahí siguiendo el mismo formato (`singular`, `plural`, `genero`).
|
|
20
|
+
|
|
21
|
+
### 3. Agregar un idioma nuevo
|
|
22
|
+
|
|
23
|
+
Cada idioma en `src/spellmoney/__init__.py` sigue el mismo patrón: una función `numero_a_letras_xx(n)`, una entrada en `IDIOMAS`, y conectarlo en `_MOTOR`, `_PALABRA_CERO`, `_CONECTOR`, `_CENTAVOS_PALABRA` y, si aplica, `_ESCALA_QUE_PIDE_DE`. Solo se acepta si la gramática está verificada, no adivinada.
|
|
24
|
+
|
|
25
|
+
## Cómo enviar tu cambio
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/TU-USUARIO/spellmoney.git
|
|
29
|
+
cd spellmoney
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
|
|
32
|
+
git checkout -b agrega-moneda-XXX
|
|
33
|
+
|
|
34
|
+
# haz tu cambio, agrega tu prueba en tests/test_spellmoney.py
|
|
35
|
+
pytest
|
|
36
|
+
|
|
37
|
+
git add -A
|
|
38
|
+
git commit -m "Agrega AFN en portugués"
|
|
39
|
+
git push origin agrega-moneda-XXX
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Y abre un Pull Request desde GitHub.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# Contributing to spellmoney (Python) (English)
|
|
47
|
+
|
|
48
|
+
*[Leer esto en español](#contribuir-a-spellmoney-python)*
|
|
49
|
+
|
|
50
|
+
Thanks for your interest in improving `spellmoney`. If the change is about language logic or the currency catalog, keep in mind there's a [JavaScript port](https://github.com/brandriver-bit/spellmoney-js) that shares the same data and must behave identically, so it's best to apply the change to both and keep them in sync.
|
|
51
|
+
|
|
52
|
+
## Before anything else
|
|
53
|
+
|
|
54
|
+
The repository automatically runs the test suite (`pytest`) on every Pull Request, across Python 3.9 through 3.13. If your change breaks a test, or is missing one, it'll show up red before review.
|
|
55
|
+
|
|
56
|
+
## Ways to help
|
|
57
|
+
|
|
58
|
+
### 1. Report a bug or request something
|
|
59
|
+
|
|
60
|
+
Open an [Issue](../../issues) describing what you expected versus what actually happened.
|
|
61
|
+
|
|
62
|
+
### 2. Add or fix a currency name
|
|
63
|
+
|
|
64
|
+
Currency names live in `src/spellmoney/monedas.py`. To add a currency for a language that doesn't have it yet, add the matching entry there following the same shape (`singular`, `plural`, `genero`).
|
|
65
|
+
|
|
66
|
+
### 3. Add a new language
|
|
67
|
+
|
|
68
|
+
Every language in `src/spellmoney/__init__.py` follows the same pattern: a `numero_a_letras_xx(n)` function, an entry in `IDIOMAS`, and wiring it into `_MOTOR`, `_PALABRA_CERO`, `_CONECTOR`, `_CENTAVOS_PALABRA`, and `_ESCALA_QUE_PIDE_DE` if it applies. Only accepted if the grammar is verified, not guessed.
|
|
69
|
+
|
|
70
|
+
## How to submit your change
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/YOUR-USERNAME/spellmoney.git
|
|
74
|
+
cd spellmoney
|
|
75
|
+
pip install -e ".[dev]"
|
|
76
|
+
|
|
77
|
+
git checkout -b add-currency-XXX
|
|
78
|
+
|
|
79
|
+
# make your change, add your test in tests/test_spellmoney.py
|
|
80
|
+
pytest
|
|
81
|
+
|
|
82
|
+
git add -A
|
|
83
|
+
git commit -m "Add AFN in Portuguese"
|
|
84
|
+
git push origin add-currency-XXX
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then open a Pull Request on GitHub.
|
spellmoney-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brandon Rivera Alvarado
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: spellmoney
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Convierte montos a letras en español, inglés, portugués y francés para cheques, facturas, recibos y contratos, con soporte para las 154 divisas del estándar ISO 4217.
|
|
5
|
+
Project-URL: Homepage, https://github.com/brandriver-bit/spellmoney
|
|
6
|
+
Project-URL: Repository, https://github.com/brandriver-bit/spellmoney
|
|
7
|
+
Project-URL: Issues, https://github.com/brandriver-bit/spellmoney/issues
|
|
8
|
+
Project-URL: Puerto a JavaScript, https://github.com/brandriver-bit/spellmoney-js
|
|
9
|
+
Author: Brandon Rivera Alvarado
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: amount-to-words,cheques,english,facturacion,french,invoicing,iso4217,latam,monto-en-letras,numero-a-letras,portuguese,spanish
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Natural Language :: French
|
|
18
|
+
Classifier: Natural Language :: Portuguese (Brazilian)
|
|
19
|
+
Classifier: Natural Language :: Spanish
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
27
|
+
Classifier: Topic :: Office/Business :: Financial :: Accounting
|
|
28
|
+
Classifier: Topic :: Software Development :: Localization
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.9
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# spellmoney
|
|
36
|
+
|
|
37
|
+
**Convierte montos numéricos a letras, con el formato exacto que exigen los documentos legales y financieros** — cheques, facturas, recibos y contratos: `CIENTO VEINTICINCO DÓLARES CON 50/100`.
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/spellmoney/)
|
|
40
|
+

|
|
41
|
+

|
|
42
|
+

|
|
43
|
+

|
|
44
|
+

|
|
45
|
+
|
|
46
|
+
Existe también el [puerto a TypeScript/JavaScript](https://github.com/brandriver-bit/spellmoney-js) — misma lógica, mismos datos de moneda, mismo resultado exacto — para quien trabaja en Node.
|
|
47
|
+
|
|
48
|
+
## Instalación
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install spellmoney
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Uso
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from spellmoney import a_letras
|
|
58
|
+
|
|
59
|
+
a_letras(125.50)
|
|
60
|
+
# 'CIENTO VEINTICINCO DÓLARES CON 50/100'
|
|
61
|
+
|
|
62
|
+
a_letras(1, moneda="GTQ")
|
|
63
|
+
# 'UN QUETZAL CON 00/100'
|
|
64
|
+
|
|
65
|
+
a_letras(21000000, moneda="EUR")
|
|
66
|
+
# 'VEINTIÚN MILLONES DE EUROS CON 00/100'
|
|
67
|
+
|
|
68
|
+
a_letras(2, moneda="GBP", mayusculas=False)
|
|
69
|
+
# 'dos libras esterlinas con 00/100'
|
|
70
|
+
|
|
71
|
+
a_letras(10.50, centavos="palabras")
|
|
72
|
+
# 'DIEZ DÓLARES CON CINCUENTA CENTAVOS'
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Otros idiomas
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
a_letras(125.50, idioma="en")
|
|
79
|
+
# 'ONE HUNDRED TWENTY-FIVE DOLLARS AND 50/100'
|
|
80
|
+
|
|
81
|
+
a_letras(125.50, idioma="pt", moneda="BRL")
|
|
82
|
+
# 'CENTO E VINTE E CINCO REAIS E 50/100'
|
|
83
|
+
|
|
84
|
+
a_letras(125.50, idioma="fr", moneda="EUR")
|
|
85
|
+
# 'CENT VINGT-CINQ EUROS ET 50/100'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Solo el número, sin moneda
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from spellmoney import (
|
|
92
|
+
numero_a_letras,
|
|
93
|
+
numero_a_letras_en,
|
|
94
|
+
numero_a_letras_pt,
|
|
95
|
+
numero_a_letras_fr,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
numero_a_letras(1000000) # 'un millón'
|
|
99
|
+
numero_a_letras(1000000000) # 'mil millones' (¡no "un billón"!)
|
|
100
|
+
numero_a_letras(1000000000000) # 'un billón'
|
|
101
|
+
|
|
102
|
+
numero_a_letras_en(1000000000) # 'one billion' (escala corta del inglés)
|
|
103
|
+
|
|
104
|
+
numero_a_letras_pt(21, "f") # 'vinte e uma' (concordancia de género)
|
|
105
|
+
|
|
106
|
+
numero_a_letras_fr(71) # 'soixante et onze' (base vigesimal del francés)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Monedas soportadas
|
|
110
|
+
|
|
111
|
+
**Las 154 divisas activas del estándar ISO 4217.** La cobertura varía según el idioma:
|
|
112
|
+
|
|
113
|
+
| Idioma | Divisas cubiertas |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `es` (español) | 154 — todas |
|
|
116
|
+
| `en` (inglés) | 154 — todas |
|
|
117
|
+
| `pt` (portugués, Brasil) | 46 — países lusófonos + las divisas más usadas del mundo |
|
|
118
|
+
| `fr` (francés) | 45 — países francófonos + las divisas más usadas del mundo |
|
|
119
|
+
|
|
120
|
+
Si se pide una combinación de moneda e idioma que aún no existe, `a_letras` lanza `SpellMoneyError` con un mensaje explicando exactamente qué falta, en vez de fallar en silencio.
|
|
121
|
+
|
|
122
|
+
### 🙋 Ayuda buscada
|
|
123
|
+
|
|
124
|
+
Portugués y francés todavía tienen huecos en divisas regionales. Los pasos exactos para contribuir (fork, rama, pruebas, Pull Request) están en [`CONTRIBUTING.md`](CONTRIBUTING.md) — en español e inglés.
|
|
125
|
+
|
|
126
|
+
## API
|
|
127
|
+
|
|
128
|
+
| Función | Descripción |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `a_letras(monto, moneda="USD", idioma="es", centavos="fraccion", mayusculas=True)` | Convierte un monto con nombre de moneda. |
|
|
131
|
+
| `numero_a_letras(n)` | Solo el número, en español. |
|
|
132
|
+
| `numero_a_letras_en(n)` | Solo el número, en inglés. |
|
|
133
|
+
| `numero_a_letras_pt(n, genero="m")` | Solo el número, en portugués. |
|
|
134
|
+
| `numero_a_letras_fr(n)` | Solo el número, en francés. |
|
|
135
|
+
| `MONEDAS` | Catálogo de las 154 divisas ISO 4217. |
|
|
136
|
+
| `IDIOMAS` | `("es", "en", "pt", "fr")`. |
|
|
137
|
+
| `SpellMoneyError` | Error lanzado ante un monto, moneda o idioma inválidos. |
|
|
138
|
+
|
|
139
|
+
Parámetros de `a_letras`:
|
|
140
|
+
|
|
141
|
+
- `moneda` — código ISO 4217. Por defecto `"USD"`.
|
|
142
|
+
- `idioma` — `"es"`, `"en"`, `"pt"` o `"fr"`. Por defecto `"es"`.
|
|
143
|
+
- `centavos` — `"fraccion"` escribe `50/100`; `"palabras"` escribe `CINCUENTA CENTAVOS`.
|
|
144
|
+
- `mayusculas` — `True` devuelve el resultado en mayúsculas; `False`, en minúsculas.
|
|
145
|
+
|
|
146
|
+
## Rango soportado
|
|
147
|
+
|
|
148
|
+
Enteros de `0` a `999,999,999,999,999`. Un monto fuera de ese rango lanza `SpellMoneyError`, igual que un monto negativo, una moneda no reconocida o un idioma no soportado.
|
|
149
|
+
|
|
150
|
+
## Desarrollo
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
git clone https://github.com/brandriver-bit/spellmoney.git
|
|
154
|
+
cd spellmoney
|
|
155
|
+
pip install -e ".[dev]"
|
|
156
|
+
pytest
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Licencia
|
|
160
|
+
|
|
161
|
+
MIT — ver [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# spellmoney
|
|
2
|
+
|
|
3
|
+
**Convierte montos numéricos a letras, con el formato exacto que exigen los documentos legales y financieros** — cheques, facturas, recibos y contratos: `CIENTO VEINTICINCO DÓLARES CON 50/100`.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/spellmoney/)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
Existe también el [puerto a TypeScript/JavaScript](https://github.com/brandriver-bit/spellmoney-js) — misma lógica, mismos datos de moneda, mismo resultado exacto — para quien trabaja en Node.
|
|
13
|
+
|
|
14
|
+
## Instalación
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install spellmoney
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Uso
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
from spellmoney import a_letras
|
|
24
|
+
|
|
25
|
+
a_letras(125.50)
|
|
26
|
+
# 'CIENTO VEINTICINCO DÓLARES CON 50/100'
|
|
27
|
+
|
|
28
|
+
a_letras(1, moneda="GTQ")
|
|
29
|
+
# 'UN QUETZAL CON 00/100'
|
|
30
|
+
|
|
31
|
+
a_letras(21000000, moneda="EUR")
|
|
32
|
+
# 'VEINTIÚN MILLONES DE EUROS CON 00/100'
|
|
33
|
+
|
|
34
|
+
a_letras(2, moneda="GBP", mayusculas=False)
|
|
35
|
+
# 'dos libras esterlinas con 00/100'
|
|
36
|
+
|
|
37
|
+
a_letras(10.50, centavos="palabras")
|
|
38
|
+
# 'DIEZ DÓLARES CON CINCUENTA CENTAVOS'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Otros idiomas
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
a_letras(125.50, idioma="en")
|
|
45
|
+
# 'ONE HUNDRED TWENTY-FIVE DOLLARS AND 50/100'
|
|
46
|
+
|
|
47
|
+
a_letras(125.50, idioma="pt", moneda="BRL")
|
|
48
|
+
# 'CENTO E VINTE E CINCO REAIS E 50/100'
|
|
49
|
+
|
|
50
|
+
a_letras(125.50, idioma="fr", moneda="EUR")
|
|
51
|
+
# 'CENT VINGT-CINQ EUROS ET 50/100'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Solo el número, sin moneda
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from spellmoney import (
|
|
58
|
+
numero_a_letras,
|
|
59
|
+
numero_a_letras_en,
|
|
60
|
+
numero_a_letras_pt,
|
|
61
|
+
numero_a_letras_fr,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
numero_a_letras(1000000) # 'un millón'
|
|
65
|
+
numero_a_letras(1000000000) # 'mil millones' (¡no "un billón"!)
|
|
66
|
+
numero_a_letras(1000000000000) # 'un billón'
|
|
67
|
+
|
|
68
|
+
numero_a_letras_en(1000000000) # 'one billion' (escala corta del inglés)
|
|
69
|
+
|
|
70
|
+
numero_a_letras_pt(21, "f") # 'vinte e uma' (concordancia de género)
|
|
71
|
+
|
|
72
|
+
numero_a_letras_fr(71) # 'soixante et onze' (base vigesimal del francés)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Monedas soportadas
|
|
76
|
+
|
|
77
|
+
**Las 154 divisas activas del estándar ISO 4217.** La cobertura varía según el idioma:
|
|
78
|
+
|
|
79
|
+
| Idioma | Divisas cubiertas |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `es` (español) | 154 — todas |
|
|
82
|
+
| `en` (inglés) | 154 — todas |
|
|
83
|
+
| `pt` (portugués, Brasil) | 46 — países lusófonos + las divisas más usadas del mundo |
|
|
84
|
+
| `fr` (francés) | 45 — países francófonos + las divisas más usadas del mundo |
|
|
85
|
+
|
|
86
|
+
Si se pide una combinación de moneda e idioma que aún no existe, `a_letras` lanza `SpellMoneyError` con un mensaje explicando exactamente qué falta, en vez de fallar en silencio.
|
|
87
|
+
|
|
88
|
+
### 🙋 Ayuda buscada
|
|
89
|
+
|
|
90
|
+
Portugués y francés todavía tienen huecos en divisas regionales. Los pasos exactos para contribuir (fork, rama, pruebas, Pull Request) están en [`CONTRIBUTING.md`](CONTRIBUTING.md) — en español e inglés.
|
|
91
|
+
|
|
92
|
+
## API
|
|
93
|
+
|
|
94
|
+
| Función | Descripción |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `a_letras(monto, moneda="USD", idioma="es", centavos="fraccion", mayusculas=True)` | Convierte un monto con nombre de moneda. |
|
|
97
|
+
| `numero_a_letras(n)` | Solo el número, en español. |
|
|
98
|
+
| `numero_a_letras_en(n)` | Solo el número, en inglés. |
|
|
99
|
+
| `numero_a_letras_pt(n, genero="m")` | Solo el número, en portugués. |
|
|
100
|
+
| `numero_a_letras_fr(n)` | Solo el número, en francés. |
|
|
101
|
+
| `MONEDAS` | Catálogo de las 154 divisas ISO 4217. |
|
|
102
|
+
| `IDIOMAS` | `("es", "en", "pt", "fr")`. |
|
|
103
|
+
| `SpellMoneyError` | Error lanzado ante un monto, moneda o idioma inválidos. |
|
|
104
|
+
|
|
105
|
+
Parámetros de `a_letras`:
|
|
106
|
+
|
|
107
|
+
- `moneda` — código ISO 4217. Por defecto `"USD"`.
|
|
108
|
+
- `idioma` — `"es"`, `"en"`, `"pt"` o `"fr"`. Por defecto `"es"`.
|
|
109
|
+
- `centavos` — `"fraccion"` escribe `50/100`; `"palabras"` escribe `CINCUENTA CENTAVOS`.
|
|
110
|
+
- `mayusculas` — `True` devuelve el resultado en mayúsculas; `False`, en minúsculas.
|
|
111
|
+
|
|
112
|
+
## Rango soportado
|
|
113
|
+
|
|
114
|
+
Enteros de `0` a `999,999,999,999,999`. Un monto fuera de ese rango lanza `SpellMoneyError`, igual que un monto negativo, una moneda no reconocida o un idioma no soportado.
|
|
115
|
+
|
|
116
|
+
## Desarrollo
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
git clone https://github.com/brandriver-bit/spellmoney.git
|
|
120
|
+
cd spellmoney
|
|
121
|
+
pip install -e ".[dev]"
|
|
122
|
+
pytest
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Licencia
|
|
126
|
+
|
|
127
|
+
MIT — ver [`LICENSE`](LICENSE).
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "spellmoney"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Convierte montos a letras en español, inglés, portugués y francés para cheques, facturas, recibos y contratos, con soporte para las 154 divisas del estándar ISO 4217."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Brandon Rivera Alvarado" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"numero-a-letras",
|
|
16
|
+
"monto-en-letras",
|
|
17
|
+
"amount-to-words",
|
|
18
|
+
"spanish",
|
|
19
|
+
"english",
|
|
20
|
+
"portuguese",
|
|
21
|
+
"french",
|
|
22
|
+
"invoicing",
|
|
23
|
+
"facturacion",
|
|
24
|
+
"cheques",
|
|
25
|
+
"iso4217",
|
|
26
|
+
"latam",
|
|
27
|
+
]
|
|
28
|
+
classifiers = [
|
|
29
|
+
"Development Status :: 5 - Production/Stable",
|
|
30
|
+
"Intended Audience :: Developers",
|
|
31
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
32
|
+
"Natural Language :: Spanish",
|
|
33
|
+
"Natural Language :: English",
|
|
34
|
+
"Natural Language :: Portuguese (Brazilian)",
|
|
35
|
+
"Natural Language :: French",
|
|
36
|
+
"Operating System :: OS Independent",
|
|
37
|
+
"Programming Language :: Python :: 3",
|
|
38
|
+
"Programming Language :: Python :: 3.9",
|
|
39
|
+
"Programming Language :: Python :: 3.10",
|
|
40
|
+
"Programming Language :: Python :: 3.11",
|
|
41
|
+
"Programming Language :: Python :: 3.12",
|
|
42
|
+
"Programming Language :: Python :: 3.13",
|
|
43
|
+
"Topic :: Office/Business :: Financial :: Accounting",
|
|
44
|
+
"Topic :: Software Development :: Localization",
|
|
45
|
+
"Typing :: Typed",
|
|
46
|
+
]
|
|
47
|
+
dependencies = []
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/brandriver-bit/spellmoney"
|
|
51
|
+
Repository = "https://github.com/brandriver-bit/spellmoney"
|
|
52
|
+
Issues = "https://github.com/brandriver-bit/spellmoney/issues"
|
|
53
|
+
"Puerto a JavaScript" = "https://github.com/brandriver-bit/spellmoney-js"
|
|
54
|
+
|
|
55
|
+
[project.optional-dependencies]
|
|
56
|
+
dev = ["pytest>=7"]
|
|
57
|
+
|
|
58
|
+
[tool.hatch.build.targets.wheel]
|
|
59
|
+
packages = ["src/spellmoney"]
|
|
60
|
+
|
|
61
|
+
[tool.hatch.build.targets.sdist]
|
|
62
|
+
include = ["src", "tests", "README.md", "LICENSE", "CONTRIBUTING.md", "pyproject.toml"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
testpaths = ["tests"]
|