# deepl/deepl-python architecture

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

- Interactive diagram: https://gitdiagram.com/deepl/deepl-python
- Repository: https://github.com/deepl/deepl-python

## Overview

This repository is a Python client library and CLI for DeepL’s language API. Applications or CLI users submit text or documents through DeepLClient; the library sends requests to DeepL and returns translated or improved results. It also exposes language and usage queries, glossary and style-rule management, and translation-memory workflows. The sampled sources establish the client, transport, and data-model layers; some feature-specific wiring is inferred only at the documented capability level, so uncertain links are omitted.

Main entry points: [`deepl/deepl_client.py`](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py) (DeepL client), [`deepl/translator.py`](https://github.com/deepl/deepl-python/blob/main/deepl/translator.py) (Translation API), [`deepl/http_client.py`](https://github.com/deepl/deepl-python/blob/main/deepl/http_client.py) (HTTP transport), [`deepl/__main__.py`](https://github.com/deepl/deepl-python/blob/main/deepl/__main__.py) (Command-line interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Command-line interface<br/>[__main__.py]"]
  node_client["DeepL client<br/>[deepl_client.py]"]
end

subgraph group_translation["Translation workflows"]
  node_translator["Translation API<br/>[translator.py]"]
  node_text["Text translation<br/>[translator.py]"]
  node_document["Document translation<br/>[translator.py]"]
  node_writing["Text improvement<br/>[deepl_client.py]"]
end

subgraph group_resources["Language resources"]
  node_glossaries["Glossary management<br/>[deepl_client.py]"]
  node_style["Style rules<br/>[deepl_client.py]"]
  node_memories["Translation memories<br/>[deepl_client.py]"]
  node_language_usage["Languages and usage<br/>[translator.py]"]
end

subgraph group_runtime["Client runtime"]
  node_models["API data models<br/>[api_data.py]"]
  node_http["HTTP transport<br/>[http_client.py]"]
  node_errors["Exceptions<br/>[exceptions.py]"]
end

node_app(("Python application"))
node_cli_user(("CLI user"))
node_deepl_api{{"DeepL API"}}

node_cli_user -->|"runs commands"| node_cli
node_cli -->|"calls client"| node_client
node_app -->|"calls client"| node_client
node_client -->|"extends"| node_translator
node_translator -->|"provides"| node_text
node_translator -->|"provides"| node_document
node_client -->|"provides"| node_writing
node_client -->|"manages"| node_glossaries
node_client -->|"manages"| node_style
node_client -->|"manages"| node_memories
node_translator -->|"provides"| node_language_usage
node_translator -->|"sends requests"| node_http
node_client -->|"sends requests"| node_http
node_http -->|"HTTP exchange"| node_deepl_api
node_translator -->|"builds results"| node_models
node_client -->|"builds results"| node_models
node_translator -->|"raises"| node_errors
node_client -->|"raises"| node_errors

click node_cli "https://github.com/deepl/deepl-python/blob/main/deepl/__main__.py"
click node_client "https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py"
click node_translator "https://github.com/deepl/deepl-python/blob/main/deepl/translator.py"
click node_text "https://github.com/deepl/deepl-python/blob/main/deepl/translator.py"
click node_document "https://github.com/deepl/deepl-python/blob/main/deepl/translator.py"
click node_writing "https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py"
click node_glossaries "https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py"
click node_style "https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py"
click node_memories "https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py"
click node_language_usage "https://github.com/deepl/deepl-python/blob/main/deepl/translator.py"
click node_models "https://github.com/deepl/deepl-python/blob/main/deepl/api_data.py"
click node_http "https://github.com/deepl/deepl-python/blob/main/deepl/http_client.py"
click node_errors "https://github.com/deepl/deepl-python/blob/main/deepl/exceptions.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_cli,node_client,node_cli_user toneBlue
class node_translator,node_text,node_document,node_writing toneAmber
class node_glossaries,node_style,node_memories,node_language_usage,node_deepl_api toneMint
class node_models,node_http,node_errors toneRose
class node_app toneIndigo
```

## Components

### User interfaces

- [Command-line interface](https://github.com/deepl/deepl-python/blob/main/deepl/__main__.py): `deepl/__main__.py`
- [DeepL client](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py): `deepl/deepl_client.py`

### Translation workflows

- [Translation API](https://github.com/deepl/deepl-python/blob/main/deepl/translator.py): `deepl/translator.py`
- [Text translation](https://github.com/deepl/deepl-python/blob/main/deepl/translator.py): `deepl/translator.py`
- [Document translation](https://github.com/deepl/deepl-python/blob/main/deepl/translator.py): `deepl/translator.py`
- [Text improvement](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py): `deepl/deepl_client.py`

### Language resources

- [Glossary management](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py): `deepl/deepl_client.py`
- [Style rules](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py): `deepl/deepl_client.py`
- [Translation memories](https://github.com/deepl/deepl-python/blob/main/deepl/deepl_client.py): `deepl/deepl_client.py`
- [Languages and usage](https://github.com/deepl/deepl-python/blob/main/deepl/translator.py): `deepl/translator.py`

### Client runtime

- [API data models](https://github.com/deepl/deepl-python/blob/main/deepl/api_data.py): `deepl/api_data.py`
- [HTTP transport](https://github.com/deepl/deepl-python/blob/main/deepl/http_client.py): `deepl/http_client.py`
- [Exceptions](https://github.com/deepl/deepl-python/blob/main/deepl/exceptions.py): `deepl/exceptions.py`

### Other components

- **Python application**
- **CLI user**
- **DeepL API**

## Connections

- CLI user → Command-line interface: runs commands
- Command-line interface → DeepL client: calls client
- Python application → DeepL client: calls client
- DeepL client → Translation API: extends
- Translation API → Text translation: provides
- Translation API → Document translation: provides
- DeepL client → Text improvement: provides
- DeepL client → Glossary management: manages
- DeepL client → Style rules: manages
- DeepL client → Translation memories: manages
- Translation API → Languages and usage: provides
- Translation API → HTTP transport: sends requests
- DeepL client → HTTP transport: sends requests
- HTTP transport → DeepL API: HTTP exchange
- Translation API → API data models: builds results
- DeepL client → API data models: builds results
- Translation API → Exceptions: raises
- DeepL client → Exceptions: raises
