# kevincrrl/pkgbuild_parser architecture

> Architecture diagram of the GitHub repository kevincrrl/pkgbuild_parser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kevincrrl/pkgbuild_parser
- Repository: https://github.com/kevincrrl/pkgbuild_parser

## Overview

pkgbuild_parser is a dependency-free Python library for extracting basic fields from PKGBUILD files. A caller constructs a Parser, which reads and interprets the file; its getters expose package metadata, including architecture-specific values and variable substitution. InfoDict collects selected fields and can serialize them to JSON or write a JSON file. The core and public API excerpts show these runtime responsibilities; broader field coverage is documented in the README.

Main entry points: [`pkgbuild_parser/parser_core.py`](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/parser_core.py) (PKGBUILD reader), [`pkgbuild_parser/pkgbuild_parser.py`](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py) (InfoDict builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Public API"]
  node_parser["Parser getters<br/>[pkgbuild_parser.py]"]
end

subgraph group_engine["Parsing engine"]
  node_core["PKGBUILD reader<br/>[parser_core.py]"]
  node_substitution["Variable substitution<br/>[parser_core.py]"]
end

subgraph group_export["Info export"]
  node_infodict["InfoDict builder<br/>[pkgbuild_parser.py]"]
  node_json["JSON output<br/>[pkgbuild_parser.py]"]
end

node_caller(("Library caller"))
node_pkgbuild["PKGBUILD input"]
node_jsonfile["JSON file"]

node_caller -->|"constructs and queries"| node_parser
node_pkgbuild -->|"provides input"| node_core
node_parser -->|"inherits and delegates"| node_core
node_core -->|"processes variables"| node_substitution
node_caller -->|"selects fields"| node_infodict
node_infodict -->|"requests values"| node_core
node_infodict -->|"serializes dictionary"| node_json
node_json -->|"writes JSON"| node_jsonfile

click node_parser "https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py"
click node_core "https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/parser_core.py"
click node_substitution "https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/parser_core.py"
click node_infodict "https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py"
click node_json "https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_parser toneBlue
class node_core,node_substitution toneAmber
class node_infodict,node_json toneMint
class node_caller,node_pkgbuild,node_jsonfile toneIndigo
```

## Components

### Public API

- [Parser getters](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py): `pkgbuild_parser/pkgbuild_parser.py`

### Parsing engine

- [PKGBUILD reader](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/parser_core.py): `pkgbuild_parser/parser_core.py`
- [Variable substitution](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/parser_core.py): `pkgbuild_parser/parser_core.py`

### Info export

- [InfoDict builder](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py): `pkgbuild_parser/pkgbuild_parser.py`
- [JSON output](https://github.com/kevincrrl/pkgbuild_parser/blob/main/pkgbuild_parser/pkgbuild_parser.py): `pkgbuild_parser/pkgbuild_parser.py`

### Other components

- **Library caller**
- **PKGBUILD input**
- **JSON file**

## Connections

- Library caller → Parser getters: constructs and queries (evidence: `README.md`)
- PKGBUILD input → PKGBUILD reader: provides input (evidence: `pkgbuild_parser/parser_core.py`)
- Parser getters → PKGBUILD reader: inherits and delegates (evidence: `pkgbuild_parser/pkgbuild_parser.py`)
- PKGBUILD reader → Variable substitution: processes variables (evidence: `pkgbuild_parser/parser_core.py`)
- Library caller → InfoDict builder: selects fields (evidence: `README.md`)
- InfoDict builder → PKGBUILD reader: requests values (evidence: `pkgbuild_parser/pkgbuild_parser.py`)
- InfoDict builder → JSON output: serializes dictionary (evidence: `pkgbuild_parser/pkgbuild_parser.py`)
- JSON output → JSON file: writes JSON (evidence: `pkgbuild_parser/pkgbuild_parser.py`)
