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

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.7.7
File
cobol_parser-1.7.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
cobol_parser-1.7.7-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.7.7-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
cobol_parser-1.7.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
cobol_parser-1.7.7-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.7.7-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
cobol_parser-1.7.7-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
cobol_parser-1.7.7-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.7.7-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 172.5 MB

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

Download URL cobol_parser-1.7.7-cp313-cp313-win_amd64.whl
Size 5.8 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
0d32abae89a50ba57ae85a994b79a52472353127a324dd10c39c918417cc241a
BLAKE2b-256 checksum
How to use checksums
9d19c801bd02a526e8f297329a4b00e2ef692e2cc46f4a59b11bef4af61ad521
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 44.3 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
da9c144388c4da6c2006ccec45809fdf9492be8ac534ad6d970c0b6fbafcb4a5
BLAKE2b-256 checksum
How to use checksums
2d4681bfde2e9ee9bb305a6268780bd03e025fed63efb6962110e14af85015c1
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp313-cp313-macosx_11_0_arm64.whl
Size 6.6 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1c9d1e2abac69ac8ba7f76d725d12c5a54d550307ad880a2576f12fbf4c52c3e
BLAKE2b-256 checksum
How to use checksums
df923f5dc19bd7a27f547b49aab635ab6dab3b2ed35f33f31b52f609ae2f649c
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp312-cp312-win_amd64.whl
Size 5.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
bb719f79701a137bcb0615e2bf9c993649f74f7e8e74341d3ca8e41b10e1d604
BLAKE2b-256 checksum
How to use checksums
30dcb9ed54d6568f66919682779e4795fc12104e1a768a013693244a65810a6e
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 45.2 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
0048d9b9f05426bab393b61510ed0cf33eb142107108bbc12a82224d025a6502
BLAKE2b-256 checksum
How to use checksums
6f656a2c1d290253ac06e1881e76301addfe1c45855eb944cb07a985151f8ec7
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp312-cp312-macosx_11_0_arm64.whl
Size 6.7 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7426ece441056492fd924ff2d6088ec1caa17bbc2ab751cb6bd5c8067eb8f9ad
BLAKE2b-256 checksum
How to use checksums
7562b7472d5a8447086773c8eda633e5d351f22db66713ba8007f6b4bb013a16
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp311-cp311-win_amd64.whl
Size 6.1 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
0cef41514ba75b139cd5dd88897612bd83761648913c1d07d384b4ec649542c1
BLAKE2b-256 checksum
How to use checksums
42bbc58fcfcf46128986831e54703cfd513e3913086703309789bce036d9e89b
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 45.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
bbe038e1950e49d9b6a515695cb815b4636cb66c9f38be814ef1fbfb33ac3180
BLAKE2b-256 checksum
How to use checksums
2f6c101e22179118f0896a3a3d4ff0ce725176147c45ad7f500b949e0fef133a
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 Aug 16, 2026.

Transparency log

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

Download URL cobol_parser-1.7.7-cp311-cp311-macosx_11_0_arm64.whl
Size 6.7 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
24716cd5b02561996cc7ef37eae5ffe6a9d8881bfa241660c7729b6492fdbaea
BLAKE2b-256 checksum
How to use checksums
41eb88fce63753f956427e7bafa748089afa7da504fa622f11f14218e716aa85
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 Aug 16, 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

1.8.4

9 release files

1.8.2

9 release files

1.8.0

9 release files

1.7.8

9 release files

This release

1.7.7 This release

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