Skip to main content

Validazione formale locale dei Codici Unici di Progetto (CUP).

Project description

cup-check

Libreria Python per validare localmente il formato dei Codici Unici di Progetto (CUP).

La verifica è solo formale: un CUP con formato valido viene restituito come FORMATO_VALIDO_DA_VERIFICARE, non come CUP esistente.

Requirements

  • Python 3.12 o versioni successive.
from cup_check import validate_format

result = validate_format("G17H03000130001")

print(result.outcome)
print(result.failed_rules)

Per validare più valori:

from cup_check import validate_many

results = validate_many(["G17H03000130001", "117H03000130001"])

Da 0.3.0, il package include anche il contratto tipizzato per leggere il dataset-manifest.json delle release OpenCUP self-hosted:

from cup_check import load_dataset_manifest

manifest = load_dataset_manifest("dataset-manifest.json")
print(manifest.dataset_tag)
print(manifest.chunks.files)

Per verificare la presenza nel perimetro OpenCUP con un indice SQLite locale:

from cup_check import OpenCupChecker

with OpenCupChecker.from_manifest(
    "dataset-manifest.json",
    sqlite_path="cup-index.sqlite",
) as checker:
    result = checker.check("G17H03000130001")

print(result.outcome)

Per usare l'ultimo dataset pubblicato con cache locale:

from cup_check import OpenCupChecker

checker = OpenCupChecker.from_latest(cache_dir=".cup-check-cache")
result = checker.check("G17H03000130001")

Se il dataset non è disponibile, il checker resta cautelativo e restituisce FORMATO_VALIDO_DA_VERIFICARE per i CUP formalmente validi.

Logging

La libreria usa logger nel namespace cup_check e non configura handler o livelli globali. Le applicazioni chiamanti possono governare la verbosità con il logging standard di Python:

import logging

logging.getLogger("cup_check").setLevel(logging.INFO)

Project details


Download files

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

Source Distribution

cup_check-0.4.1.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cup_check-0.4.1-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file cup_check-0.4.1.tar.gz.

File metadata

  • Download URL: cup_check-0.4.1.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cup_check-0.4.1.tar.gz
Algorithm Hash digest
SHA256 42dd220f1d76b0d3a782f541e27467811730e6579c02d8a8c84f3178238cddd1
MD5 f42f9d4cfcf8abe00382df3df64d9ff9
BLAKE2b-256 2bb93f12f2f672a7ef01d7ca299575d0d820e9d6caa015215e4beced022bf475

See more details on using hashes here.

Provenance

The following attestation bundles were made for cup_check-0.4.1.tar.gz:

Publisher: release-python.yml on ale-saglia/cup-check

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cup_check-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: cup_check-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cup_check-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14e9457226ef3f86d64ed7704df4fd43d9c2c29b6bb3a3ac4fdab7033d6df03f
MD5 e6d18863e98cfd0a9511fbd5b64298ae
BLAKE2b-256 d8a972b9e85ca17f2be4c4beb609bf1ba34ce76fc8b4adaeb57742ea26d39d6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for cup_check-0.4.1-py3-none-any.whl:

Publisher: release-python.yml on ale-saglia/cup-check

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page