Repository navigation
Release 1.15.0 #513
AngusHsu
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Added
Add generated country metadata, failure-reason and input-format guides, executed and strictly typed documentation
examples, and contributor/country workflow templates
(#328).
Add primary-only
normalize_id(),format_id()andget_input_mask()with frozenInputMaskresults.Metadata-driven formatting checks length, not validity; input patterns use ASCII uppercase letters/digits.
Swedish formatting preserves a significant
+in both 10-digit and 12-digit forms; preferred mask patternsremain literal minus layouts. Greece's primary metadata example now uses already-accepted Latin letters;
Greek validation and formatting remain unchanged (#321).
Add
failure_reason(id_class, id_number)for primary and secondary ID types. Unified validation and parsing nowreport best-effort length, format, checksum and embedded-calendar-date reasons; inconclusive checks and exceptions
retain
VALIDATION_FAILED. Date tracing is isolated between nested calls, threads and async tasks, and countryvalidity, parser and checksum behavior is unchanged (#322).
Add
idnumbers.parse_id_info(country, id_number)for a country's primaryNationalID, returning the frozenParseSuccess/ParseFailureunionParseIdInfoResult. Theokdiscriminator supports strict type narrowing;success includes a fresh dictionary of the country parser's information. Lookup and validation failures match
validate(), while valid IDs without extractable information giveNOT_PARSABLE. Country parsers are unchanged(#319).
Add a country registry,
idnumbers.registry, which is re-exported fromidnumbers.get_validator('tw'),get_country('TWN')andresolve_country('tw')find theNationalIDclass, aCountryEntry(alpha-3 and alpha-2code, name,
NationalIDand all ID types) or the alpha-3 code of a country by its alpha-2 or alpha-3 code in anyletter case, and give
Nonefor anything unknown instead of raising.list_supported_countries()lists the 78countries, and
register()adds a custom country. The names are the English names of Unicode CLDR 48.2.3. AUS andGRC keep their current
NationalID, and a country module is imported on the first lookup of its country(#318).
Add
idnumbers.validate(country, id_number), which validates an ID number of any supported country and returns afrozen
ValidationResultwithis_valid, the alpha-3country_code, theid_number, theextracted_infoof avalid ID number (the
parse()result,Nonewhen the ID type isn't parsable), areasonand anerror_message. Itnever raises, and a result is truthy when it is valid. An unknown country gives the reason
unsupported_country,other failures a best-effort diagnostic reason.
validate_many()validates(country, id_number)pairs, andFailureReasonlists the reasons, which later releases may extend. The country classes are unchanged(#317).
Describe every ID class with seven more
METADATAkeys:country_name,id_type,official_name(Nonefor anID with no local-language name),
display_format,example(a synthetic number the class validates),checksum_algorithm(Nonewithout a check digit) andmasks, the layouts the class accepts.METADATAis now anIdMetadata, a typedSimpleNamespacesubclass inidnumbers.nationalid.metadata, so attribute access,vars(),copy()andgetattr()work as before. A class made byalias_of, such asAUS.NationalID, now has the name,module and docstring of its target instead of
AliasType, which changes itsrepr.CAN.SocialInsuranceNumbergets the
deprecatedkey the other classes already had, andtools.scan_idslists the classes through the countryregistry (#320).
Changed
Ship the PEP 561
py.typedmarker, so type checkers use the package's annotations, and correct the annotationsthat disagreed with the runtime values: the
CHECK_DIGITalias, the untypednormalizeandchecksumhelpers,the COL and KAZ
checksummethods that returnFalsefor malformed input, the AUS TFN and KWT civil-numberchecksummethods, which can return 10, and the LTUextract_year_base_genderresult, which is neverNone(#325).
Move the build metadata from
setup.pyto a PEP 621pyproject.toml. The license is now the SPDX expressionMITinstead of the deprecated license classifier (#465), and
building from source needs setuptools 77 or later, which pip and uv install automatically
(#325).
CI type-checks the package with strict mypy for Python 3.9 and checks the built distributions with
twine check --strict(#325).Re-export the ID classes explicitly (
import X as X) from the country modules such asAUS, so strict typecheckers (mypy
--strict, which disallows implicit re-exports) acceptfrom idnumbers.nationalid.AUS import MedicareNumberandAUS.MedicareNumber; nothing changes at runtime(#326).
Prepare isolated, guarded PyPI publication and opt-in Trusted Publishing with attestations; retain the working
default token route and existing secrets. External publisher setup and the first verified trusted release remain
pending maintainer action. Document release ordering and 1.14.0-to-1.15.0 migration
(#327).
Add dev-only Hypothesis checks of arbitrary Unicode inputs for every registered ID type, metadata method
contracts, out-of-range lengths and checksum mutations, with explicit synthetic witnesses for checksum limits
(#324).
CI lints with ruff, enforces a 97% line-and-branch coverage floor, runs the README Python examples and
informational benchmarks, keeps GitHub Actions updated with Dependabot, and reports a single
ci-summaryresult(#326). Formatting with
ruff formatand a coverage badgeawait a decision in #485.
Vendor the Node port's parity corpus (78 countries, 17,960 vectors) at a pinned port commit and record Python's own
validity for it, so a validity change on any shared vector fails a test and gets a port note;
scripts/sync_parity_corpus.pyrefreshes both (#323).This discussion was created from the release Release 1.15.0.
All reactions