distill-align 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. distill_align-0.1.1/LICENSE +21 -0
  2. distill_align-0.1.1/PKG-INFO +168 -0
  3. distill_align-0.1.1/README.md +124 -0
  4. distill_align-0.1.1/pyproject.toml +132 -0
  5. distill_align-0.1.1/src/distill_align/__init__.py +9 -0
  6. distill_align-0.1.1/src/distill_align/cli/__init__.py +1 -0
  7. distill_align-0.1.1/src/distill_align/cli/main.py +579 -0
  8. distill_align-0.1.1/src/distill_align/core/__init__.py +1 -0
  9. distill_align-0.1.1/src/distill_align/core/cache.py +418 -0
  10. distill_align-0.1.1/src/distill_align/core/checkpoint.py +416 -0
  11. distill_align-0.1.1/src/distill_align/core/config.py +90 -0
  12. distill_align-0.1.1/src/distill_align/core/config_file.py +275 -0
  13. distill_align-0.1.1/src/distill_align/core/exceptions.py +133 -0
  14. distill_align-0.1.1/src/distill_align/core/json_utils.py +62 -0
  15. distill_align-0.1.1/src/distill_align/core/logging.py +133 -0
  16. distill_align-0.1.1/src/distill_align/core/pii_filter.py +377 -0
  17. distill_align-0.1.1/src/distill_align/core/schemas.py +194 -0
  18. distill_align-0.1.1/src/distill_align/core/telemetry.py +44 -0
  19. distill_align-0.1.1/src/distill_align/exporter/__init__.py +1 -0
  20. distill_align-0.1.1/src/distill_align/exporter/dataset_card.py +259 -0
  21. distill_align-0.1.1/src/distill_align/exporter/formatters/__init__.py +1 -0
  22. distill_align-0.1.1/src/distill_align/exporter/formatters/alpaca.py +144 -0
  23. distill_align-0.1.1/src/distill_align/exporter/formatters/base.py +91 -0
  24. distill_align-0.1.1/src/distill_align/exporter/formatters/chatml.py +93 -0
  25. distill_align-0.1.1/src/distill_align/exporter/formatters/conversation.py +88 -0
  26. distill_align-0.1.1/src/distill_align/exporter/formatters/hf_messages.py +134 -0
  27. distill_align-0.1.1/src/distill_align/exporter/formatters/jsonl.py +177 -0
  28. distill_align-0.1.1/src/distill_align/exporter/formatters/parquet.py +283 -0
  29. distill_align-0.1.1/src/distill_align/exporter/formatters/preference.py +137 -0
  30. distill_align-0.1.1/src/distill_align/exporter/formatters/sharegpt.py +116 -0
  31. distill_align-0.1.1/src/distill_align/exporter/hub.py +94 -0
  32. distill_align-0.1.1/src/distill_align/exporter/pipeline.py +305 -0
  33. distill_align-0.1.1/src/distill_align/exporter/preference_generator.py +234 -0
  34. distill_align-0.1.1/src/distill_align/exporter/splitter.py +210 -0
  35. distill_align-0.1.1/src/distill_align/exporter/unsloth_builder.py +283 -0
  36. distill_align-0.1.1/src/distill_align/exporter/validator.py +410 -0
  37. distill_align-0.1.1/src/distill_align/ingestion/__init__.py +1 -0
  38. distill_align-0.1.1/src/distill_align/ingestion/auto.py +323 -0
  39. distill_align-0.1.1/src/distill_align/ingestion/chunkers/__init__.py +1 -0
  40. distill_align-0.1.1/src/distill_align/ingestion/chunkers/base.py +65 -0
  41. distill_align-0.1.1/src/distill_align/ingestion/chunkers/code.py +226 -0
  42. distill_align-0.1.1/src/distill_align/ingestion/chunkers/markdown.py +170 -0
  43. distill_align-0.1.1/src/distill_align/ingestion/loaders/__init__.py +1 -0
  44. distill_align-0.1.1/src/distill_align/ingestion/loaders/base.py +69 -0
  45. distill_align-0.1.1/src/distill_align/ingestion/loaders/code.py +153 -0
  46. distill_align-0.1.1/src/distill_align/ingestion/loaders/csv_loader.py +101 -0
  47. distill_align-0.1.1/src/distill_align/ingestion/loaders/docx.py +92 -0
  48. distill_align-0.1.1/src/distill_align/ingestion/loaders/html.py +111 -0
  49. distill_align-0.1.1/src/distill_align/ingestion/loaders/json_loader.py +136 -0
  50. distill_align-0.1.1/src/distill_align/ingestion/loaders/jupyter.py +112 -0
  51. distill_align-0.1.1/src/distill_align/ingestion/loaders/markdown.py +70 -0
  52. distill_align-0.1.1/src/distill_align/ingestion/loaders/pdf.py +91 -0
  53. distill_align-0.1.1/src/distill_align/ingestion/loaders/text.py +62 -0
  54. distill_align-0.1.1/src/distill_align/ingestion/loaders/web.py +267 -0
  55. distill_align-0.1.1/src/distill_align/ingestion/pipeline.py +228 -0
  56. distill_align-0.1.1/src/distill_align/synthesis/__init__.py +1 -0
  57. distill_align-0.1.1/src/distill_align/synthesis/conversation_builder.py +256 -0
  58. distill_align-0.1.1/src/distill_align/synthesis/judge.py +124 -0
  59. distill_align-0.1.1/src/distill_align/synthesis/models/__init__.py +1 -0
  60. distill_align-0.1.1/src/distill_align/synthesis/models/anthropic.py +153 -0
  61. distill_align-0.1.1/src/distill_align/synthesis/models/azure.py +181 -0
  62. distill_align-0.1.1/src/distill_align/synthesis/models/base.py +189 -0
  63. distill_align-0.1.1/src/distill_align/synthesis/models/gemini.py +168 -0
  64. distill_align-0.1.1/src/distill_align/synthesis/models/ollama.py +215 -0
  65. distill_align-0.1.1/src/distill_align/synthesis/models/openai.py +189 -0
  66. distill_align-0.1.1/src/distill_align/synthesis/models/vllm.py +61 -0
  67. distill_align-0.1.1/src/distill_align/synthesis/pipeline.py +426 -0
  68. distill_align-0.1.1/src/distill_align/synthesis/prompts/__init__.py +1 -0
  69. distill_align-0.1.1/src/distill_align/synthesis/prompts/scaffold/code_extract.j2 +15 -0
  70. distill_align-0.1.1/src/distill_align/synthesis/prompts/scaffold/system.j2 +15 -0
  71. distill_align-0.1.1/src/distill_align/synthesis/prompts/scaffold/tool_call.j2 +12 -0
  72. distill_align-0.1.1/src/distill_align/synthesis/prompts/scaffold.py +87 -0
  73. distill_align-0.1.1/src/distill_align/synthesis/prompts/socratic/code.j2 +19 -0
  74. distill_align-0.1.1/src/distill_align/synthesis/prompts/socratic/markdown.j2 +17 -0
  75. distill_align-0.1.1/src/distill_align/synthesis/prompts/socratic/system.j2 +19 -0
  76. distill_align-0.1.1/src/distill_align/synthesis/prompts/socratic.py +88 -0
  77. distill_align-0.1.1/src/distill_align/synthesis/pruner.py +237 -0
  78. distill_align-0.1.1/src/distill_align/synthesis/tokenizer.py +437 -0
  79. distill_align-0.1.1/src/distill_align/synthesis/worker.py +356 -0
  80. distill_align-0.1.1/src/distill_align/tui/__init__.py +1 -0
  81. distill_align-0.1.1/src/distill_align/tui/app.py +364 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Distill-Align Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: distill-align
