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)
Metadata
Release files for cup-check 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cup_check-0.5.1.tar.gz | 42.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cup_check-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 58.3 kB
Release files / cup_check-0.5.1.tar.gz
| Download URL | cup_check-0.5.1.tar.gz |
|---|---|
| Size | 42.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b998678358ac672f325581d9d498066072f91dfb8f2c3c2e62ad026734e3cbbe
|
|
BLAKE2b-256 checksum How to use checksums |
a28edba2ebe5042ddca8495d351ff1a8b8ce64058410fcee62294d3d917b8d26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency logRelease files / cup_check-0.5.1-py3-none-any.whl
| Download URL | cup_check-0.5.1-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e84b82ed4e9a6cb22fca49e809ab1c92c485c556e08951c8edd272c57fdb2c08
|
|
BLAKE2b-256 checksum How to use checksums |
35247e7c8590fc3a978afda128ed89d4337068d714892af7af3f7cba32822da9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 21, 2026.
Transparency log