# someware-fr/gdalmanylinux architecture

> Architecture diagram of the GitHub repository someware-fr/gdalmanylinux, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/someware-fr/gdalmanylinux
- Repository: https://github.com/someware-fr/gdalmanylinux

## Overview

This project is a template for building manylinux wheels for the GDAL Python bindings. Its purpose is to package GDAL’s C extension bindings with all necessary dependencies into self-contained wheels, so that users can pip-install GDAL without separately installing GDAL itself. The repository leverages containerization (via the manylinux Docker container) to provide a consistent build environment.

##### Main Components
- Build Scripts and Makefile: The Makefile, build scripts (e.g., build-linux-wheels.sh, build_pg.sh), and accompanying shell scripts serve as the controller that triggers the whole build process.
- Docker/Manylinux Container: The Dockerfile (Dockerfile.wheels) and reference to the manylinux environment encapsulate the build environment. This component provides isolation and a reproducible build system.
- Python Packaging Components: Key files such as setup.py, requirements.txt, and possibly the scripts (gdalinit.py, make_index.py) are used to configure the bindings, manage dependencies, and prepare the wheel build.
- Testing Suite: The test_wheels.py and configuration via tox.ini define how the final wheels are validated.
- Output Artifacts: The built wheels (placed in a wheels directory) and any scripts used to run tests (e.g., via Makefile targets for making tests) are the end result of the build process.

##### Relationships and Data Flow
- The Makefile triggers the build process scripts that launch a Docker container based on the manylinux image.
- Inside the container, the setup.py along with other configuration (from requirements.txt and initialization scripts) is used to build the GDAL wheel.
- The wheel is output to a designated directory (wheels).
- Optionally, tests may be executed through tox invoking test_wheels.py to validate the build.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Clearly separate scripts controlling the build, the actual wheel-building process, and the testing process.
- Modular Build Process: Although the project is small, identifying distinct modules (build, test, and deployment) helps highlight the pipeline.

##### Relevant Technologies
- Docker: Using the manylinux Docker container for consistent builds.
- Python: The language for the bindings, including its packaging (setup.py) and testing (tox, test_wheels.py).
- GDAL & PROJ Libraries: Although not explicitly in the file tree, the README mentions that data directories (GDAL and PROJ) are packaged into the wheels.
- Build Tools: Tools like make (Makefile) and shell scripts that orchestrate the process.

##### Specific Elements
- Clear labels:
- User/CI Initiator
- Build Controller (Makefile & build scripts)
- Manylinux Docker Container
- Setup Environment (setup.py, requirements.txt, scripts)
- Build Output (wheels directory)
- Testing Module (tox, test_wheels.py)
- Command trigger from the user to the Makefile.
- The flow from the Makefile to the Docker container initiation.
- Data flow inside the container (from checkout, dependency installation, to running setup.py).
- The flow from the container build process back to the host (creation of wheel files).
- Rectangles for scripts and processes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UCI["User/CI Initiator"]:::initiator

    subgraph "Build Controller"
        BC1["Makefile"]:::controllerFile
        BC2["build-linux-wheels.sh"]:::controllerFile
        BC3["build_pg.sh"]:::controllerFile
    end

    MLC["Manylinux Docker Container"]:::container

    subgraph "Python Packaging Components"
        P1["setup.py"]:::packagingFile
        P2["requirements.txt"]:::packagingFile
        P3["gdalinit.py"]:::packagingFile
        P4["make_index.py"]:::packagingFile
    end

    WO["Built Wheels Output (wheels directory)"]:::output

    subgraph "Testing Module"
        T1["test_wheels.py"]:::testingFile
        T2["tox.ini"]:::testingFile
    end

    UCI -->|"triggers"| BC1
    UCI --> BC2
    UCI --> BC3
    BC1 & BC2 & BC3 -->|"initiates build"| MLC
    MLC -->|"runs packaging"| P1
    MLC --> P2
    MLC --> P3
    MLC --> P4
    P1 & P2 & P3 & P4 -->|"packages wheel"| WO
    MLC -->|"executes tests"| T1
    MLC --> T2

    click BC1 "https://github.com/someware-fr/gdalmanylinux/tree/master/Makefile"
    click BC2 "https://github.com/someware-fr/gdalmanylinux/blob/master/build-linux-wheels.sh"
    click BC3 "https://github.com/someware-fr/gdalmanylinux/blob/master/build_pg.sh"
    click MLC "https://github.com/someware-fr/gdalmanylinux/blob/master/Dockerfile.wheels"
    click P1 "https://github.com/someware-fr/gdalmanylinux/blob/master/setup.py"
    click P2 "https://github.com/someware-fr/gdalmanylinux/blob/master/requirements.txt"
    click P3 "https://github.com/someware-fr/gdalmanylinux/blob/master/gdalinit.py"
    click P4 "https://github.com/someware-fr/gdalmanylinux/blob/master/make_index.py"
    click T1 "https://github.com/someware-fr/gdalmanylinux/blob/master/test_wheels.py"
    click T2 "https://github.com/someware-fr/gdalmanylinux/blob/master/tox.ini"

    classDef initiator fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef controllerFile fill:#66ccff,stroke:#333,stroke-width:2px;
    classDef container fill:#99ff99,stroke:#333,stroke-width:2px;
    classDef packagingFile fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef testingFile fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef output fill:#cccccc,stroke:#333,stroke-width:2px;
```
