Skip to main content

cobol-parser

Python library for parsing IBM Enterprise COBOL source into an AST. Supports dependency extraction, dead code detection, program flow analysis, and CRUD matrices. 99.1% parse success on the NIST COBOL-85 corpus.

Python 3.11+ Tests Coverage License: Proprietary

Install

pip install -e ".[dev]"

Requires Python 3.11, 3.12, or 3.13.

Install the CLI globally (uv)

To get the cobol-parser command on your PATH in any directory, without setting up a project virtualenv:

uv tool install .            # from a clone of this repo
uv tool install --editable . # dev mode: picks up code changes without reinstalling

uv tool install builds the Cython fast-path extensions as part of the install, so the CLI runs at full speed. Verify it worked from anywhere:

cobol-parser --version

After pulling new commits (non-editable install only), rerun uv tool install . --reinstall to update.

Quick Start

from cobolparser import parse_cobol

result = parse_cobol(source, filename="prog.cbl")
if result.success:
    print(result.ast.program_name)
    print(result.ast.to_json())

CLI:

cobol-parser parse program.cbl
cobol-parser analyze program.cbl      # dynamic call analysis
cobol-parser dead-code program.cbl    # unreferenced paragraphs

Generate test data from a copybook

gen-data turns a copybook record layout into a CSV of synthetic records — one column per elementary field, values that always fit the field's PICTURE, USAGE, and level-88 domain:

cobol-parser gen-data CUSTOMER.cpy --rows 100 --seed 7 -o customers.csv
from cobolparser.generators import CopybookDataGenerator, DataGeneratorOptions

dataset = CopybookDataGenerator(
    DataGeneratorOptions(rows=100, seed=7)
).generate_from_file("CUSTOMER.cpy")
print(dataset.to_csv())

A seed makes output byte-identical across runs; omit it and the seed that was drawn is reported on dataset.seed (and by gen-data --describe) so any run can be replayed. REDEFINES and FILLER are excluded by default, and OCCURS tables expand to one column per occurrence.

Commands

# Tests
python -m pytest tests/ -v
python -m pytest --cov=cobolparser --cov-report=html

# Lint / format / type-check
ruff check .
black .
mypy cobolparser/

Documentation

Full reference: .okf/index.md

License

Proprietary — Copyright © 2026 Samuel Dion. All rights reserved. See LICENSE.

Metadata

Release files for cobol-parser 1.8.4

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

Built distributions (wheels)

Table of built distributions (wheels) for cobol-parser 1.8.4
File
cobol_parser-1.8.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
cobol_parser-1.8.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
cobol_parser-1.8.4-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
cobol_parser-1.8.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
cobol_parser-1.8.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
cobol_parser-1.8.4-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
cobol_parser-1.8.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
cobol_parser-1.8.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
cobol_parser-1.8.4-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 189.9 MB

Release files / cobol_parser-1.8.4-cp313-cp313-win_amd64.whl

Download URL cobol_parser-1.8.4-cp313-cp313-win_amd64.whl
Size 6.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b9972d74a8bb1485d591f99328d53c42c9d1f05e034128ba803557a570ea6f66
BLAKE2b-256 checksum
How to use checksums
cef3d40504a5003eafc20d026c3dca06570107ffec84e6ea9a530a22ec0f9871
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cobol_parser-1.8.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 48.6 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
d3f1ca366bfde43bb360ce307c3765a9658a26472530fec29380d17378ca7304
BLAKE2b-256 checksum
How to use checksums
5e428370a8772fcc6e46ce1e23aa999f960cb92f7a7e56fec2170fc67d105fec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp313-cp313-macosx_11_0_arm64.whl

Download URL cobol_parser-1.8.4-cp313-cp313-macosx_11_0_arm64.whl
Size 7.5 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
295d2844f4998cb5f6cec2c682a8d1a2f683779082f5babde83dbe25ecdfd9fa
BLAKE2b-256 checksum
How to use checksums
9790603c8bf0d3f20b88b8db52efd61ba6b0e3f04662de674935e6b6cd1948b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp312-cp312-win_amd64.whl

Download URL cobol_parser-1.8.4-cp312-cp312-win_amd64.whl
Size 6.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
2b956ea057e113c14a0089ebe7e3650512b0abd802aeb1a5722c741a4e4931cb
BLAKE2b-256 checksum
How to use checksums
14d75c16ada9d547fff54e7716d65768f8162b08d4611af0ae1ed9b0763c8470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cobol_parser-1.8.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 49.5 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3525b51a35156170efc1f2148e157341cb0911e45d02c48b8e2333f5484fd729
BLAKE2b-256 checksum
How to use checksums
fa7e1ef4520f7ff7cd631ecd814ecacfc5dfe4771e147446400351db35031568
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp312-cp312-macosx_11_0_arm64.whl

Download URL cobol_parser-1.8.4-cp312-cp312-macosx_11_0_arm64.whl
Size 7.6 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
da23c55f0a732f69e9057c25e25f343842d908f7f9ba445a22115b8730e43284
BLAKE2b-256 checksum
How to use checksums
bc8a116eeb9106b771afa96b9524229fdd90bedc3cc9db8d8b8c2666d08314a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp311-cp311-win_amd64.whl

Download URL cobol_parser-1.8.4-cp311-cp311-win_amd64.whl
Size 6.7 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
c9b7eed57cd739e6b1783c6991975b88a67c31e76f6cc23014c417f17c81c15e
BLAKE2b-256 checksum
How to use checksums
c3dd84dfab5dc0218b050dc53b473f01ec704f14a547fff84e21f81060db6fbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL cobol_parser-1.8.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 49.6 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4b6a7c8ef156bafb8b5e6a347ced201cf86eabd224bf810fa648544b9c8951d5
BLAKE2b-256 checksum
How to use checksums
567cfcb5b82ea88932365ae65b21e4157a94caebeaaf6fa6f3d3a6fb642048a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release files / cobol_parser-1.8.4-cp311-cp311-macosx_11_0_arm64.whl

Download URL cobol_parser-1.8.4-cp311-cp311-macosx_11_0_arm64.whl
Size 7.5 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
6ab3aa4572cb828b9e2f100c0c3710f8b2f0e74b4402a16b7a32f0c70a9a997f
BLAKE2b-256 checksum
How to use checksums
da9537fa2ca47130cda7f328444394eca544aa927c80ca2bbe49781c07842e95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 1, 2026.

Transparency log

Release history Release notifications | RSS feed

3.1.0

10 release files

3.0.0

10 release files

2.0.1

10 release files

2.0.0

10 release files

This release

1.8.4 This release

9 release files

1.8.2

9 release files

1.8.0

9 release files

1.7.8

9 release files

1.7.7

9 release files

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