Skip to main content
https://travis-ci.org/iconfinder/pyvat.png?branch=master

With EU VAT handling rules becoming ever more ridiculous and complicated, businesses within the EU are faced with the complexity of having to validate VAT numbers. pyvat was built for Iconfinder’s marketplace to handle just this problem.

Validation of VAT numbers is performed in two steps: firstly, the VAT number is checked against an expression for the given country if one such is available, after which it is checked against a registry if one such is available.

Calculation of VAT rates for sales is supported within the EU for items covered by the new EU directive for VAT on telecommunications, broadcasting and electronic services.

Installation

To install requests, do yourself a favor and don’t use anything other than pip:

$ pip install pyvat

Usage

pyvat exposes its functionality through three simple methods:

pyvat.check_vat_number(vat_number, country_code=None)

Test if a VAT number is valid.

If possible, the VAT number will be checked against available registries.

Parameters:
  • vat_number – VAT number to validate.

  • country_code – Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.

Returns:

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.is_vat_number_format_valid(vat_number, country_code=None)

Test if the format of a VAT number is valid.

Parameters:
  • vat_number – VAT number to validate.

  • country_code – Optional country code. Should be supplied if known, as there is no guarantee that naively entered VAT numbers contain the correct alpha-2 country code prefix for EU countries just as not all non-EU countries have a reliable country code prefix. Default None prompting detection.

Returns:

True if the VAT number can be fully asserted as valid or False if not, otherwise None indicating that the VAT number may or may not be valid.

pyvat.get_sale_vat_charge(date, item_type, buyer, seller)

Get the VAT charge for performing the sale of an item.

Currently only supports determination of the VAT charge for telecommunications, broadcasting and electronic services in the EU.

Parameters:
  • date (datetime.date) – Sale date.

  • item_type (pyvat.ItemType) – Type of the item being sold.

  • buyer (pyvat.Party) – Buyer.

  • seller (pyvat.Party) – Seller.

Returns:

The VAT charge to be applied to the sale of an item.

For more detailed documentation, see the full pyvat documentation.

Download files

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

Source Distribution

pyvat-1.3.1.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file pyvat-1.3.1.tar.gz.

File metadata

  • Download URL: pyvat-1.3.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyvat-1.3.1.tar.gz
Algorithm Hash digest
SHA256 99b963dc57852f051dc524c1cc9a6330ecae1e6cd37daf1f6d9eef9417e597c7
MD5 2475b823c1e1f3180d435a79b4e978c9
BLAKE2b-256 e1dade3c33685f42cf9f6231b68a3650f942514b3168680dd77bd92dc23daba7

See more details on using hashes here.

Release history Release notifications | RSS feed

1.3.18

1 file

1.3.17

2 files

1.3.16

2 files

1.3.15

2 files

1.3.14

2 files

1.3.13

2 files

1.3.11

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

This release

1.3.1 This release

1 file

1.3.0

1 file

1.2.0

1 file

1.1.4

1 file

1.1.3

1 file

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.1

1 file

1.0.0

1 file

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