licos-dev-sdk 0.2.6__tar.gz → 0.2.8__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 (20) hide show
  1. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/PKG-INFO +3 -1
  2. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/pyproject.toml +5 -3
  3. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/__init__.py +15 -13
  4. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/document.py +25 -3
  5. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/model.py +563 -573
  6. licos_dev_sdk-0.2.8/src/licos_dev_sdk/spreadsheet.py +199 -0
  7. licos_dev_sdk-0.2.8/tests/test_document_spreadsheet.py +58 -0
  8. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/tests/test_model.py +269 -269
  9. licos_dev_sdk-0.2.6/src/licos_dev_sdk/spreadsheet.py +0 -75
  10. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/.gitignore +0 -0
  11. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/_utils.py +0 -0
  12. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/archive.py +0 -0
  13. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/chart.py +0 -0
  14. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/data.py +0 -0
  15. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/diagram.py +0 -0
  16. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/image.py +0 -0
  17. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/observability.py +0 -0
  18. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/presentation.py +0 -0
  19. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/src/licos_dev_sdk/web.py +0 -0
  20. {licos_dev_sdk-0.2.6 → licos_dev_sdk-0.2.8}/tests/test_observability.py +0 -0
@@ -1,8 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: licos-dev-sdk
3
- Version: 0.2.6
3
+ Version: 0.2.8
4
4
  Summary: LICOS Dev SDK - file generation and model capability clients
5
5
  Requires-Python: >=3.10
6
+ Requires-Dist: docxtpl>=0.16
6
7
  Requires-Dist: graphviz>=0.20
7
8
  Requires-Dist: jinja2>=3.1
8
9
  Requires-Dist: licos-platform-sdk>=0.2.8
@@ -16,3 +17,4 @@ Requires-Dist: python-pptx>=1.0
16
17
  Requires-Dist: pyyaml>=6.0
17
18
  Requires-Dist: qrcode[pil]>=8.0
18
19
  Requires-Dist: weasyprint>=62.0
20
+ Requires-Dist: xlsxwriter>=3.2
@@ -4,14 +4,16 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "licos-dev-sdk"
7
- version = "0.2.6"
7
+ version = "0.2.8"
8
8
  description = "LICOS Dev SDK - file generation and model capability clients"
9
9
  requires-python = ">=3.10"
