checkdigit is a Python library providing algorithms for various check digit standards, facilitating data validation and error detection. It supports algorithms like Luhn, ISBN, UPC, EAN, ISIN, Modulo 10, Modulo 11, GS1, and CRC. The current version is 0.5.0, with releases occurring periodically to introduce new features, fix bugs, and refine existing algorithms.
pip install checkdigitVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the `luhn` and `isbn` modules to validate and generate check digits. The `isbn` module automatically handles both ISBN-10 and ISBN-13 formats.
Migrate usage from `checkdigit.formats.isbn10` or `checkdigit.formats.isbn13` to `checkdigit.isbn.validate()` or `checkdigit.isbn.generate()`. The unified `isbn` module automatically detects the ISBN type.
Adjust code to expect only the missing bit as the return value from parity methods, rather than a full data structure.
Consult the official documentation or changelog for specific function name changes if migrating from versions prior to 0.1. It's generally recommended to upgrade and adapt to the current API.
Upgrade to checkdigit version 0.5.0 or newer to ensure correct ISBN-13 validation behavior.
Install the library using pip: `pip install checkdigit`
Ensure the input string passed to the checkdigit function contains only numeric characters. For ISBN-10, handle 'X' as a special case if the function doesn't automatically convert it, typically by ensuring your input is sanitized.
Provide an input string with the correct number of digits required by the specific check digit algorithm being used. Refer to the library's documentation for exact length requirements for each algorithm.
Convert the input number to a string before passing it to the checkdigit function. For example, use `str(12345)` instead of `12345`.
No dependency data recorded yet.