isorailkit
An independent developer toolkit derived from the ISO 20022 financial messaging standard.
isorailkit is stateless and works offline. It provides:
- Safe XML parsing. DTDs, external entities and entity expansion are rejected.
- Validation against the base ISO 20022 XSDs, or your own. A set of base schemas is bundled from
iso20022.org(src/isorailkit/schemas/iso20022_base/). You can add any other XSD at runtime, such as newer message versions or usage-guideline schemas you are licensed to use. Every message part is checked, including parts wrapped in an envelope. - Plain-English errors. Each problem comes back as a structured
ValidationIssuewith a readable XPath, line number and remediation hint. Rawlxmloutput never reaches you. - Pure-Python identifier checks. IBAN (ISO 7064 Mod-97 and registry lengths), BIC (ISO 9362), LEI (ISO 17442), UETR (UUIDv4) and ISO 4217 minor-unit precision.
- MT103 →
pacs.008.001.08translation. Every field that can't be carried over faithfully is reported. - A CLI with stable exit codes and clean
--jsonoutput.
It contains no web framework, no database and no market-infrastructure rules (CBPR+, SEPA, CHAPS, FedNow).
isorailkit is not affiliated with, endorsed by, or certified by ISO or SWIFT.
Documentation: Architecture covers the layers, the validation pipeline, the XML security model, the schema registry, the error contract and the release process.
Install
pip install isorailkit
Requires Python 3.11 or later. Runtime dependencies: lxml, typer, rich, pydantic.
CLI
isorailkit validate payment.xml # human-readable report
isorailkit validate payment.xml --json # ValidationResult as JSON
isorailkit validate - < payment.xml # read from stdin
isorailkit validate msg.xml --schema pacs.008.001.08 # force a schema by message ID
isorailkit validate msg.xml -S ./my-schemas # add your own XSDs (file or directory)
isorailkit schemas # list available message types
isorailkit check iban "DE89 3704 0044 0532 0130 00"
isorailkit translate mt103 mt103.txt -o pacs008.xml
| Exit code | Meaning |
|---|---|
0 |
Valid. Warnings may still be reported. |
1 |
Schema or semantic validation failed. |
2 |
The input could not be validated: unreadable file, malformed XML, a forbidden DTD, a non-ISO 20022 document, a message version with no available schema, or a supplied schema that cannot be loaded (SCHEMA_UNREADABLE / SCHEMA_INVALID). |
With --json, stdout contains exactly one JSON document and no Rich formatting.
Python API
from isorailkit import validate_file, translate_mt103, is_valid_iban
result = validate_file("payment.xml")
print(result.status) # "valid" | "invalid" | "error"
for issue in result.issues:
print(issue.code, issue.xpath, issue.line)
print(issue.message)
print("fix:", issue.remediation_hint)
is_valid_iban("GB82WEST12345698765432") # True
translation = translate_mt103(open("mt103.txt").read())
print(translation.xml)
for issue in translation.issues: # unmapped / truncated / lossy fields
print(issue.code, issue.message)
Example issue:
{
"code": "XSD_ENUMERATION",
"severity": "error",
"xpath": "/Document/FIToFICstmrCdtTrf/CdtTrfTxInf/ChrgBr",
"line": 34,
"message": "The value 'XXXX' of <ChrgBr> is not an allowed code. Allowed: DEBT, CRED, SHAR, SLEV.",
"remediation_hint": "Use one of DEBT (debtor pays all), CRED (creditor pays all), SHAR (shared) or SLEV (per service level).",
"part": "pacs.008.001.08"
}
Everything exported from isorailkit (see isorailkit.__all__) is part of the semantically versioned public API.
Bundled schemas
| Family | Versions |
|---|---|
| pacs.008 | 001.08, 001.14 |
| pacs.009 | 001.08, 001.13 |
| pacs.002 | 001.10, 001.16 |
| pacs.004 | 001.09, 001.15 |
| pain.001 | 001.09, 001.13 |
| pain.002 | 001.10, 001.15 |
| camt.053 | 001.08, 001.14 |
| camt.054 | 001.08, 001.14 |
| head.001 | 001.02 |
The schemas are discovered at runtime with importlib.resources, so dropping a new base XSD into iso20022_base/ is enough to support it. The test suite then requires a matching valid fixture for it.
Only freely redistributable base schemas are bundled. For anything else, supply the XSD yourself (see below).
Using your own schemas
In practice you'll need schemas that cannot ship with an open-source package: other message versions, market-infrastructure usage-guideline XSDs you are licensed to use, or your bank's own variants. Load them at runtime from local files. isorailkit never fetches schemas over the network.
isorailkit validate payment.xml --schema-path ./schemas/cbpr # a directory (scanned recursively)
isorailkit validate payment.xml -S pacs.008.001.10.xsd -S ./more # files and directories, repeatable
export ISORAILKIT_SCHEMA_PATH=./schemas/cbpr:./schemas/bank # ';' on Windows
isorailkit validate payment.xml --no-bundled -S ./schemas/cbpr # only your schemas
isorailkit schemas -S ./schemas/cbpr # shows where each schema comes from
--schema-path, --no-bundled and the environment variable work with validate, schemas and translate mt103.
from isorailkit import SchemaRegistry, validate_file
registry = SchemaRegistry(["./schemas/cbpr"]) # or SchemaRegistry.from_env([...])
result = validate_file("payment.xml", schemas=registry)
print(result.parts[0].schema_source) # "bundled" or the XSD's path
- Precedence. Your schemas override bundled ones with the same message ID. For example, a usage-guideline
pacs.008.001.08XSD replaces the base one. Among your paths, the first one that declares an ID wins, and--schema-pathentries come beforeISORAILKIT_SCHEMA_PATHentries. Two files in the same directory that declare the same ID are an error. - Discovery. A schema must have a
urn:iso:std:iso:20022:tech:xsd:<message id>target namespace and a global element (DocumentorAppHdr). While scanning a directory, files without one are treated as include/import fragments and skipped. - Includes and imports.
xs:includeandxs:importcan load local files inside the directory you supplied (for a single file, inside its directory). URLs, paths outside that directory (including through symlinks) and files with aDOCTYPEare refused. - Errors. A schema that cannot be loaded never raises a stack trace. You get a
SCHEMA_UNREADABLEorSCHEMA_INVALIDissue with exit code2. - Library default. The Python API never reads the environment variable unless you call
SchemaRegistry.from_env(). Withoutschemas=, validation uses the bundled set only.
MT103 translation
The translator is an independent mapping onto the base ISO pacs.008.001.08 schema. It is not an official SWIFT translation, and it applies no CBPR+ or other usage guidelines.
- Coverage: it handles header blocks 1–3 (sender and receiver BICs, priority, UETR) and every MT103 field: 13C, 20, 23B, 23E, 26T, 32A, 33B, 36, 50a, 51A, 52a–57a, 59a, 70, 71A, 71F, 71G, 72, 77B and 77T.
- Reporting: anything dropped, truncated or approximated is reported as
MT_FIELD_UNMAPPED,MT_FIELD_TRUNCATEDorMT_FIELD_LOSSY. - Output check: every output is validated against the bundled XSD.
Security
All XML, including bundled and user-supplied XSDs, goes through isorailkit.parser.xml_loader.create_safe_parser(). Any DOCTYPE is rejected before libxml2 sees the input. The parser carries a resolver that refuses every external load, and entity expansion and network access are disabled. User-supplied XSDs are the only exception: they get a sandboxed resolver that allows local includes and imports inside the directory you supplied.
Development
uv sync
uv run ruff check . && uv run ruff format --check .
uv run mypy src
uv run pytest
./scripts/verify_wheel.sh # build, then install in an isolated venv and smoke-test
CI runs all of these on every pull request: lint and type checks, tests on Python 3.11–3.14 on Linux plus macOS and Windows, and the wheel check. See the architecture document for how the pieces fit together.
Releasing
Releases are published to PyPI by GitHub Actions using Trusted Publishing, so no API tokens are stored.
- Bump the version in
pyproject.tomlandsrc/isorailkit/__init__.py, then runuv lock. - Merge to
mainwith CI green. - Publish a GitHub Release tagged
v<version>, for examplev0.2.0. The workflow:- runs the full CI gate;
- checks that the tag matches the package version;
- builds and verifies the wheel;
- uploads to TestPyPI;
- after a maintainer approves the
pypienvironment, uploads to PyPI.
License
Apache-2.0
Metadata
Release files for isorailkit 0.1.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 | Provenance | Actions |
|---|---|---|---|---|
| isorailkit-0.1.1.tar.gz | 179.4 kB | With provenance | Details for isorailkit-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| isorailkit-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for isorailkit-0.1.1-py3-none-any.whl |
Total release size: 356.5 kB
Release files / isorailkit-0.1.1.tar.gz
| Download URL | isorailkit-0.1.1.tar.gz |
|---|---|
| Size | 179.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecefdcda88d5377564bdbd8b530f900471ecccf29643104f4a4e92da8a2e0b28
|
|
BLAKE2b-256 checksum How to use checksums |
66162843bedd59eef1759c074eae47c130e937ce649128a8232e6006901c1464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 1, 2026.
Transparency logRelease files / isorailkit-0.1.1-py3-none-any.whl
| Download URL | isorailkit-0.1.1-py3-none-any.whl |
|---|---|
| Size | 177.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d9ac6c19d2ab02b2889d6d9b230f7627902d6104a90641ce1ac288300cdc476
|
|
BLAKE2b-256 checksum How to use checksums |
5c77d40b38c3b186a8586200842c2371245fcebe6d0d3acc07b914206d1ed1a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Dec 1, 2026.
Transparency logSecurity for isorailkit 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for isorailkit-0.1.1.tar.gz
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 Dec 1, 2026.
Transparency logA 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.