pyreportkit 0.1.0__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.
- pyreportkit-0.1.0/LICENSE +21 -0
- pyreportkit-0.1.0/PKG-INFO +187 -0
- pyreportkit-0.1.0/README.md +146 -0
- pyreportkit-0.1.0/pyproject.toml +63 -0
- pyreportkit-0.1.0/setup.cfg +4 -0
- pyreportkit-0.1.0/src/pyreportkit.egg-info/PKG-INFO +187 -0
- pyreportkit-0.1.0/src/pyreportkit.egg-info/SOURCES.txt +225 -0
- pyreportkit-0.1.0/src/pyreportkit.egg-info/dependency_links.txt +1 -0
- pyreportkit-0.1.0/src/pyreportkit.egg-info/requires.txt +20 -0
- pyreportkit-0.1.0/src/pyreportkit.egg-info/top_level.txt +1 -0
- pyreportkit-0.1.0/src/reportkit/__init__.py +0 -0
- pyreportkit-0.1.0/src/reportkit/components/__init__.py +45 -0
- pyreportkit-0.1.0/src/reportkit/components/document/__init__.py +6 -0
- pyreportkit-0.1.0/src/reportkit/components/document/footer.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/document/header.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/document/page.py +18 -0
- pyreportkit-0.1.0/src/reportkit/components/document/report.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/information/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/components/information/info_grid.py +23 -0
- pyreportkit-0.1.0/src/reportkit/components/information/key_value.py +28 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/__init__.py +9 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/box.py +10 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/column.py +15 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/divider.py +10 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/grid.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/row.py +15 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/section.py +10 -0
- pyreportkit-0.1.0/src/reportkit/components/layout/spacer.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/media/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/components/media/chart.py +14 -0
- pyreportkit-0.1.0/src/reportkit/components/media/image.py +25 -0
- pyreportkit-0.1.0/src/reportkit/components/pagination/__init__.py +5 -0
- pyreportkit-0.1.0/src/reportkit/components/pagination/page_break.py +10 -0
- pyreportkit-0.1.0/src/reportkit/components/pagination/page_count.py +10 -0
- pyreportkit-0.1.0/src/reportkit/components/pagination/page_number.py +21 -0
- pyreportkit-0.1.0/src/reportkit/components/table/__init__.py +7 -0
- pyreportkit-0.1.0/src/reportkit/components/table/cell.py +27 -0
- pyreportkit-0.1.0/src/reportkit/components/table/column.py +29 -0
- pyreportkit-0.1.0/src/reportkit/components/table/row.py +25 -0
- pyreportkit-0.1.0/src/reportkit/components/table/style.py +18 -0
- pyreportkit-0.1.0/src/reportkit/components/table/table.py +27 -0
- pyreportkit-0.1.0/src/reportkit/components/typography/__init__.py +6 -0
- pyreportkit-0.1.0/src/reportkit/components/typography/heading.py +13 -0
- pyreportkit-0.1.0/src/reportkit/components/typography/rich_text.py +23 -0
- pyreportkit-0.1.0/src/reportkit/components/typography/text.py +12 -0
- pyreportkit-0.1.0/src/reportkit/components/typography/text_span.py +24 -0
- pyreportkit-0.1.0/src/reportkit/core/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/core/component.py +12 -0
- pyreportkit-0.1.0/src/reportkit/core/container.py +66 -0
- pyreportkit-0.1.0/src/reportkit/core/exceptions.py +0 -0
- pyreportkit-0.1.0/src/reportkit/core/factory.py +53 -0
- pyreportkit-0.1.0/src/reportkit/core/registry.py +50 -0
- pyreportkit-0.1.0/src/reportkit/core/serializer.py +90 -0
- pyreportkit-0.1.0/src/reportkit/exporters/__init__.py +0 -0
- pyreportkit-0.1.0/src/reportkit/exporters/base.py +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/__init__.py +8 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/exceptions.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/exporter.py +68 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/__init__.py +34 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/base.py +27 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/information.py +55 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/__init__.py +7 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/columns.py +48 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/data.py +46 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/page.py +24 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/spacing.py +30 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/layout/stack.py +13 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/media.py +46 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/registry.py +22 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/table/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/table/cells.py +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/table/data.py +38 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/table/renderer.py +64 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/table/widths.py +29 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/renderers/text.py +40 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/styles.py +130 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/values/__init__.py +5 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/values/cells.py +60 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/values/components.py +16 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/values/formats.py +31 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/values/numbers.py +19 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/workbook/__init__.py +5 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/workbook/data.py +48 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/workbook/formatted.py +63 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/workbook/styles.py +27 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/workbook/workbook.py +65 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/__init__.py +5 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/borders.py +30 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/cells.py +38 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/constants.py +12 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/data.py +51 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/formatted.py +158 -0
- pyreportkit-0.1.0/src/reportkit/exporters/excel/worksheet/page.py +23 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/__init__.py +6 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/assets.py +87 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/direction.py +15 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/engine.py +37 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/exporter.py +38 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/components.py +47 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/margins.py +24 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/numbering.py +31 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/resolver.py +37 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/running.py +30 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/styles.py +22 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/page/validator.py +76 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/registry.py +45 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/__init__.py +37 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/base.py +20 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/document/__init__.py +6 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/document/footer.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/document/header.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/document/page.py +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/document/report.py +16 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/information/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/information/info_grid.py +26 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/information/key_value.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/__init__.py +9 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/box.py +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/column.py +41 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/divider.py +16 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/grid.py +48 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/row.py +35 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/section.py +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/layout/spacer.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/media/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/media/image.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/pagination/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/pagination/page_break.py +15 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/pagination/page_number.py +15 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/table/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/table/cell.py +77 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/table/table.py +69 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/typography/__init__.py +5 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/typography/heading.py +18 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/typography/rich_text.py +28 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/renderers/typography/text.py +16 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/base.css +45 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/information.css +83 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/layout.css +81 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/media.css +10 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/pdf.css +96 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/print.css +91 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/table.css +222 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/tokens.css +68 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/static/typography.css +54 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/styles.py +167 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/document/footer.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/document/header.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/document/page.html +8 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/document/report.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/information/info_grid.html +6 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/information/key_value.html +9 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/box.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/column.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/divider.html +1 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/grid.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/row.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/section.html +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/layout/spacer.html +1 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/media/image.html +8 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/pagination/page_break.html +1 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/pagination/page_number.html +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/table/cell.html +7 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/table/table.html +34 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/typography/heading.html +1 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/typography/rich_text.html +5 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/components/typography/text.html +1 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates/document.html +17 -0
- pyreportkit-0.1.0/src/reportkit/exporters/html/templates.py +30 -0
- pyreportkit-0.1.0/src/reportkit/exporters/json.py +0 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/__init__.py +8 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/conversion.py +104 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/dependencies.py +12 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/exceptions.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/exporter.py +16 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/resources/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/resources/fetcher.py +37 -0
- pyreportkit-0.1.0/src/reportkit/exporters/pdf/resources/policy.py +60 -0
- pyreportkit-0.1.0/src/reportkit/exporters/registry.py +50 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/__init__.py +8 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/document/__init__.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/document/document.py +74 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/document/engine.py +71 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/exceptions.py +4 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/exporter.py +32 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/__init__.py +24 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/base.py +56 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/information.py +30 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/layout/__init__.py +6 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/layout/columns.py +82 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/layout/page.py +38 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/layout/spacing.py +33 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/layout/stack.py +50 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/media.py +49 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/registry.py +22 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/table/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/table/cells.py +39 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/table/renderer.py +95 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/table/widths.py +12 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/renderers/text.py +40 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/styles/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/styles/text.py +90 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/styles/xml.py +147 -0
- pyreportkit-0.1.0/src/reportkit/exporters/word/values.py +36 -0
- pyreportkit-0.1.0/src/reportkit/formatting/__init__.py +0 -0
- pyreportkit-0.1.0/src/reportkit/formatting/cell.py +12 -0
- pyreportkit-0.1.0/src/reportkit/formatting/cells.py +41 -0
- pyreportkit-0.1.0/src/reportkit/formatting/values.py +106 -0
- pyreportkit-0.1.0/src/reportkit/rendering/__init__.py +0 -0
- pyreportkit-0.1.0/src/reportkit/rendering/context.py +31 -0
- pyreportkit-0.1.0/src/reportkit/rendering/table.py +56 -0
- pyreportkit-0.1.0/src/reportkit/rendering/tracks.py +51 -0
- pyreportkit-0.1.0/src/reportkit/rendering/visitor.py +55 -0
- pyreportkit-0.1.0/src/reportkit/report.py +0 -0
- pyreportkit-0.1.0/src/reportkit/styles/__init__.py +0 -0
- pyreportkit-0.1.0/src/reportkit/styles/borders.py +6 -0
- pyreportkit-0.1.0/src/reportkit/styles/style.py +117 -0
- pyreportkit-0.1.0/src/reportkit/styles/table.py +37 -0
- pyreportkit-0.1.0/src/reportkit/styles/theme.py +45 -0
- pyreportkit-0.1.0/src/reportkit/styles/tokens.py +29 -0
- pyreportkit-0.1.0/src/reportkit/validators/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/validators/table/__init__.py +3 -0
- pyreportkit-0.1.0/src/reportkit/validators/table/cell.py +38 -0
- pyreportkit-0.1.0/src/reportkit/validators/table/column.py +62 -0
- pyreportkit-0.1.0/src/reportkit/validators/table/row.py +37 -0
- pyreportkit-0.1.0/src/reportkit/validators/table/table.py +63 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Abdullah Alaidrous
|
|
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,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyreportkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Build bilingual (Arabic/English, RTL/LTR) reports from reusable components and export them to HTML, PDF, Excel and Word.
|
|
5
|
+
Author: Abdullah Alaidrous
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/abdalaidrous/reportkit
|
|
8
|
+
Project-URL: Repository, https://github.com/abdalaidrous/reportkit
|
|
9
|
+
Project-URL: Issues, https://github.com/abdalaidrous/reportkit/issues
|
|
10
|
+
Keywords: report,reporting,pdf,excel,xlsx,docx,html,arabic,rtl
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: Arabic
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Office/Business
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: Jinja2>=3.1
|
|
26
|
+
Provides-Extra: pdf
|
|
27
|
+
Requires-Dist: weasyprint>=70; extra == "pdf"
|
|
28
|
+
Provides-Extra: excel
|
|
29
|
+
Requires-Dist: openpyxl>=3.1; extra == "excel"
|
|
30
|
+
Requires-Dist: pillow>=10; extra == "excel"
|
|
31
|
+
Provides-Extra: word
|
|
32
|
+
Requires-Dist: python-docx>=1.1; extra == "word"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: weasyprint>=70; extra == "all"
|
|
35
|
+
Requires-Dist: openpyxl>=3.1; extra == "all"
|
|
36
|
+
Requires-Dist: pillow>=10; extra == "all"
|
|
37
|
+
Requires-Dist: python-docx>=1.1; extra == "all"
|
|
38
|
+
Provides-Extra: test
|
|
39
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# ReportKit
|
|
43
|
+
|
|
44
|
+
Build reports from reusable components and export the same report to **HTML**, **PDF**, **Excel (XLSX)** and **Word (DOCX)**.
|
|
45
|
+
ReportKit is built for bilingual Arabic/English documents: right-to-left and left-to-right text, mixed-direction values
|
|
46
|
+
and RTL tables are handled in every format.
|
|
47
|
+
|
|
48
|
+
ReportKit is a presentation library. Your application prepares the rows, totals and summaries; ReportKit only lays them
|
|
49
|
+
out, styles them and exports them. It never computes or aggregates report data.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install pyreportkit # HTML export
|
|
55
|
+
pip install "pyreportkit[pdf]" # + PDF (WeasyPrint)
|
|
56
|
+
pip install "pyreportkit[excel]" # + Excel (openpyxl, Pillow)
|
|
57
|
+
pip install "pyreportkit[word]" # + Word (python-docx)
|
|
58
|
+
pip install "pyreportkit[all]" # every exporter
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
PDF export uses [WeasyPrint](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html), which needs the Pango
|
|
62
|
+
system libraries (`apt install libpango-1.0-0 libpangoft2-1.0-0` on Debian/Ubuntu). On Windows, the simplest option is
|
|
63
|
+
the provided `Dockerfile`.
|
|
64
|
+
|
|
65
|
+
Requires Python 3.10 or newer.
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from reportkit.components.document import Page, Report
|
|
71
|
+
from reportkit.components.layout import Grid
|
|
72
|
+
from reportkit.components.table import Table, TableCell, TableColumn, TableRow
|
|
73
|
+
from reportkit.components.typography import Heading, Text
|
|
74
|
+
from reportkit.rendering.context import RenderingContext
|
|
75
|
+
from reportkit.styles.style import Style
|
|
76
|
+
|
|
77
|
+
report = Report(title="Financial Movement Report", children=[
|
|
78
|
+
Page(size="A4", orientation="portrait", page_number_position="bottom-center", children=[
|
|
79
|
+
Grid(columns="1fr 1fr", children=[
|
|
80
|
+
Heading(value="تقرير الحركة المالية", level=2, style=Style(text_align="right")),
|
|
81
|
+
Text(value="Financial Movement Report", style=Style(text_align="left")),
|
|
82
|
+
]),
|
|
83
|
+
Table(
|
|
84
|
+
columns=[
|
|
85
|
+
TableColumn(key="voucher", title="رقم السند", subtitle="Voucher No."),
|
|
86
|
+
TableColumn(key="date", title="التاريخ", subtitle="Date"),
|
|
87
|
+
TableColumn(key="amount", title="المبلغ", subtitle="Amount", format="number"),
|
|
88
|
+
],
|
|
89
|
+
rows=[
|
|
90
|
+
TableRow(values={
|
|
91
|
+
"voucher": "000004",
|
|
92
|
+
"date": TableCell(children=[Text(value="14/11/2026"), Text(value="12:47 AM", style=Style(font_size=9, color="#777777"))]),
|
|
93
|
+
"amount": 200,
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
footer=TableRow(values={"voucher": "الإجمالي", "amount": 200}, kind="total"),
|
|
97
|
+
),
|
|
98
|
+
]),
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
context = RenderingContext(language="ar", direction="rtl")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Rows can be any iterable, including generators and database cursors: they are read one at a time and never loaded into
|
|
105
|
+
a list.
|
|
106
|
+
|
|
107
|
+
## Exporting
|
|
108
|
+
|
|
109
|
+
Every exporter returns `bytes`; saving or sending them is up to your application.
|
|
110
|
+
|
|
111
|
+
### HTML
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import reportkit.exporters.html
|
|
115
|
+
from reportkit.exporters.html.exporter import HtmlExporter
|
|
116
|
+
|
|
117
|
+
html = HtmlExporter().export(report, context)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### PDF
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from reportkit.exporters.pdf import PdfExporter
|
|
124
|
+
|
|
125
|
+
pdf = PdfExporter.export(report, context)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The PDF is rendered from the same HTML and CSS. Only embedded images (`data:` URIs) and files inside an optional
|
|
129
|
+
`base_url` folder are loaded; network resources are refused, and any resource that cannot be loaded fails the export
|
|
130
|
+
instead of producing an incomplete PDF.
|
|
131
|
+
|
|
132
|
+
### Excel
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from reportkit.exporters.excel import ExcelExporter, ExcelOptions
|
|
136
|
+
|
|
137
|
+
xlsx = ExcelExporter().export(report, context) # looks like the PDF
|
|
138
|
+
xlsx = ExcelExporter().export(report, context, ExcelOptions(mode="data", streaming=True)) # one typed sheet per table
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
- `formatted` (default): one printable sheet with merged cells, colors, borders, logo, RTL and print settings.
|
|
142
|
+
- `data`: analysis-ready sheets with real numbers and dates, frozen headers and AutoFilter. With `streaming=True` memory
|
|
143
|
+
stays flat, which is the right choice for very large reports.
|
|
144
|
+
- Values are written as they arrive: no formulas, text is always stored as text (formula injection safe), and decimals
|
|
145
|
+
beyond Excel's 15 significant digits raise an error unless `decimal_policy="text"`.
|
|
146
|
+
|
|
147
|
+
### Word
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from reportkit.exporters.word import WordExporter
|
|
151
|
+
|
|
152
|
+
docx = WordExporter().export(report, context)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Tables repeat their header row on every page, repeating headers and footers go to the Word page header and footer, and
|
|
156
|
+
page numbers use Word's PAGE and NUMPAGES fields.
|
|
157
|
+
|
|
158
|
+
### Exporter registry
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import reportkit.exporters.html, reportkit.exporters.pdf, reportkit.exporters.excel, reportkit.exporters.word
|
|
162
|
+
from reportkit.exporters.registry import ExporterRegistry
|
|
163
|
+
|
|
164
|
+
exporter = ExporterRegistry.get("xlsx")() # "html", "pdf", "excel"/"xlsx", "word"/"docx"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Components
|
|
168
|
+
|
|
169
|
+
| Group | Components |
|
|
170
|
+
|---|---|
|
|
171
|
+
| Document | `Report`, `Page`, `Header`, `Footer` |
|
|
172
|
+
| Layout | `Box`, `Section`, `Row`, `Column`, `Grid`, `Spacer`, `Divider` |
|
|
173
|
+
| Typography | `Text`, `Heading`, `RichText`, `TextSpan` |
|
|
174
|
+
| Tables | `Table`, `TableColumn`, `TableRow`, `TableCell`, `TableStyle` |
|
|
175
|
+
| Information | `KeyValue`, `InfoGrid` |
|
|
176
|
+
| Media | `Image` |
|
|
177
|
+
| Pagination | `PageBreak`, `PageNumber` |
|
|
178
|
+
|
|
179
|
+
Styles are immutable `Style` objects; table colors and spacing come from CSS design tokens shared by every exporter.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pip install -r requirements-dev.txt
|
|
185
|
+
python -m pytest tests
|
|
186
|
+
docker build -t reportkit . && docker run --rm reportkit # full suite, including PDF
|
|
187
|
+
```
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# ReportKit
|
|
2
|
+
|
|
3
|
+
Build reports from reusable components and export the same report to **HTML**, **PDF**, **Excel (XLSX)** and **Word (DOCX)**.
|
|
4
|
+
ReportKit is built for bilingual Arabic/English documents: right-to-left and left-to-right text, mixed-direction values
|
|
5
|
+
and RTL tables are handled in every format.
|
|
6
|
+
|
|
7
|
+
ReportKit is a presentation library. Your application prepares the rows, totals and summaries; ReportKit only lays them
|
|
8
|
+
out, styles them and exports them. It never computes or aggregates report data.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install pyreportkit # HTML export
|
|
14
|
+
pip install "pyreportkit[pdf]" # + PDF (WeasyPrint)
|
|
15
|
+
pip install "pyreportkit[excel]" # + Excel (openpyxl, Pillow)
|
|
16
|
+
pip install "pyreportkit[word]" # + Word (python-docx)
|
|
17
|
+
pip install "pyreportkit[all]" # every exporter
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
PDF export uses [WeasyPrint](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html), which needs the Pango
|
|
21
|
+
system libraries (`apt install libpango-1.0-0 libpangoft2-1.0-0` on Debian/Ubuntu). On Windows, the simplest option is
|
|
22
|
+
the provided `Dockerfile`.
|
|
23
|
+
|
|
24
|
+
Requires Python 3.10 or newer.
|
|
25
|
+
|
|
26
|
+
## Quick start
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from reportkit.components.document import Page, Report
|
|
30
|
+
from reportkit.components.layout import Grid
|
|
31
|
+
from reportkit.components.table import Table, TableCell, TableColumn, TableRow
|
|
32
|
+
from reportkit.components.typography import Heading, Text
|
|
33
|
+
from reportkit.rendering.context import RenderingContext
|
|
34
|
+
from reportkit.styles.style import Style
|
|
35
|
+
|
|
36
|
+
report = Report(title="Financial Movement Report", children=[
|
|
37
|
+
Page(size="A4", orientation="portrait", page_number_position="bottom-center", children=[
|
|
38
|
+
Grid(columns="1fr 1fr", children=[
|
|
39
|
+
Heading(value="تقرير الحركة المالية", level=2, style=Style(text_align="right")),
|
|
40
|
+
Text(value="Financial Movement Report", style=Style(text_align="left")),
|
|
41
|
+
]),
|
|
42
|
+
Table(
|
|
43
|
+
columns=[
|
|
44
|
+
TableColumn(key="voucher", title="رقم السند", subtitle="Voucher No."),
|
|
45
|
+
TableColumn(key="date", title="التاريخ", subtitle="Date"),
|
|
46
|
+
TableColumn(key="amount", title="المبلغ", subtitle="Amount", format="number"),
|
|
47
|
+
],
|
|
48
|
+
rows=[
|
|
49
|
+
TableRow(values={
|
|
50
|
+
"voucher": "000004",
|
|
51
|
+
"date": TableCell(children=[Text(value="14/11/2026"), Text(value="12:47 AM", style=Style(font_size=9, color="#777777"))]),
|
|
52
|
+
"amount": 200,
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
footer=TableRow(values={"voucher": "الإجمالي", "amount": 200}, kind="total"),
|
|
56
|
+
),
|
|
57
|
+
]),
|
|
58
|
+
])
|
|
59
|
+
|
|
60
|
+
context = RenderingContext(language="ar", direction="rtl")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Rows can be any iterable, including generators and database cursors: they are read one at a time and never loaded into
|
|
64
|
+
a list.
|
|
65
|
+
|
|
66
|
+
## Exporting
|
|
67
|
+
|
|
68
|
+
Every exporter returns `bytes`; saving or sending them is up to your application.
|
|
69
|
+
|
|
70
|
+
### HTML
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import reportkit.exporters.html
|
|
74
|
+
from reportkit.exporters.html.exporter import HtmlExporter
|
|
75
|
+
|
|
76
|
+
html = HtmlExporter().export(report, context)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### PDF
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from reportkit.exporters.pdf import PdfExporter
|
|
83
|
+
|
|
84
|
+
pdf = PdfExporter.export(report, context)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The PDF is rendered from the same HTML and CSS. Only embedded images (`data:` URIs) and files inside an optional
|
|
88
|
+
`base_url` folder are loaded; network resources are refused, and any resource that cannot be loaded fails the export
|
|
89
|
+
instead of producing an incomplete PDF.
|
|
90
|
+
|
|
91
|
+
### Excel
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from reportkit.exporters.excel import ExcelExporter, ExcelOptions
|
|
95
|
+
|
|
96
|
+
xlsx = ExcelExporter().export(report, context) # looks like the PDF
|
|
97
|
+
xlsx = ExcelExporter().export(report, context, ExcelOptions(mode="data", streaming=True)) # one typed sheet per table
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `formatted` (default): one printable sheet with merged cells, colors, borders, logo, RTL and print settings.
|
|
101
|
+
- `data`: analysis-ready sheets with real numbers and dates, frozen headers and AutoFilter. With `streaming=True` memory
|
|
102
|
+
stays flat, which is the right choice for very large reports.
|
|
103
|
+
- Values are written as they arrive: no formulas, text is always stored as text (formula injection safe), and decimals
|
|
104
|
+
beyond Excel's 15 significant digits raise an error unless `decimal_policy="text"`.
|
|
105
|
+
|
|
106
|
+
### Word
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from reportkit.exporters.word import WordExporter
|
|
110
|
+
|
|
111
|
+
docx = WordExporter().export(report, context)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Tables repeat their header row on every page, repeating headers and footers go to the Word page header and footer, and
|
|
115
|
+
page numbers use Word's PAGE and NUMPAGES fields.
|
|
116
|
+
|
|
117
|
+
### Exporter registry
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
import reportkit.exporters.html, reportkit.exporters.pdf, reportkit.exporters.excel, reportkit.exporters.word
|
|
121
|
+
from reportkit.exporters.registry import ExporterRegistry
|
|
122
|
+
|
|
123
|
+
exporter = ExporterRegistry.get("xlsx")() # "html", "pdf", "excel"/"xlsx", "word"/"docx"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Components
|
|
127
|
+
|
|
128
|
+
| Group | Components |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Document | `Report`, `Page`, `Header`, `Footer` |
|
|
131
|
+
| Layout | `Box`, `Section`, `Row`, `Column`, `Grid`, `Spacer`, `Divider` |
|
|
132
|
+
| Typography | `Text`, `Heading`, `RichText`, `TextSpan` |
|
|
133
|
+
| Tables | `Table`, `TableColumn`, `TableRow`, `TableCell`, `TableStyle` |
|
|
134
|
+
| Information | `KeyValue`, `InfoGrid` |
|
|
135
|
+
| Media | `Image` |
|
|
136
|
+
| Pagination | `PageBreak`, `PageNumber` |
|
|
137
|
+
|
|
138
|
+
Styles are immutable `Style` objects; table colors and spacing come from CSS design tokens shared by every exporter.
|
|
139
|
+
|
|
140
|
+
## Development
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pip install -r requirements-dev.txt
|
|
144
|
+
python -m pytest tests
|
|
145
|
+
docker build -t reportkit . && docker run --rm reportkit # full suite, including PDF
|
|
146
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
# The distribution is "pyreportkit"; the import name is "reportkit".
|
|
7
|
+
name = "pyreportkit"
|
|
8
|
+
version = "0.1.0"
|
|
9
|
+
description = "Build bilingual (Arabic/English, RTL/LTR) reports from reusable components and export them to HTML, PDF, Excel and Word."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
authors = [{ name = "Abdullah Alaidrous" }]
|
|
15
|
+
keywords = ["report", "reporting", "pdf", "excel", "xlsx", "docx", "html", "arabic", "rtl"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Natural Language :: Arabic",
|
|
20
|
+
"Natural Language :: English",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Office/Business",
|
|
27
|
+
"Topic :: Text Processing :: Markup :: HTML",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"Jinja2>=3.1",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.optional-dependencies]
|
|
34
|
+
pdf = [
|
|
35
|
+
"weasyprint>=70",
|
|
36
|
+
]
|
|
37
|
+
excel = [
|
|
38
|
+
"openpyxl>=3.1",
|
|
39
|
+
"pillow>=10",
|
|
40
|
+
]
|
|
41
|
+
word = [
|
|
42
|
+
"python-docx>=1.1",
|
|
43
|
+
]
|
|
44
|
+
all = [
|
|
45
|
+
"weasyprint>=70",
|
|
46
|
+
"openpyxl>=3.1",
|
|
47
|
+
"pillow>=10",
|
|
48
|
+
"python-docx>=1.1",
|
|
49
|
+
]
|
|
50
|
+
test = [
|
|
51
|
+
"pytest>=8",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[project.urls]
|
|
55
|
+
Homepage = "https://github.com/abdalaidrous/reportkit"
|
|
56
|
+
Repository = "https://github.com/abdalaidrous/reportkit"
|
|
57
|
+
Issues = "https://github.com/abdalaidrous/reportkit/issues"
|
|
58
|
+
|
|
59
|
+
[tool.setuptools.packages.find]
|
|
60
|
+
where = ["src"]
|
|
61
|
+
|
|
62
|
+
[tool.setuptools.package-data]
|
|
63
|
+
"reportkit.exporters.html" = ["templates/*.html", "templates/components/*/*.html", "static/*.css"]
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyreportkit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Build bilingual (Arabic/English, RTL/LTR) reports from reusable components and export them to HTML, PDF, Excel and Word.
|
|
5
|
+
Author: Abdullah Alaidrous
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/abdalaidrous/reportkit
|
|
8
|
+
Project-URL: Repository, https://github.com/abdalaidrous/reportkit
|
|
9
|
+
Project-URL: Issues, https://github.com/abdalaidrous/reportkit/issues
|
|
10
|
+
Keywords: report,reporting,pdf,excel,xlsx,docx,html,arabic,rtl
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: Arabic
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Office/Business
|
|
21
|
+
Classifier: Topic :: Text Processing :: Markup :: HTML
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: Jinja2>=3.1
|
|
26
|
+
Provides-Extra: pdf
|
|
27
|
+
Requires-Dist: weasyprint>=70; extra == "pdf"
|
|
28
|
+
Provides-Extra: excel
|
|
29
|
+
Requires-Dist: openpyxl>=3.1; extra == "excel"
|
|
30
|
+
Requires-Dist: pillow>=10; extra == "excel"
|
|
31
|
+
Provides-Extra: word
|
|
32
|
+
Requires-Dist: python-docx>=1.1; extra == "word"
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: weasyprint>=70; extra == "all"
|
|
35
|
+
Requires-Dist: openpyxl>=3.1; extra == "all"
|
|
36
|
+
Requires-Dist: pillow>=10; extra == "all"
|
|
37
|
+
Requires-Dist: python-docx>=1.1; extra == "all"
|
|
38
|
+
Provides-Extra: test
|
|
39
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
40
|
+
Dynamic: license-file
|
|
41
|
+
|
|
42
|
+
# ReportKit
|
|
43
|
+
|
|
44
|
+
Build reports from reusable components and export the same report to **HTML**, **PDF**, **Excel (XLSX)** and **Word (DOCX)**.
|
|
45
|
+
ReportKit is built for bilingual Arabic/English documents: right-to-left and left-to-right text, mixed-direction values
|
|
46
|
+
and RTL tables are handled in every format.
|
|
47
|
+
|
|
48
|
+
ReportKit is a presentation library. Your application prepares the rows, totals and summaries; ReportKit only lays them
|
|
49
|
+
out, styles them and exports them. It never computes or aggregates report data.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install pyreportkit # HTML export
|
|
55
|
+
pip install "pyreportkit[pdf]" # + PDF (WeasyPrint)
|
|
56
|
+
pip install "pyreportkit[excel]" # + Excel (openpyxl, Pillow)
|
|
57
|
+
pip install "pyreportkit[word]" # + Word (python-docx)
|
|
58
|
+
pip install "pyreportkit[all]" # every exporter
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
PDF export uses [WeasyPrint](https://doc.courtbouillon.org/weasyprint/stable/first_steps.html), which needs the Pango
|
|
62
|
+
system libraries (`apt install libpango-1.0-0 libpangoft2-1.0-0` on Debian/Ubuntu). On Windows, the simplest option is
|
|
63
|
+
the provided `Dockerfile`.
|
|
64
|
+
|
|
65
|
+
Requires Python 3.10 or newer.
|
|
66
|
+
|
|
67
|
+
## Quick start
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from reportkit.components.document import Page, Report
|
|
71
|
+
from reportkit.components.layout import Grid
|
|
72
|
+
from reportkit.components.table import Table, TableCell, TableColumn, TableRow
|
|
73
|
+
from reportkit.components.typography import Heading, Text
|
|
74
|
+
from reportkit.rendering.context import RenderingContext
|
|
75
|
+
from reportkit.styles.style import Style
|
|
76
|
+
|
|
77
|
+
report = Report(title="Financial Movement Report", children=[
|
|
78
|
+
Page(size="A4", orientation="portrait", page_number_position="bottom-center", children=[
|
|
79
|
+
Grid(columns="1fr 1fr", children=[
|
|
80
|
+
Heading(value="تقرير الحركة المالية", level=2, style=Style(text_align="right")),
|
|
81
|
+
Text(value="Financial Movement Report", style=Style(text_align="left")),
|
|
82
|
+
]),
|
|
83
|
+
Table(
|
|
84
|
+
columns=[
|
|
85
|
+
TableColumn(key="voucher", title="رقم السند", subtitle="Voucher No."),
|
|
86
|
+
TableColumn(key="date", title="التاريخ", subtitle="Date"),
|
|
87
|
+
TableColumn(key="amount", title="المبلغ", subtitle="Amount", format="number"),
|
|
88
|
+
],
|
|
89
|
+
rows=[
|
|
90
|
+
TableRow(values={
|
|
91
|
+
"voucher": "000004",
|
|
92
|
+
"date": TableCell(children=[Text(value="14/11/2026"), Text(value="12:47 AM", style=Style(font_size=9, color="#777777"))]),
|
|
93
|
+
"amount": 200,
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
footer=TableRow(values={"voucher": "الإجمالي", "amount": 200}, kind="total"),
|
|
97
|
+
),
|
|
98
|
+
]),
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
context = RenderingContext(language="ar", direction="rtl")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Rows can be any iterable, including generators and database cursors: they are read one at a time and never loaded into
|
|
105
|
+
a list.
|
|
106
|
+
|
|
107
|
+
## Exporting
|
|
108
|
+
|
|
109
|
+
Every exporter returns `bytes`; saving or sending them is up to your application.
|
|
110
|
+
|
|
111
|
+
### HTML
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
import reportkit.exporters.html
|
|
115
|
+
from reportkit.exporters.html.exporter import HtmlExporter
|
|
116
|
+
|
|
117
|
+
html = HtmlExporter().export(report, context)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### PDF
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from reportkit.exporters.pdf import PdfExporter
|
|
124
|
+
|
|
125
|
+
pdf = PdfExporter.export(report, context)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The PDF is rendered from the same HTML and CSS. Only embedded images (`data:` URIs) and files inside an optional
|
|
129
|
+
`base_url` folder are loaded; network resources are refused, and any resource that cannot be loaded fails the export
|
|
130
|
+
instead of producing an incomplete PDF.
|
|
131
|
+
|
|
132
|
+
### Excel
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from reportkit.exporters.excel import ExcelExporter, ExcelOptions
|
|
136
|
+
|
|
137
|
+
xlsx = ExcelExporter().export(report, context) # looks like the PDF
|
|
138
|
+
xlsx = ExcelExporter().export(report, context, ExcelOptions(mode="data", streaming=True)) # one typed sheet per table
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
- `formatted` (default): one printable sheet with merged cells, colors, borders, logo, RTL and print settings.
|
|
142
|
+
- `data`: analysis-ready sheets with real numbers and dates, frozen headers and AutoFilter. With `streaming=True` memory
|
|
143
|
+
stays flat, which is the right choice for very large reports.
|
|
144
|
+
- Values are written as they arrive: no formulas, text is always stored as text (formula injection safe), and decimals
|
|
145
|
+
beyond Excel's 15 significant digits raise an error unless `decimal_policy="text"`.
|
|
146
|
+
|
|
147
|
+
### Word
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from reportkit.exporters.word import WordExporter
|
|
151
|
+
|
|
152
|
+
docx = WordExporter().export(report, context)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Tables repeat their header row on every page, repeating headers and footers go to the Word page header and footer, and
|
|
156
|
+
page numbers use Word's PAGE and NUMPAGES fields.
|
|
157
|
+
|
|
158
|
+
### Exporter registry
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
import reportkit.exporters.html, reportkit.exporters.pdf, reportkit.exporters.excel, reportkit.exporters.word
|
|
162
|
+
from reportkit.exporters.registry import ExporterRegistry
|
|
163
|
+
|
|
164
|
+
exporter = ExporterRegistry.get("xlsx")() # "html", "pdf", "excel"/"xlsx", "word"/"docx"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Components
|
|
168
|
+
|
|
169
|
+
| Group | Components |
|
|
170
|
+
|---|---|
|
|
171
|
+
| Document | `Report`, `Page`, `Header`, `Footer` |
|
|
172
|
+
| Layout | `Box`, `Section`, `Row`, `Column`, `Grid`, `Spacer`, `Divider` |
|
|
173
|
+
| Typography | `Text`, `Heading`, `RichText`, `TextSpan` |
|
|
174
|
+
| Tables | `Table`, `TableColumn`, `TableRow`, `TableCell`, `TableStyle` |
|
|
175
|
+
| Information | `KeyValue`, `InfoGrid` |
|
|
176
|
+
| Media | `Image` |
|
|
177
|
+
| Pagination | `PageBreak`, `PageNumber` |
|
|
178
|
+
|
|
179
|
+
Styles are immutable `Style` objects; table colors and spacing come from CSS design tokens shared by every exporter.
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
pip install -r requirements-dev.txt
|
|
185
|
+
python -m pytest tests
|
|
186
|
+
docker build -t reportkit . && docker run --rm reportkit # full suite, including PDF
|
|
187
|
+
```
|