10
10
  dependencies = [
11
11
  "licos-platform-sdk>=0.2.8",
12
12
  "weasyprint>=62.0",
13
- "python-docx>=1.1",
14
- "openpyxl>=3.1",
13
+ "python-docx>=1.1",
14
+ "docxtpl>=0.16",
15
+ "openpyxl>=3.1",
16
+ "xlsxwriter>=3.2",
15
17
  "python-pptx>=1.0",
16
18
  "matplotlib>=3.9",
17
19
  "graphviz>=0.20",
@@ -23,12 +23,14 @@ def __getattr__(name: str):
23
23
  "create_html": ("web", "create_html"),
24
24
  "create_markdown": ("web", "create_markdown"),
25
25
  "markdown_to_html": ("web", "markdown_to_html"),
26
- # document
27
- "create_pdf": ("document", "create_pdf"),
28
- "create_docx": ("document", "create_docx"),
29
- # spreadsheet
30
- "create_xlsx": ("spreadsheet", "create_xlsx"),
31
- "create_csv": ("spreadsheet", "create_csv"),
26
+ # document
27
+ "create_pdf": ("document", "create_pdf"),
28
+ "create_docx": ("document", "create_docx"),
29
+ "create_docx_from_template": ("document", "create_docx_from_template"),
30
+ # spreadsheet
31
+ "create_xlsx": ("spreadsheet", "create_xlsx"),
32
+ "create_xlsx_workbook": ("spreadsheet", "create_xlsx_workbook"),
33
+ "create_csv": ("spreadsheet", "create_csv"),
32
34
  # chart
33
35
  "create_chart": ("chart", "create_chart"),
34
36
  # diagram
@@ -41,9 +43,9 @@ def __getattr__(name: str):
41
43
  "ModelResult": ("model", "ModelResult"),
42
44
  "ApiError": ("model", "ApiError"),
43
45
  "ConfigurationError": ("model", "ConfigurationError"),
44
- "LLMClient": ("model", "LLMClient"),
45
- "create_chat_openai": ("model", "create_chat_openai"),
46
- "VisionClient": ("model", "VisionClient"),
46
+ "LLMClient": ("model", "LLMClient"),
47
+ "create_chat_openai": ("model", "create_chat_openai"),
48
+ "VisionClient": ("model", "VisionClient"),
47
49
  "VisionUnderstandingClient": ("model", "VisionUnderstandingClient"),
48
50
  "ImageGenerationClient": ("model", "ImageGenerationClient"),
49
51
  "VideoGenerationClient": ("model", "VideoGenerationClient"),
@@ -85,15 +87,15 @@ __all__ = [
85
87
  "create_json", "create_xml", "create_yaml",
86
88
  "create_zip", "create_tar_gz",
87
89
  "create_qrcode", "create_barcode", "create_watermark",
88
- "create_html", "create_markdown", "markdown_to_html",
89
- "create_pdf", "create_docx",
90
- "create_xlsx", "create_csv",
90
+ "create_html", "create_markdown", "markdown_to_html",
91
+ "create_pdf", "create_docx", "create_docx_from_template",
92
+ "create_xlsx", "create_xlsx_workbook", "create_csv",
91
93
  "create_chart",
92
94
  "create_diagram",
93
95
  "create_pptx",
94
96
  "ModelRuntime", "ModelEndpoint", "ModelResult",
95
97
  "ApiError", "ConfigurationError",
96
- "LLMClient", "create_chat_openai", "VisionClient", "VisionUnderstandingClient", "ImageGenerationClient", "VideoGenerationClient",
98
+ "LLMClient", "create_chat_openai", "VisionClient", "VisionUnderstandingClient", "ImageGenerationClient", "VideoGenerationClient",
97
99
  "SpeechRecognitionClient", "ASRClient",
98
100
  "fetch_model_catalogs", "fetch_model_detail", "resolve_llm_endpoint", "resolve_vision_endpoint",
99
101
  "resolve_image_generation_endpoint", "resolve_video_generation_endpoint",
@@ -2,11 +2,10 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- import mistune
6
- from weasyprint import HTML
5
+ from typing import Any
6
+
7
7
  from docx import Document
8
8
  from docx.shared import Pt, Inches
9
- from docx.enum.text import WD_ALIGN_PARAGRAPH
10
9
 
11
10
  from ._utils import resolve_output_path
12
11
 
@@ -29,6 +28,9 @@ blockquote { border-left: 3px solid #ccc; margin-left: 0; padding-left: 1em; col
29
28
  def create_pdf(content: str, filename: str, *, content_type: str = "markdown",
30
29
  output_dir: str | None = None, page_size: str = "A4") -> str:
31
30
  """Generate a PDF file from Markdown or HTML. Returns absolute path."""
31
+ import mistune
32
+ from weasyprint import HTML
33
+
32
34
  path = resolve_output_path(filename, ".pdf", output_dir)
33
35
  html_body = mistune.html(content) if content_type == "markdown" else content
34
36
  css = _PDF_CSS.replace("{page_size}", page_size)
@@ -96,3 +98,23 @@ def create_docx(content: str, filename: str, *, content_type: str = "markdown",
96
98
 
97
99
  doc.save(str(path))
98
100
  return str(path.resolve())
101
+
102
+
103
+ def create_docx_from_template(template_path: str, data: dict[str, Any], filename: str, *,
104
+ output_dir: str | None = None) -> str:
105
+ """Render a DOCX template with Jinja-style placeholders.
106
+
107
+ The template must be a `.docx` file. Placeholders use docxtpl syntax, for example
108
+ `{{ customer_name }}` or `{% for item in items %}...{% endfor %}`.
109
+ Returns the absolute path of the generated document.
110
+ """
111
+ if not isinstance(data, dict):
112
+ raise TypeError("data must be a dict")
113
+
114
+ from docxtpl import DocxTemplate
115
+
116
+ path = resolve_output_path(filename, ".docx", output_dir)
117
+ doc = DocxTemplate(template_path)
118
+ doc.render(data)
119
+ doc.save(str(path))
120
+ return str(path.resolve())