Skip to main content

Eurovat

A python library to get the vat right in the EU.

Features

  • fetch vat-rates from tedb
  • get the proper vat-rate
    • for cn-codes
    • for cpa-codes - UNTESTED/PARTIAL SUPPORT
    • for a given datetime (temporary vat-rates)
  • VIES validation
  • cn-code helpers

Planned features

  • fetch newest rates daily with gh-actions and submit automated PR's

Installation

just use pip:

pip install eurovat

Vat rates

you can query the vat-registry with the following arguments:

  • country
    • iso-code or eurovat.EUState object
  • cn-code
    • optional
    • get reduced rates for certain cn-codes
  • cpa-code
    • optional
    • get reduced rates for certain cpa-codes
  • date
    • optional
    • get temporary reduced rates for the given date
import eurovat
import datetime

registry = eurovat.VatRuleRegistry()
registry.date_begin = datetime.datetime(1970, 1, 1)

# This will try to write to vat_rules.json in the package directory
registry.update()

# This will update the in-memory database, all changes will be lost
registry.fetch()

# get a historic vat-rate

rate1 = registry.get_vat_rate("AT", "49020000", date=datetime.datetime(year=2019, month=10, day=5))
# rate1 = 10

rate2 = registry.get_vat_rate("AT", "49020000", date=datetime.datetime(year=2016, month=10, day=5))
# rate2 = 20

Update the registry

keep the registry up-to-date from time to time:

registry.update()

this will require write access to the package-file vat_rules.json. There are alternative storage locations available:

Filesystem cache

when writing to package data is not an option, you can use a custom cache-file:

import eurovat
import datetime

class Registry(eurovat.VatRuleRegistry):
    cache = eurovat.FilesystemCache("/tmp/vat_rules.json")
    date_begin = datetime.datetime(1970, 1, 1)


registry = Registry()
registry.update()

Django cache

This will use Django's cache backend to store vat-rules

import eurovat
import datetime

from eurovat.cache.django import DjangoCache


class Registry(eurovat.VatRuleRegistry):
    cache = DjangoCache("eurovat_rates")
    date_begin = datetime.datetime(1970, 1, 1)


registry = Registry()
registry.update()

Custom cache

You can use a custom cache too. Find an example in eurovat.cache.django

Metadata

Release files for eurovat 0.10.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 eurovat 0.10.1
File Size Uploaded Provenance
eurovat-0.10.1.tar.gz 115.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for eurovat 0.10.1
File Interpreter ABI Platform
eurovat-0.10.1-py3-none-any.whl Python 3 none any Details

Total release size: 235.6 kB

Release files / eurovat-0.10.1.tar.gz

Download URL eurovat-0.10.1.tar.gz
Size 115.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5370eba9b4cbb7ad27ea168e8763e0d8fee7fa18a3c37f986a85611a3d28ce47
BLAKE2b-256 checksum
How to use checksums
66919eb1e195ab5303ca64f4c2cf386f98fa56142ef45681e5f35e96066fa310
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / eurovat-0.10.1-py3-none-any.whl

Download URL eurovat-0.10.1-py3-none-any.whl
Size 120.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e4f374c77fc7b7632a862736a6f10677335bd5478a52d72bfbf3505ea219890
BLAKE2b-256 checksum
How to use checksums
31703d7be2908e3f6374d0f935b2eb753ead3de9ca0062216972c88f50c9a36a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Security for eurovat 0.10.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.

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