Skip to main content
unbolt

Tests License

Turn COBOL copybooks into a versioned, language-independent DSL, explain every Go/Java type choice, and generate traceable code — as a pure-Python package, a CLI, and an MCP server.

Mainframe data definitions are hard to reuse in modern services. Teams hand-translate copybooks and lose information: numeric ranges, decimal scale, packed/binary storage, signedness, nesting, overlays (REDEFINES). unbolt parses a copybook into an immutable DSL, recommends valid Go and Java types with a written reason for every candidate, and generates deterministic code with full traceability back to the source line.

30-second demo

unbolt parsing a copybook, recommending a Go type with its rationale, generating code, and tracing the decision — a real terminal recording, not a mockup

The same copybook in text, for anyone who'd rather read than watch:

$ cat account.cpy
01  CUSTOMER-RECORD.
    05  CUSTOMER-ID         PIC 9(6).
    05  CUSTOMER-AGE        PIC S9(3).
    05  ACCOUNT-BALANCE     PIC S9(7)V99.

$ unbolt generate account.cpy --target go -o out/
wrote out/gen.go
// out/gen.go
type CustomerRecord struct {
	CustomerId     int32
	CustomerAge    int16
	AccountBalance int64
}

func ValidateAccountBalance(v int64) error {
	if v < -999999999 || v > 999999999 {
		return fmt.Errorf("ACCOUNT-BALANCE: %v outside -999999999..999999999", v)
	}
	return nil
}

Why ACCOUNT-BALANCE (PIC S9(7)V99) became int64, not float64: unbolt report account.cpy --target go says exactly why —

unscaled value fits int64 (-999999999.00..999999999.00); caller divides by 10^2 (decision 0002)

A float would silently lose cents on arithmetic; unbolt never defaults decimal/packed fields to floating point, and the report always says why a field got the type it got, not just what the type is.

Install

pip install unbolt
pip install "unbolt[mcp]"   # adds the MCP server

Quickstart

Library

from unbolt.parser import parse_copybook
from unbolt.dsl import build_dsl
from unbolt.mapping import recommend_mappings
from unbolt.generators import generate_code

source = open("account.cpy").read()
dsl = build_dsl(parse_copybook(source), source_file="account.cpy")
mapping = recommend_mappings(dsl, "go")
files = generate_code(dsl, mapping, "go")  # {"gen.go": "..."}

A full runnable version, including the validation and traceability report, is in examples/quickstart.py.

CLI

unbolt parse account.cpy                        # diagnostics
unbolt recommend account.cpy --target go         # every candidate + why
unbolt generate account.cpy --target go -o out/  # write the code
unbolt report account.cpy --target go            # full traceability report

See docs/cli.md for every command and flag.

MCP

pip install "unbolt[mcp]"
unbolt mcp   # stdio transport - copybooks never leave your machine
{
  "mcpServers": {
    "unbolt": {
      "command": "uvx",
      "args": ["unbolt[mcp]", "mcp"]
    }
  }
}

See docs/mcp.md for every tool's params/returns/errors.

Supported / not supported

Supported Levels 01-49/77, PIC (numeric + alphanumeric), DISPLAY/COMP/COMP-3/COMP-4/COMP-5/COMP-1/COMP-2, OCCURS n, REDEFINES, SIGN SEPARATE
Diagnostic (reported, not converted) Level 66 (RENAMES), OCCURS ... DEPENDING ON, COPY ... REPLACING, edited pictures (Z, *, $, ...)
Unsupported PIC N/G (national/DBCS)

Full matrix: docs/supported-constructs.md.

How it works

copybook text → parser → AST + diagnostics → DSL (immutable source facts)
                                              │
                    rules + overrides ────────┤→ mapping candidates + rationale
                                              │
                                              └→ generators → Go / Java + validators
                                                     └→ report (field ↔ source line ↔ rule)

Docs

Full index: docs/index.md.

Metadata

Release files for unbolt 0.1.1

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

Source distribution (sdist)

Source distribution for unbolt 0.1.1
File Size Uploaded Provenance Actions
unbolt-0.1.1.tar.gz 1.1 MB Without provenance Details for unbolt-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 1.2 MB

Release files / unbolt-0.1.1.tar.gz

Download URL unbolt-0.1.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
16d6f014a1663dfc56b16c913bd2021ddf25a6e9ee281bd0787fee5e8b30fae8
BLAKE2b-256 checksum
How to use checksums
44fdea93cf036a556964c0d5dec3bf643bc92f07f65047cef35382a6c65d1b0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / unbolt-0.1.1-py3-none-any.whl

Download URL unbolt-0.1.1-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04be2e0d555f725e212267969132a4c3e83c5a13fd279d0a5f713408e8242c6a
BLAKE2b-256 checksum
How to use checksums
9bafecc6f5fce366af8d79feb7df7a3b3b48eec83be65ebfffd1bb2b6dce3359
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for unbolt 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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