Skip to content

Dictionary auto-selection

laterite validates against the right AGS edition without you naming it. The edition is read from the file's TRAN_AGS row and resolved to a bundled dictionary (4.0.3 … 4.2). dict_for(path) reports the decision as a (version, reason) tuple so you can see why a file landed on a given edition.

# what this shows: enumerate the validator's numbered rules + report the dictionary edition a file resolves to.
import laterite

# list_rules() returns one rich dict per numbered rule (keys incl. rule/title/severity/fixable/...).
rules = laterite.list_rules()

# dict_for(path) resolves a file to its (version, reason) tuple — e.g. ('4.1.1', 'exact').
ver = laterite.dict_for("examples/sample_site.ags")

print(len(rules))
print(sorted(rules[0])[:6])
print(ver)

assert len(rules) >= 20 and isinstance(rules[0], dict)
assert isinstance(ver, tuple) and ver[0] == "4.1.1"
27
['checks', 'fixable', 'observations', 'rule', 'severity', 'title']
('4.1.1', 'exact')

The last line is the part to read here: dict_for("examples/sample_site.ags") returns ('4.1.1', 'exact'). The TRAN_AGS cell named 4.1.1, that matched a bundled edition exactly, so the reason is "exact" — validation will run against the 4.1.1 rules and dictionary.

When TRAN_AGS is missing, malformed, or names an edition laterite doesn't carry, the reason changes (a fallback to the nearest known edition rather than "exact") — so you always get a usable dictionary plus a record of how it was chosen.

Forcing an edition

Auto-selection is a default, not a cage. Pass dict_version= to pin validation to a specific edition regardless of the TRAN_AGS row — useful when a delivery mislabels its edition, or when you want to test a file against a newer spec:

laterite.read("delivery.ags").validate(dict_version="4.1.1")

One dictionary, many editions

All editions are projected from a single union dictionary at build time, so every bundled edition is available in-process — no download, no per-edition install. See Born-typed reads for how the same dictionary drives column typing.

See also: List the validator's rules · Validate