Skip to main content

PyVAT with Checksums

PyPI License: MIT

A robust and accurate VAT number validation library for Python.

Why PyVAT with Checksums?

Most VAT validation libraries check if the string starts with the correct country code and has the correct length. That is not enough.

PyVAT with Checksums goes deeper to ensure data integrity:

  • 🧮 Real Checksum Validation: We don't just count digits. We implement the official algorithms defined in the European Commission's VIES VAT Validation Routines specifications (Modulus 11, Modulus 97, etc.) to verify the number is genuinely valid.
  • 🛡️ Stop Bad Data: Prevent typos and fake numbers from entering your system. A number can look right but be mathematically impossible—we catch that.
  • ⚡ Zero External Dependencies: Lightweight and fast, perfect for high-throughput applications.

Features

  • ✅ Mathematical Verification: Implements complex checksum algorithms for supported countries.
  • 🌐 Multi-Country Support: Validates VAT numbers for all EU countries and many others (UK, Switzerland, Norway, Russia, etc.).
  • 🔍 Format Checking: Validates structure, length, and allowed characters (numeric vs alphanumeric).
  • 📦 Modern Python: Fully typed and compatible with modern Python versions.

Installation

pip install pyvat-with-checksums

Or using uv:

uv add pyvat-with-checksums

Usage

Import the validator and the countries you want to check against.

from pyvat_with_checksums import check_vat, belgium, austria

# 1. Valid VAT number (Belgium)
result = check_vat('BE0411905847', [belgium])
print(result.is_valid)
# Output: True
print(result.country.name)
# Output: 'Belgium'

# 2. Invalid Checksum (Looks like a valid format, but fails math check)
# This would pass a simple regex check, but fails here!
result = check_vat('BE0411905848', [belgium])
print(result.is_valid)
# Output: False

# 3. Check against multiple countries
result = check_vat('ATU12345678', [belgium, austria])
if result.is_valid:
    print(f"Valid VAT for {result.country.name}")

Supported Countries

Supports a wide range of countries, including but not limited to:

  • 🇪🇺 European Union: Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden.
  • 🌍 Non-EU: United Kingdom, Switzerland, Norway, Russia, Serbia, Brazil.

Development

To run tests locally:

make test

To run linting checks:

make lint

Metadata

Release files for pyvat-with-checksums 0.1.0

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

Source distribution (sdist)

Source distribution for pyvat-with-checksums 0.1.0
File Size Uploaded
pyvat_with_checksums-0.1.0.tar.gz 38.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyvat-with-checksums 0.1.0
File Interpreter ABI Platform
pyvat_with_checksums-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 64.6 kB

Release files / pyvat_with_checksums-0.1.0.tar.gz

Download URL pyvat_with_checksums-0.1.0.tar.gz
Size 38.6 kB
Tags Source
SHA-256 checksum
How to use checksums
856a5619a1aa8458b8bb34f45973259fe0d7351241b10fc496c8ddb8298a9178
BLAKE2b-256 checksum
How to use checksums
170b98656e842fb85ff665e164c3853172ed405621de5e01b04ae8cba08116aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyvat_with_checksums-0.1.0-py3-none-any.whl

Download URL pyvat_with_checksums-0.1.0-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33691c942af41db2e10e6bc0e28850a4e5e5bcef08eda469ee45d8768165e037
BLAKE2b-256 checksum
How to use checksums
2032aa4f4e0015ae8eda8617835c44ead0885394ac4566e09f1171a48091edde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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