# pydantic/pydantic-extra-types architecture

> Architecture diagram of the GitHub repository pydantic/pydantic-extra-types, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pydantic/pydantic-extra-types
- Repository: https://github.com/pydantic/pydantic-extra-types

## Overview

##### Project Type Analysis
This is an open-source Python library that extends Pydantic's type system. It's a modular collection of specialized data types that can be used for validation and serialization.

##### Main Components

a. Core Components:
- Pydantic Core Integration Layer
- Type Definition Modules
- Validation Layer
- Test Suite

b. Type Categories (Group the types logically):
##### Date/Time Related
- Epoch
- Pendulum DateTime
- Timezone Name

##### Geographic/Location
- Coordinate
- Country
- Language Code

##### Network/Internet
- Domain
- MAC Address
- S3

##### Financial/Payment
- Currency Code
- Payment
- Routing Number

##### Identification/Standards
- ISBN
- Semantic Version
- ULID

**┌─────────────────────────────────────────────┐**
- Client Application             │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Pydantic Extra Types Layer          │
- ┤
- ┌─────────┐ ┌────────┐ ┌───────────────┐  │
- DateTime │ │Location│ │Network/Internet│  │
- ┘ └────────┘ └───────────────┘  │
- ┌─────────┐ ┌────────────────┐           │
- Financial│ │Identification  │           │
- ┘ └────────────────┘           │
- ┘
- ↓
**┌─────────────────────────────────────────────┐**
- Pydantic Core                   │
- ┘

##### Specific Elements

a. Component Relationships:
- How each type module interfaces with Pydantic's core validation system
- Dependencies between different type modules if any exist
- Validation flow from raw input to validated type instances

b. Integration Points:
- How the library integrates with the main Pydantic library
- External dependencies (like 'pendulum' for datetime handling)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Application"]
        CA[Client Code]
    end

    subgraph PET["Pydantic Extra Types Layer"]
        direction TB
        
        subgraph DateTime["Date/Time Types"]
            direction TB
            EP["Epoch"]:::datetime
            PD["Pendulum DateTime"]:::datetime
            TZ["Timezone Name"]:::datetime
        end

        subgraph Location["Geographic/Location Types"]
            direction TB
            CO["Coordinate"]:::location
            CN["Country"]:::location
            LC["Language Code"]:::location
        end

        subgraph Network["Network/Internet Types"]
            direction TB
            DO["Domain"]:::network
            MA["MAC Address"]:::network
            S3["S3"]:::network
        end

        subgraph Financial["Financial/Payment Types"]
            direction TB
            CC["Currency Code"]:::financial
            PA["Payment"]:::financial
            RN["Routing Number"]:::financial
        end

        subgraph Standards["Identification/Standards Types"]
            direction TB
            IS["ISBN"]:::standards
            SV["Semantic Version"]:::standards
            UL["ULID"]:::standards
            CL["Color"]:::standards
        end
    end

    subgraph Core["Core Components"]
        direction TB
        PC["Pydantic Core"]:::core
        TS["Test Suite"]:::core
        CI["CI/CD Pipeline"]:::core
        CF["Core Configuration"]:::core
    end

    CA --> PET
    PET --> PC
    PC --> TS
    PC --> CI
    PC --> CF

    %% Click Events
    click EP "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/epoch.py"
    click PD "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/pendulum_dt.py"
    click TZ "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/timezone_name.py"
    click CO "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/coordinate.py"
    click CN "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/country.py"
    click LC "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/language_code.py"
    click DO "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/domain.py"
    click MA "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/mac_address.py"
    click S3 "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/s3.py"
    click CC "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/currency_code.py"
    click PA "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/payment.py"
    click RN "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/routing_number.py"
    click IS "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/isbn.py"
    click SV "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/semantic_version.py"
    click UL "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/ulid.py"
    click CL "https://github.com/pydantic/pydantic-extra-types/blob/main/pydantic_extra_types/color.py"
    click TS "https://github.com/pydantic/pydantic-extra-types/tree/main/tests/"
    click CI "https://github.com/pydantic/pydantic-extra-types/blob/main/.github/workflows/ci.yml"
    click CF "https://github.com/pydantic/pydantic-extra-types/blob/main/pyproject.toml"

    %% Styling
    classDef datetime fill:#90EE90
    classDef location fill:#FFA500
    classDef network fill:#DDA0DD
    classDef financial fill:#FFD700
    classDef standards fill:#A9A9A9
    classDef core fill:#87CEEB

    %% Legend
    subgraph Legend
        direction TB
        L1["Date/Time Types"]:::datetime
        L2["Geographic/Location Types"]:::location
        L3["Network/Internet Types"]:::network
        L4["Financial/Payment Types"]:::financial
        L5["Identification/Standards Types"]:::standards
        L6["Core Components"]:::core
    end
```
