Metadata-Version: 2.4
Name: cabal-file-parser
Version: 0.1.0
Summary: Zero-dependency parser for Haskell .cabal files: top-level fields, build stanzas (library/executable/test-suite) and build-depends as clean package names.
Project-URL: Homepage, https://coldwa.st
Project-URL: Documentation, https://coldwa.st
Author: Eric Gerard
License: MIT
License-File: LICENSE
Keywords: build-depends,cabal,ghc,haskell,package,parser,tooling
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# cabal-file-parser

A tiny, dependency-free Python parser for Haskell **`.cabal`** package files.
It reads the top-level fields (name, version, license, …) and the build stanzas
(`library`, `executable NAME`, `test-suite NAME`, `benchmark NAME`, `common`),
and turns `build-depends` into a clean list of package names — handy for CI,
dashboards, dependency audits and metadata tooling.

## Install

```
pip install cabal-file-parser
```

## CLI

```
cabal-file-parser mypackage.cabal
```

Prints a JSON summary: `name`, `version`, all fields, every stanza, and a
de-duplicated `all_dependencies` list.

## Library

```python
from cabal_file_parser import parse_cabal, dependency_names

pkg = parse_cabal(open("mypackage.cabal").read())
print(pkg.name, pkg.version)
for s in pkg.stanzas:
    print(s.kind, s.name, dependency_names(s.fields.get("build-depends", "")))
```

`dependency_names("base >=4.7 && <5, text")` → `["base", "text"]`.

> A pragmatic parser for tooling/metadata, not a full Cabal grammar.

## More Haskell & toolchain guides

Clear, independent guides on Haskell, Cabal and the developer toolchain:
**[coldwa.st](https://coldwa.st)**.

## License

MIT
