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

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

Total release size: 189.8 MB

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

Download URL cobol_parser-1.8.2-cp313-cp313-win_amd64.whl
Size 6.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
d5f5bf2319ed0b35b61886bc9ee7d427d5d4b66f6d04b408efe91535d7e7558c
BLAKE2b-256 checksum
How to use checksums
10ff58d3fe18ddeb92be0afb57ae9cb0c5591bad4cbcb47a58c7779c05269fa8
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-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
9f7f6b7aa7f9bb2bcf613788863b689ef16acd2e5a813dde1167604581878515
BLAKE2b-256 checksum
How to use checksums
ab5550952526f49fb4cccbdb6990f80f6278663d44627606510c41204f6508ff
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-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
74771fef2f949c6d4b5058d1fca607bc654b190f80a8442ac11431d713307955
BLAKE2b-256 checksum
How to use checksums
8d111926f8815136c120fa2d158daf5e38eed99d498c76fcc6b6f9dc538b9076
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-cp312-cp312-win_amd64.whl
Size 6.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
8405bcfc3151226c4516400ef42ec0e87d0d993dfefb1c39c4b81e6b350b1ba1
BLAKE2b-256 checksum
How to use checksums
1f98458f915720a33d63261dcd51c48d32f4dd2b144f892319003ee5296d0f9b
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-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
0d122c290eca4c4634b43f170abfa4574ee8f7b59674d5889880249588ec59f6
BLAKE2b-256 checksum
How to use checksums
c2d1251ef38b6bb11a0292f1a1b18d7531b497e1ba17c774e56595fe54c6c5ae
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-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
0f7807855be8ef5836d62904176e69711511b6f3052a7818ee041c170bdea08e
BLAKE2b-256 checksum
How to use checksums
ad8813e8ec80dcd3c4486a105f7e9571eb708e0fb12c5400858411827daac90e
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-cp311-cp311-win_amd64.whl
Size 6.7 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
b006f1d794113e46e018d4bc4dce1f6dd54748c28800c3019adda48c8bff8391
BLAKE2b-256 checksum
How to use checksums
c98e8de97417642c9acdcc481b43c1f1ce42a5e8c6eb4b89d0b67f9a772ac679
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 49.5 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
1a33c086410697d8113b8596bacee193ab9fd5219fdf34bf8f44982a91fcac23
BLAKE2b-256 checksum
How to use checksums
046413ab452e8b7f4301fdf6a7c4e27a3bc4fe9f5ee6f283d627952b40bf6a81
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 30, 2026.

Transparency log

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

Download URL cobol_parser-1.8.2-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
28f182eac516f34ffd44cdee482785636427b8ebb0717e0f9d8d428938acd73e
BLAKE2b-256 checksum
How to use checksums
cc48e5db9bec926adb1f208ea453146c47c9a064afb5b94adb69036ffcbad39d
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 30, 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

This release

1.8.2 This release

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