# dabeaz-course/practical-python architecture

> Architecture diagram of the GitHub repository dabeaz-course/practical-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dabeaz-course/practical-python
- Repository: https://github.com/dabeaz-course/practical-python

## Overview

This repository is a practical Python training course, not a single deployed application. Its README describes instructor-led lessons and hands-on exercises covering scripting, data manipulation, and program organization. The solution files show one recurring exercise evolving into a stock-portfolio report: read CSV inputs, build holdings, calculate changes, and format output. The report excerpt supports those calls; later package files are represented as course examples, not a claimed production runtime. Evidence is limited to the README, sampled report source, and SOURCE INDEX references.

Main entry points: [`Solutions/7_4/report.py`](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/7_4/report.py) (Report command), [`README.md`](https://github.com/dabeaz-course/practical-python/blob/master/README.md) (Practical Python course), [`Solutions/9_3/porty-app/porty/tableformat.py`](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/tableformat.py) (Table formatting), [`Solutions/9_3/porty-app/porty/fileparse.py`](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/fileparse.py) (CSV parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Course material"]
  node_course["Practical Python course<br/>[README.md]"]
end

subgraph group_example["Portfolio example"]
  node_cli["Report command<br/>[report.py]"]
  node_portfolio_input["Portfolio CSV"]
  node_prices_input["Price CSV"]
  node_report_data["Change calculation<br/>[report.py]"]
  node_report_output["Formatted report"]
end

subgraph group_package["Reusable modules"]
  node_parser["CSV parsing<br/>[fileparse.py]"]
  node_stock["Stock holding<br/>[stock.py]"]
  node_portfolio["Portfolio collection<br/>[portfolio.py]"]
  node_formatting["Table formatting<br/>[tableformat.py]"]
  node_stock_v1["Stock exercise<br/>[stock.py]"]
  node_table_v1["Formatter exercise<br/>[tableformat.py]"]
  node_portfolio_v1["Portfolio exercise<br/>[portfolio.py]"]
  node_fileparse_v2["Parser package<br/>[fileparse.py]"]
  node_portfolio_v2["Portfolio package<br/>[portfolio.py]"]
  node_stock_v2["Stock package<br/>[stock.py]"]
  node_table_v2["Formatter package<br/>[tableformat.py]"]
end

node_student(("Python learner"))

node_student -->|"learns from"| node_course
node_course -.->|"includes exercises"| node_cli
node_student -->|"runs"| node_cli
node_cli -->|"reads"| node_portfolio_input
node_cli -->|"reads"| node_prices_input
node_cli -->|"parses CSV"| node_parser
node_cli -.->|"constructs"| node_stock
node_cli -.->|"constructs"| node_portfolio
node_cli -->|"calculates changes"| node_report_data
node_cli -->|"selects formatter"| node_formatting
node_formatting -->|"prints rows"| node_report_output
node_cli -->|"writes report"| node_report_output

click node_course "https://github.com/dabeaz-course/practical-python/blob/master/README.md"
click node_cli "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/7_4/report.py"
click node_parser "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/fileparse.py"
click node_stock "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/stock.py"
click node_portfolio "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/portfolio.py"
click node_report_data "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/7_4/report.py"
click node_formatting "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/tableformat.py"
click node_stock_v1 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/4_4/stock.py"
click node_table_v1 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/5_8/tableformat.py"
click node_portfolio_v1 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/6_3/portfolio.py"
click node_fileparse_v2 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/fileparse.py"
click node_portfolio_v2 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/portfolio.py"
click node_stock_v2 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/stock.py"
click node_table_v2 "https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/tableformat.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_course toneBlue
class node_cli,node_portfolio_input,node_prices_input,node_report_data,node_report_output toneAmber
class node_parser,node_stock,node_portfolio,node_formatting,node_stock_v1,node_table_v1,node_portfolio_v1,node_fileparse_v2,node_portfolio_v2,node_stock_v2,node_table_v2 toneMint
class node_student toneIndigo
```

## Components

### Course material

- [Practical Python course](https://github.com/dabeaz-course/practical-python/blob/master/README.md): `README.md`

### Portfolio example

- [Report command](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/7_4/report.py): `Solutions/7_4/report.py`
- **Portfolio CSV**
- **Price CSV**
- [Change calculation](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/7_4/report.py): `Solutions/7_4/report.py`
- **Formatted report**

### Reusable modules

- [CSV parsing](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/fileparse.py): `Solutions/9_3/porty-app/porty/fileparse.py`
- [Stock holding](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/stock.py): `Solutions/9_3/porty-app/porty/stock.py`
- [Portfolio collection](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/portfolio.py): `Solutions/9_3/porty-app/porty/portfolio.py`
- [Table formatting](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_3/porty-app/porty/tableformat.py): `Solutions/9_3/porty-app/porty/tableformat.py`
- [Stock exercise](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/4_4/stock.py): `Solutions/4_4/stock.py`
- [Formatter exercise](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/5_8/tableformat.py): `Solutions/5_8/tableformat.py`
- [Portfolio exercise](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/6_3/portfolio.py): `Solutions/6_3/portfolio.py`
- [Parser package](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/fileparse.py): `Solutions/9_5/porty-app/porty/fileparse.py`
- [Portfolio package](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/portfolio.py): `Solutions/9_5/porty-app/porty/portfolio.py`
- [Stock package](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/stock.py): `Solutions/9_5/porty-app/porty/stock.py`
- [Formatter package](https://github.com/dabeaz-course/practical-python/blob/master/Solutions/9_5/porty-app/porty/tableformat.py): `Solutions/9_5/porty-app/porty/tableformat.py`

### Other components

- **Python learner**

## Connections

- Python learner → Practical Python course: learns from (evidence: `README.md`)
- Practical Python course → Report command: includes exercises
- Python learner → Report command: runs (evidence: `Solutions/7_4/report.py`)
- Report command → Portfolio CSV: reads (evidence: `Solutions/7_4/report.py`)
- Report command → Price CSV: reads (evidence: `Solutions/7_4/report.py`)
- Report command → CSV parsing: parses CSV (evidence: `Solutions/7_4/report.py`)
- Report command → Stock holding: constructs
- Report command → Portfolio collection: constructs
- Report command → Change calculation: calculates changes (evidence: `Solutions/7_4/report.py`)
- Report command → Table formatting: selects formatter (evidence: `Solutions/7_4/report.py`)
- Table formatting → Formatted report: prints rows
- Report command → Formatted report: writes report (evidence: `Solutions/7_4/report.py`)
