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
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.
- docs/supported-constructs.md — the full construct matrix
- docs/dsl-spec.md — the DSL schema, field by field
- docs/mapping-rules.md — every Go/Java mapping rule and rationale
- docs/diagnostics.md — every diagnostic code and how to fix it
- docs/cli.md / docs/mcp.md — every command/tool
- docs/performance.md — estimated vs. measured, never mixed
- docs/limitations.md — what doesn't work yet
- CONTRIBUTING.md · LICENSE (Apache-2.0)
Metadata
Release files for unbolt 0.2.0
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 |
|---|---|---|---|---|
| unbolt-0.2.0.tar.gz | 1.3 MB | Without provenance | Details for unbolt-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unbolt-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for unbolt-0.2.0-py3-none-any.whl |
Total release size: 1.4 MB
Release files / unbolt-0.2.0.tar.gz
| Download URL | unbolt-0.2.0.tar.gz |
|---|---|
| Size | 1.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0613356caca87bd20d6c31d05f977758b6fe331c27525f94139927bdcd24760
|
|
BLAKE2b-256 checksum How to use checksums |
1d41f0ad36427e9c00448f17de5b3f062564608d771b484f1a6ec434ffe9798b
|
| 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.2.0-py3-none-any.whl
| Download URL | unbolt-0.2.0-py3-none-any.whl |
|---|---|
| Size | 101.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad3433cd3a54dfae0dd6de3497e9c51a258cbfe2bb64fc1b501d286a06c1a15a
|
|
BLAKE2b-256 checksum How to use checksums |
a9ae394f29aa9c1d393c1f40ee93da2bfaa8a6f041271b488fe8f8a0c4b35b44
|
| 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.2.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.
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.