Skip to main content

datacheck-kit

A small, zero-dependency toolkit for validating and formatting the kinds of data that show up in almost every form or import script: email addresses, phone numbers, URLs, IBANs, credit card numbers, postal codes and slugs.

It exists because most projects end up copy-pasting the same handful of regexes and checksum functions over and over. This package collects the ones worth reusing into one place, with tests and no runtime dependencies.

This is a Python port of the datacheck-kit npm package — same API surface, adapted to Python conventions (snake_case, None instead of null).

Install

pip install datacheck-kit

Usage

import datacheck_kit as dk

dk.is_valid_email("user@example.com")        # True
dk.normalize_email("  User@Example.COM ")    # "user@example.com"

dk.is_valid_url("example.com")               # False (no protocol)
dk.normalize_url("example.com/path/")        # "https://example.com/path/"

dk.is_valid_phone("+44 20 7123 4567")        # True
dk.format_phone_e164("+44 20 7123 4567")     # "+442071234567"

dk.is_valid_iban("NL91ABNA0417164300")       # True
dk.format_iban("NL91ABNA0417164300")         # "NL91 ABNA 0417 1643 00"

dk.is_valid_card_number("4111 1111 1111 1111")  # True (Luhn check)
dk.mask_card_number("4111111111111111")         # "**** **** **** 1111"

dk.is_valid_postal_code("1011 AB", "NL")     # True
dk.supported_countries()                     # ["NL", "PL", "DE", ...]

dk.slugify("Café Müller & Söhne")            # "cafe-muller-sohne"

API

Email

  • is_valid_email(value: str) -> bool
  • normalize_email(value: str) -> str | None

URL

  • is_valid_url(value: str) -> bool
  • normalize_url(value: str) -> str | None

Phone

  • is_valid_phone(value: str) -> bool — accepts E.164-style numbers (optional leading +, 8-15 digits, common separators allowed).
  • format_phone_e164(value: str) -> str | None

IBAN

  • is_valid_iban(value: str) -> bool — validates the mod-97 (ISO 7064) checksum and checks length against the issuing country when known.
  • format_iban(value: str) -> str — groups the IBAN into 4-character blocks for display.

Credit card

  • is_valid_card_number(value: str) -> bool — Luhn algorithm.
  • mask_card_number(value: str) -> str | None — keeps only the last 4 digits visible.

Postal code

  • is_valid_postal_code(value: str, country_code: str) -> bool — supports NL, PL, DE, FR, IT, AT, CH, GB, ES, FI, US.
  • supported_countries() -> list[str]

Slug

  • slugify(value: str) -> str — lower-cases, strips common Latin diacritics, and collapses everything else into hyphens.

Why not a bigger validation library?

Larger packages cover far more ground and are a better fit if you need everything they offer. datacheck-kit is for the common case: you need five or six of these checks, you don't want a dependency tree for them, and you'd rather read the source in a couple of minutes than look up documentation.

Testing

python -m unittest discover -s tests

Uses only the standard library — no test framework dependency required.

License

MIT — see LICENSE.

Metadata

Release files for datacheck-kit 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datacheck-kit 1.0.1
File Size Uploaded Provenance Actions
datacheck_kit-1.0.1.tar.gz 9.2 kB Without provenance Details for datacheck_kit-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datacheck-kit 1.0.1
File Interpreter ABI Platform Actions
datacheck_kit-1.0.1-py3-none-any.whl Python 3 none any Details for datacheck_kit-1.0.1-py3-none-any.whl

Total release size: 18.2 kB

Release files / datacheck_kit-1.0.1.tar.gz

Download URL datacheck_kit-1.0.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
91091c6114486722795fa776f71d05d4c349a48b4c7d8406cffd52eb86d0bf93
BLAKE2b-256 checksum
How to use checksums
bdad56f8faacf9194b7d7d80e54dcaea20f9e50c0a384341cd5ffcee74bd00c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / datacheck_kit-1.0.1-py3-none-any.whl

Download URL datacheck_kit-1.0.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4de03844eee756e34c67444752a395296677d268d4790d2189a363364434b4c4
BLAKE2b-256 checksum
How to use checksums
6b32a4ad1293f2de1c504044fc6a710dfdcdafdd67de640e8907fa6335db48eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for datacheck-kit 1.0.1

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page