Skip to main content

isorailkit

CI PyPI Python versions

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 ValidationIssue with a readable XPath, line number and remediation hint. Raw lxml output 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.08 translation. Every field that can't be carried over faithfully is reported.
  • A CLI with stable exit codes and clean --json output.

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.08 XSD replaces the base one. Among your paths, the first one that declares an ID wins, and --schema-path entries come before ISORAILKIT_SCHEMA_PATH entries. 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 (Document or AppHdr). While scanning a directory, files without one are treated as include/import fragments and skipped.
  • Includes and imports. xs:include and xs:import can 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 a DOCTYPE are refused.
  • Errors. A schema that cannot be loaded never raises a stack trace. You get a SCHEMA_UNREADABLE or SCHEMA_INVALID issue with exit code 2.
  • Library default. The Python API never reads the environment variable unless you call SchemaRegistry.from_env(). Without schemas=, 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_TRUNCATED or MT_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.

  1. Bump the version in pyproject.toml and src/isorailkit/__init__.py, then run uv lock.
  2. Merge to main with CI green.
  3. Publish a GitHub Release tagged v<version>, for example v0.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 pypi environment, uploads to PyPI.

License

Apache-2.0

Metadata

Release files for isorailkit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for isorailkit 0.1.0
File Size Uploaded Provenance Actions
isorailkit-0.1.0.tar.gz 178.6 kB With provenance Details for isorailkit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for isorailkit 0.1.0
File Interpreter ABI Platform Actions
isorailkit-0.1.0-py3-none-any.whl Python 3 none any Details for isorailkit-0.1.0-py3-none-any.whl

Total release size: 355.6 kB

Release files / isorailkit-0.1.0.tar.gz

Download URL isorailkit-0.1.0.tar.gz
Size 178.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f64a0177bb9d1f6dcd67bd4957c49ecb407deb250481525e670eca2f8cb66a34
BLAKE2b-256 checksum
How to use checksums
6805d50a9a4f08510ceb21b15495d92c591d0c72a577b561cf048ba8aedce72a
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 Nov 30, 2026.

Transparency log

Release files / isorailkit-0.1.0-py3-none-any.whl

Download URL isorailkit-0.1.0-py3-none-any.whl
Size 176.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4557d6111d21e3ca56a91a314013f4d03e252f63f7e26fd4b16f85ce3327a43a
BLAKE2b-256 checksum
How to use checksums
d86765b7e46548879f13901f1551b9f381e70c046229f7f7a704077456f3d1ac
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 Nov 30, 2026.

Transparency log

Security for isorailkit 0.1.0

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.

Select from 2 files

Attestation for isorailkit-0.1.0.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 Nov 30, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page