RUTlib-py
A Python library for parsing, validating, manipulating, generating, and formatting RUTs (Chilean identification).
Quick Installation
pip install RUTlib
The module exports the following functions:
- clean_rut(rut: str) -> str
- validate_rut(rut: str) -> bool
- get_last_digit_of_rut(rut_numbers: int) -> str
- format_rut(rut: str, with_dots: bool = True) -> str
- generate_rut(length: int = 8, formatted: bool = True) -> str
Usage
Clean a RUT
This function takes a RUT as a string and removes all non-numeric characters, and transforms the input to uppercase.
from RUTlib import clean_rut
print(clean_rut('1.234-3')) # 12343
print(clean_rut('1234-3')) # 12343
print(clean_rut('12343')) # 12343
Validate a RUT
This function checks whether a RUT is valid according to the RUT verification rules.
from RUTlib import validate_rut
print(validate_rut('1.234-3')) # True
print(validate_rut('1234-3')) # True
print(validate_rut('12343')) # True
print(validate_rut('1.234-0')) # False
Get Verificator Digit of a number
This function calculates the verification digit of a RUT.
from RUTlib import get_last_digit_of_rut
print(get_last_digit_of_rut(1234)) # 3
print(get_last_digit_of_rut(1235)) # 1
Format RUT
This function formats a RUT according to RUT conventions.
from RUTlib import format_rut
print(format_rut('12343')) # 1.234-3
print(format_rut('12343', False)) # 1234-3
Generate a random RUT
This function generates a valid RUT randomly.
from RUTlib import generate_rut
print(generate_rut()) # Example: 12.345.678-5 (random)
print(generate_rut(7, False)) # Example: 1234567-5 (random)
Support the Project
If you'd like to contribute
If you want to contribute to this module, please create Issues in the repository or submit Pull Requests. Remember to follow the code of conduct and best practices for clean code.
Any changes in the logic of the module's functions should be properly tested and documented.
More information
For more information about the RUT, consult the following link: RUT (Chile)
Version 0.1.1
Metadata
Release files for RUTlib 0.1.2
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 |
|---|---|---|---|---|
| RUTlib-0.1.2.tar.gz | 8.4 kB | Without provenance | Details for RUTlib-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| RUTlib-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for RUTlib-0.1.2-py3-none-any.whl |
Total release size: 17.0 kB
Release files / RUTlib-0.1.2.tar.gz
| Download URL | RUTlib-0.1.2.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1126d18d6d4a05c18c207f9e72c84af207ea7aab1226de638314877b41591540
|
|
BLAKE2b-256 checksum How to use checksums |
9177d9b35f929e8c35df5a27230a07a54b1a4f98c5599e16537decb94686df72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / RUTlib-0.1.2-py3-none-any.whl
| Download URL | RUTlib-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
263f799da128faa8213015e1e366233a21f6182c3d9f626e5e30d5fbd7a52108
|
|
BLAKE2b-256 checksum How to use checksums |
2515a6e851b3e720d5cfcd8b47a2903ae15eba20bb0508f9c8e1b32932731b96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for RUTlib 0.1.2
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.