Skip to main content

Package for validating Uruguayan ids (work in progress).

Project description


PyPI PyPI - Status PyPI - License

Package for validating Uruguayan ids.

The methods in this package, work with strings and ignore any non-digit characters. Numbers are valid too. So for example, the following expressions represent the same document number:


This package includes the following functions:

validate_ci(ci: str) -> bool: Returns true if ci is a valid document number, returns false otherwise. ci is a string which represents a document number, including the validation digit. ci can be a number as well.

validation_digit(ci: str) -> str: Returns the validation digit for ci.

random() -> str: Returns a random document number (including validation digit) in the (100.000, 9.999.999) range.


$ pip install ciuy


>>> import ciuy
>>> ciuy.validate_ci("1.234.567-2")
>>> ciuy.validation_digit("1.234.567")
>>> ciuy.random()


This package includes some doctests, as well as unit tests that can be run with nose2.

After cloning the repository, you can run the doctests with:

$ python3 -m doctest ./ciuy/ -v
 (several lines ommited)
11 passed and 0 failed.
Test passed.

Use nose2 to run the unit tests:

$ python3 -m nose2
Ran 73 tests in 0.008s



  • Better documentation (use Read The Docs?).
  • Maybe add command line scripts?
  • Readme in Spanish.

Based on the ci_uy Ruby gem by Fernando Briano (link).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ciuy, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size ciuy-0.3.3-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ciuy-0.3.3.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page