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

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

Total release size: 180.5 MB

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

Download URL cobol_parser-1.8.0-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
07bd50a48e74417b059c07a925b54044403afd1419c29b3ab18f7bc6c61192f4
BLAKE2b-256 checksum
How to use checksums
cbc99a686f6ef63d7a187ba4f85fbe29dbd76d488b9f043fee33e1309228e754
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 46.4 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6e8203aba8e35746c34041e64d03311e68433a14d9a3b38333c8fb52b4b17c05
BLAKE2b-256 checksum
How to use checksums
4b91d8527ee5904772bc0cea3f37727635ea30942b2976b1d4ac682d230ed028
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp313-cp313-macosx_11_0_arm64.whl
Size 6.9 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
76653644b7c99a6352cf8f6d7cd1bac7c17b8a93d6a2b0d7ea416cb9f6f56d1e
BLAKE2b-256 checksum
How to use checksums
e9a656ff8f148a1fd6a4e4db4b873b3bb1ff5a13df6a9e7e5c984288bb6a1c93
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp312-cp312-win_amd64.whl
Size 6.1 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
bbef193ea0083fb00cf3913379761da8ed4c4b58cf3e172b57dfd06c4a9acc25
BLAKE2b-256 checksum
How to use checksums
c737075fa18daf54d131923e431a8d76adf877d4b97c6e89ec3bc00b37c9c6e3
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 47.3 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ffcf6ddd089823db9cedc804e7459666155217ba39ae8ea8ec41a1da1efde158
BLAKE2b-256 checksum
How to use checksums
55f01eafc4870f49332ae6150ca6b6184ee2507c562fdda14c2223a0d859e8e6
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp312-cp312-macosx_11_0_arm64.whl
Size 7.0 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
86e36c07e0fb720c2ae7b32f69eb2766ebe6d49681a23a047f42aeb73eadc5ae
BLAKE2b-256 checksum
How to use checksums
74a58a422c62bb2f2b14eabec5324b5c8100409edf221f935e3dbc8d94f55e13
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp311-cp311-win_amd64.whl
Size 6.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2b892fb74872502f16dd27484e2ce0631316b35a00da4c8784f01ddfb237d564
BLAKE2b-256 checksum
How to use checksums
6c6556bf3be5c74abae925678ed5f8c4bb8c1c30cc9083ecd55d1eb0df352068
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 47.3 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e78d5cf6e5f7d8a25003af8a0e1d4cadbbe4ba3ad8fc409e7ff254423814b299
BLAKE2b-256 checksum
How to use checksums
623e486d3bc7ae733a20f5bb1544346369b8f9bb71d5ed71a560c1b326dccba3
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 20, 2026.

Transparency log

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

Download URL cobol_parser-1.8.0-cp311-cp311-macosx_11_0_arm64.whl
Size 7.0 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
64afcc29a27e7da6bcee6fb4a079a822e403d02f66b19c328170b6870c201979
BLAKE2b-256 checksum
How to use checksums
178fbe3c77f2fe0c1bfa4afe77bad2e3f112be823bf68fd8f7cf80e181a57e6d
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 20, 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

This release

1.8.0 This release

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