3
+ Version: 0.1.1
4
+ Summary: The Structured Reasoning Extraction Factory — Generate high-quality fine-tuning datasets from raw domain data
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: llm,fine-tuning,dataset,distillation,unsloth,synthesis
8
+ Author: o69dn
9
+ Requires-Python: >=3.11,<4.0
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Provides-Extra: all
22
+ Provides-Extra: hub
23
+ Provides-Extra: parquet
24
+ Requires-Dist: beautifulsoup4 (>=4.12.0)
25
+ Requires-Dist: httpx (>=0.27.0)
26
+ Requires-Dist: huggingface_hub (>=0.23.0,<0.24.0) ; extra == "hub" or extra == "all"
27
+ Requires-Dist: jinja2 (>=3.1.0,<4.0.0)
28
+ Requires-Dist: loguru (>=0.7.0,<0.8.0)
29
+ Requires-Dist: pyarrow (>=14.0.0) ; extra == "parquet" or extra == "all"
30
+ Requires-Dist: pydantic (>=2.7.0,<3.0.0)
31
+ Requires-Dist: pydantic-settings (>=2.2.0,<3.0.0)
32
+ Requires-Dist: pypdf (>=4.2.0,<5.0.0)
33
+ Requires-Dist: python-docx (>=1.1.0)
34
+ Requires-Dist: pyyaml (>=6.0,<7.0)
35
+ Requires-Dist: rich (>=13.7.0,<14.0.0)
36
+ Requires-Dist: textual (>=0.58.0,<0.59.0)
37
+ Requires-Dist: tiktoken (>=0.7.0)
38
+ Requires-Dist: typer (>=0.13.0)
39
+ Project-URL: Documentation, https://o69dn.github.io/Distill-Align/
40
+ Project-URL: Homepage, https://github.com/o69dn/Distill-Align
41
+ Project-URL: Repository, https://github.com/o69dn/Distill-Align
42
+ Description-Content-Type: text/markdown
43
+
44
+ # Distill-Align
45
+
46
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+ [![CI](https://github.com/o69dn/Distill-Align/actions/workflows/ci.yml/badge.svg)](https://github.com/o69dn/Distill-Align/actions/workflows/ci.yml)
49
+ [![PyPI version](https://img.shields.io/pypi/v/distill-align.svg)](https://pypi.org/project/distill-align/)
50
+ [![Security](https://github.com/o69dn/Distill-Align/actions/workflows/security-scan.yml/badge.svg)](https://github.com/o69dn/Distill-Align/actions/workflows/security-scan.yml)
51
+
52
+ > **Distill-Align: The Structured Reasoning Extraction Factory**
53
+ >
54
+ > A CLI/Python framework that automates the generation of high-quality, fine-tuning datasets from raw domain data. It utilizes high-context frontier reasoning models as teachers, captures their deep thinking traces, and filters/prunes those traces into highly structured instruction-following formats optimized for fine-tuning.
55
+
56
+ 🌐 **العربية**: [README.ar.md](README.ar.md) — الترجمة العربية لهذا الدليل.
57
+
58
+ ## Features
59
+
60
+ - **Smart Ingestion**: Async chunking pipelines with semantic-aware splitting for Markdown and Code (PDF, DOCX, HTML, CSV, JSON, Jupyter notebooks, and web pages also supported).
61
+ - **Multi-Provider Synthesis**: Supports **OpenAI**, **Ollama**, **vLLM**, **Anthropic Claude**, **Google Gemini**, and **Azure OpenAI** backends with async worker pools.
62
+ - **Socratic Transformer**: Converts raw reasoning into structured, multi-turn conversational Q&A.
63
+ - **Scaffold Action Pruner**: Strips conversational filler to extract pure tool-calling or structural output.
64
+ - **LLM-as-Judge Evaluation** (optional): Automated quality scoring of generated conversations using a separate judge model, with confidence scores normalized 0–1.
65
+ - **Preference (DPO) Generation**: Create preference pairs from judge-scored conversations for Direct Preference Optimization training.
66
+ - **Multiple Export Formats**: ShareGPT, Alpaca, ChatML, HuggingFace messages (JSONL/JSON), streaming JSON Lines, and **Apache Parquet**.
67
+ - **Streaming Export**: Export large datasets without loading them entirely into memory using iterative producers.
68
+ - **Cost Tracking**: Pay-as-you-go cost estimation and tracking across all providers with per-request token accounting.
69
+ - **Unsloth Integration**: Auto-generates optimized `train.py` scripts for Unsloth fine-tuning.
70
+ - **Rich TUI**: Interactive terminal dashboard for monitoring pipeline execution.
71
+
72
+ ## Installation
73
+
74
+ ```bash
75
+ pip install distill-align
76
+
77
+ # With optional dependencies
78
+ pip install distill-align[parquet] # Parquet export support
79
+ pip install distill-align[hub] # HuggingFace Hub integration
80
+ pip install distill-align[all] # All extras
81
+ ```
82
+
83
+ ## Quick Start
84
+
85
+ ```bash
86
+ # Ingest and process data
87
+ distill-align ingest --source ./my-docs --output ./chunks.json
88
+
89
+ # Synthesize conversations (with judge evaluation)
90
+ distill-align synthesize \
91
+ --input ./chunks.json \
92
+ --output ./conversations.json \
93
+ --provider openai \
94
+ --model gpt-4o \
95
+ --judge \
96
+ --judge-model gpt-4o-mini
97
+
98
+ # Export to training format
99
+ distill-align export \
100
+ --input ./conversations.json \
101
+ --format hf_messages \
102
+ --output ./dataset
103
+
104
+ # Generate preference pairs for DPO training
105
+ distill-align export \
106
+ --input ./conversations.json \
107
+ --format preference \
108
+ --output ./dpo-pairs
109
+
110
+ # Launch TUI
111
+ distill-align tui
112
+ ```
113
+
114
+ ## Supported Providers
115
+
116
+ | Provider | SDK-Free | Structured Output | Auth |
117
+ |-------------|----------|-------------------|-------------------------------|
118
+ | OpenAI | ✓ | ✓ | API key |
119
+ | Anthropic | ✓ | ✓ (JSON mode) | API key |
120
+ | Google Gemini | ✓ | ✓ (MIME type) | API key |
121
+ | Azure OpenAI | ✓ | ✓ | API key or Entra ID (OAuth2) |
122
+ | Ollama | ✓ | — | None (local) |
123
+ | vLLM | ✓ | ✓ (OpenAI compat) | None / API key |
124
+
125
+ ## Export Formats
126
+
127
+ | Format | Extension | Description |
128
+ |--------------------|-----------|------------------------------------------------|
129
+ | `hf_messages` | `.jsonl` | HuggingFace messages format (JSONL recommended) |
130
+ | `jsonl` | `.jsonl` | Generic JSON Lines (streaming-capable) |
131
+ | `parquet` | `.parquet`| Columnar format (requires `pyarrow`) |
132
+ | `sharegpt` | `.json` | ShareGPT conversation format |
133
+ | `alpaca` | `.json` | Alpaca instruction format |
134
+ | `chatml` | `.json` | ChatML markup format |
135
+ | `conversation` | `.json` | Raw conversation schema export |
136
+ | `preference` | `.json` | DPO preference pairs (requires judge scores) |
137
+
138
+ ## Project Structure
139
+
140
+ This project follows a **Modular Monolith** architecture.
141
+
142
+ ```text
143
+ distill-align/
144
+ ├── src/distill_align/ # Core application package
145
+ │ ├── core/ # Config, schemas, logging, caching, checkpointing
146
+ │ ├── ingestion/ # Data loaders and chunkers (PDF, DOCX, HTML, code, etc.)
147
+ │ ├── synthesis/ # LLM clients, worker pool, prompts, judge, cost tracking
148
+ │ │ └── models/ # Provider-specific clients (OpenAI, Anthropic, Gemini, Azure, Ollama, vLLM)
149
+ │ ├── exporter/ # Formatters, validator, splitter, preference generator
150
+ │ │ └── formatters/ # Output format converters (JSONL, Parquet, ShareGPT, Alpaca, etc.)
151
+ │ ├── tui/ # Textual terminal UI
152
+ │ └── cli/ # Typer CLI entry points
153
+ ├── tests/ # Pytest suite
154
+ └── docs/ # Documentation (MkDocs)
155
+ ```
156
+
157
+ ## Development
158
+
159
+ 1. Clone the repository
160
+ 2. Install dependencies with Poetry: `poetry install`
161
+ 3. Install dev dependencies: `poetry install --with dev`
162
+ 4. Run tests: `poetry run pytest`
163
+ 5. Run linting: `poetry run ruff check src/`
164
+
165
+ ## License
166
+
167
+ MIT License - see [LICENSE](LICENSE) for details.
168
+
@@ -0,0 +1,124 @@
1
+ # Distill-Align
2
+
3
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![CI](https://github.com/o69dn/Distill-Align/actions/workflows/ci.yml/badge.svg)](https://github.com/o69dn/Distill-Align/actions/workflows/ci.yml)
6
+ [![PyPI version](https://img.shields.io/pypi/v/distill-align.svg)](https://pypi.org/project/distill-align/)
7
+ [![Security](https://github.com/o69dn/Distill-Align/actions/workflows/security-scan.yml/badge.svg)](https://github.com/o69dn/Distill-Align/actions/workflows/security-scan.yml)
8
+
9
+ > **Distill-Align: The Structured Reasoning Extraction Factory**
10
+ >
11
+ > A CLI/Python framework that automates the generation of high-quality, fine-tuning datasets from raw domain data. It utilizes high-context frontier reasoning models as teachers, captures their deep thinking traces, and filters/prunes those traces into highly structured instruction-following formats optimized for fine-tuning.
12
+
13
+ 🌐 **العربية**: [README.ar.md](README.ar.md) — الترجمة العربية لهذا الدليل.
14
+
15
+ ## Features
16
+
17
+ - **Smart Ingestion**: Async chunking pipelines with semantic-aware splitting for Markdown and Code (PDF, DOCX, HTML, CSV, JSON, Jupyter notebooks, and web pages also supported).
18
+ - **Multi-Provider Synthesis**: Supports **OpenAI**, **Ollama**, **vLLM**, **Anthropic Claude**, **Google Gemini**, and **Azure OpenAI** backends with async worker pools.
19
+ - **Socratic Transformer**: Converts raw reasoning into structured, multi-turn conversational Q&A.
20
+ - **Scaffold Action Pruner**: Strips conversational filler to extract pure tool-calling or structural output.
21
+ - **LLM-as-Judge Evaluation** (optional): Automated quality scoring of generated conversations using a separate judge model, with confidence scores normalized 0–1.
22
+ - **Preference (DPO) Generation**: Create preference pairs from judge-scored conversations for Direct Preference Optimization training.
23
+ - **Multiple Export Formats**: ShareGPT, Alpaca, ChatML, HuggingFace messages (JSONL/JSON), streaming JSON Lines, and **Apache Parquet**.
24
+ - **Streaming Export**: Export large datasets without loading them entirely into memory using iterative producers.
25
+ - **Cost Tracking**: Pay-as-you-go cost estimation and tracking across all providers with per-request token accounting.
26
+ - **Unsloth Integration**: Auto-generates optimized `train.py` scripts for Unsloth fine-tuning.
27
+ - **Rich TUI**: Interactive terminal dashboard for monitoring pipeline execution.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ pip install distill-align
33
+
34
+ # With optional dependencies
35
+ pip install distill-align[parquet] # Parquet export support
36
+ pip install distill-align[hub] # HuggingFace Hub integration
37
+ pip install distill-align[all] # All extras
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ```bash
43
+ # Ingest and process data
44
+ distill-align ingest --source ./my-docs --output ./chunks.json
45
+
46
+ # Synthesize conversations (with judge evaluation)
47
+ distill-align synthesize \
48
+ --input ./chunks.json \
49
+ --output ./conversations.json \
50
+ --provider openai \
51
+ --model gpt-4o \
52
+ --judge \
53
+ --judge-model gpt-4o-mini
54
+
55
+ # Export to training format
56
+ distill-align export \
57
+ --input ./conversations.json \
58
+ --format hf_messages \
59
+ --output ./dataset
60
+
61
+ # Generate preference pairs for DPO training
62
+ distill-align export \
63
+ --input ./conversations.json \
64
+ --format preference \
65
+ --output ./dpo-pairs
66
+
67
+ # Launch TUI
68
+ distill-align tui
69
+ ```
70
+
71
+ ## Supported Providers
72
+
73
+ | Provider | SDK-Free | Structured Output | Auth |
74
+ |-------------|----------|-------------------|-------------------------------|
75
+ | OpenAI | ✓ | ✓ | API key |
76
+ | Anthropic | ✓ | ✓ (JSON mode) | API key |
77
+ | Google Gemini | ✓ | ✓ (MIME type) | API key |
78
+ | Azure OpenAI | ✓ | ✓ | API key or Entra ID (OAuth2) |
79
+ | Ollama | ✓ | — | None (local) |
80
+ | vLLM | ✓ | ✓ (OpenAI compat) | None / API key |
81
+
82
+ ## Export Formats
83
+
84
+ | Format | Extension | Description |
85
+ |--------------------|-----------|------------------------------------------------|
86
+ | `hf_messages` | `.jsonl` | HuggingFace messages format (JSONL recommended) |
87
+ | `jsonl` | `.jsonl` | Generic JSON Lines (streaming-capable) |
88
+ | `parquet` | `.parquet`| Columnar format (requires `pyarrow`) |
89
+ | `sharegpt` | `.json` | ShareGPT conversation format |
90
+ | `alpaca` | `.json` | Alpaca instruction format |
91
+ | `chatml` | `.json` | ChatML markup format |
92
+ | `conversation` | `.json` | Raw conversation schema export |
93
+ | `preference` | `.json` | DPO preference pairs (requires judge scores) |
94
+
95
+ ## Project Structure
96
+
97
+ This project follows a **Modular Monolith** architecture.
98
+
99
+ ```text
100
+ distill-align/
101
+ ├── src/distill_align/ # Core application package
102
+ │ ├── core/ # Config, schemas, logging, caching, checkpointing
103
+ │ ├── ingestion/ # Data loaders and chunkers (PDF, DOCX, HTML, code, etc.)
104
+ │ ├── synthesis/ # LLM clients, worker pool, prompts, judge, cost tracking
105
+ │ │ └── models/ # Provider-specific clients (OpenAI, Anthropic, Gemini, Azure, Ollama, vLLM)
106
+ │ ├── exporter/ # Formatters, validator, splitter, preference generator
107
+ │ │ └── formatters/ # Output format converters (JSONL, Parquet, ShareGPT, Alpaca, etc.)
108
+ │ ├── tui/ # Textual terminal UI
109
+ │ └── cli/ # Typer CLI entry points
110
+ ├── tests/ # Pytest suite
111
+ └── docs/ # Documentation (MkDocs)
112
+ ```
113
+
114
+ ## Development
115
+
116
+ 1. Clone the repository
117
+ 2. Install dependencies with Poetry: `poetry install`
118
+ 3. Install dev dependencies: `poetry install --with dev`
119
+ 4. Run tests: `poetry run pytest`
120
+ 5. Run linting: `poetry run ruff check src/`
121
+
122
+ ## License
123
+
124
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,132 @@
1
+ [tool.poetry]
2
+ name = "distill-align"
3
+ version = "0.1.1"
4
+ description = "The Structured Reasoning Extraction Factory — Generate high-quality fine-tuning datasets from raw domain data"
5
+ authors = ["o69dn"]
6
+ readme = "README.md"
7
+ license = "MIT"
8
+ homepage = "https://github.com/o69dn/Distill-Align"
9
+ repository = "https://github.com/o69dn/Distill-Align"
10
+ documentation = "https://o69dn.github.io/Distill-Align/"
11
+ keywords = ["llm", "fine-tuning", "dataset", "distillation", "unsloth", "synthesis"]
12
+ packages = [{include = "distill_align", from = "src"}]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Intended Audience :: Science/Research",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
23
+ "Topic :: Software Development :: Libraries :: Python Modules",
24
+ ]
25
+
26
+ [tool.poetry.dependencies]
27
+ python = "^3.11"
28
+ # CLI & TUI
29
+ typer = ">=0.13.0"
30
+ textual = "^0.58.0"
31
+ rich = "^13.7.0"
32
+ # Data Validation
33
+ pydantic = "^2.7.0"
34
+ pydantic-settings = "^2.2.0"
35
+ # Async HTTP
36
+ httpx = ">=0.27.0"
37
+ # PDF Parsing
38
+ pypdf = "^4.2.0"
39
+ # Logging
40
+ loguru = "^0.7.0"
41
+ # Templates
42
+ jinja2 = "^3.1.0"
43
+ # Config file support
44
+ pyyaml = "^6.0"
45
+ # Token counting
46
+ tiktoken = ">=0.7.0"
47
+ # Loaders
48
+ python-docx = ">=1.1.0"
49
+ beautifulsoup4 = ">=4.12.0"
50
+ # Optional: HuggingFace Hub support
51
+ huggingface_hub = {version = "^0.23.0", optional = true}
52
+ # Optional: Parquet export
53
+ pyarrow = {version = ">=14.0.0", optional = true}
54
+
55
+ [tool.poetry.extras]
56
+ hub = ["huggingface_hub"]
57
+ parquet = ["pyarrow"]
58
+ all = ["huggingface_hub", "pyarrow"]
59
+
60
+ [tool.poetry.group.dev.dependencies]
61
+ pytest = "^9.0.0"
62
+ pytest-asyncio = ">=0.25.0"
63
+ pytest-cov = "^5.0.0"
64
+ pytest-httpx = "^0.36.0"
65
+ pre-commit = "^3.7.0"
66
+ mypy = "^1.10.0"
67
+ ruff = "^0.9.0"
68
+ mkdocs = "^1.6.0"
69
+ mkdocs-material = "^9.5.0"
70
+
71
+ [tool.poetry.group.benchmark.dependencies]
72
+ pytest-benchmark = "^4.0"
73
+
74
+ [tool.poetry.group.property.dependencies]
75
+ hypothesis = "^6.0"
76
+
77
+ [build-system]
78
+ requires = ["poetry-core"]
79
+ build-backend = "poetry.core.masonry.api"
80
+
81
+ [tool.poetry.scripts]
82
+ distill-align = "distill_align.cli.main:entry_point"
83
+
84
+ # Ruff Configuration
85
+ [tool.ruff]
86
+ line-length = 120
87
+ target-version = "py311"
88
+
89
+ [tool.ruff.lint]
90
+ select = [
91
+ "E", # pycodestyle errors
92
+ "W", # pycodestyle warnings
93
+ "F", # Pyflakes
94
+ "I", # isort
95
+ "N", # pep8-naming
96
+ "UP", # pyupgrade
97
+ "B", # flake8-bugbear
98
+ "C4", # flake8-comprehensions
99
+ "SIM", # flake8-simplify
100
+ ]
101
+ ignore = ["E501"] # Line too long (handled by formatter)
102
+
103
+ [tool.ruff.format]
104
+ quote-style = "double"
105
+ indent-style = "space"
106
+ skip-magic-trailing-comma = false
107
+ line-ending = "auto"
108
+
109
+ # Pytest Configuration
110
+ [tool.pytest.ini_options]
111
+ asyncio_mode = "auto"
112
+ testpaths = ["tests"]
113
+ python_files = ["test_*.py"]
114
+ python_classes = ["Test*"]
115
+ python_functions = ["test_*"]
116
+ addopts = "-v --tb=short --cov=distill_align --cov-report=term-missing --cov-report=xml --cov-report=html --cov-fail-under=25"
117
+
118
+ # Bandit Configuration
119
+ [tool.bandit]
120
+ exclude_dirs = ["tests", ".github"]
121
+ skips = ["B110", "B112", "B311"]
122
+
123
+ # MyPy Configuration
124
+ [tool.mypy]
125
+ python_version = "3.11"
126
+ warn_return_any = true
127
+ warn_unused_configs = true
128
+ disallow_untyped_defs = false
129
+ check_untyped_defs = true
130
+ no_implicit_optional = true
131
+ show_error_codes = true
132
+ plugins = "pydantic.mypy"
@@ -0,0 +1,9 @@
1
+ """
2
+ Distill-Align: The Structured Reasoning Extraction Factory
3
+
4
+ A CLI/Python framework for automating the generation of high-quality,
5
+ fine-tuning datasets from raw domain data.
6
+ """
7
+
8
+ __version__ = "0.1.1"
9
+ __author__ = "Distill-Align Contributors"
@@ -0,0 +1 @@
1
+ """CLI module: Typer entry points for the Distill-Align framework."""