daxa-ai / pebblo

Pebblo enables developers to safely load data and promote their Gen AI app to deployment
https://daxa.ai/pebblo
MIT License
137 stars 45 forks source link

Move weasyprint dependency pkg check to config validation #514

Closed srics closed 2 months ago

srics commented 2 months ago

Currently the error message is shown only when the PDF report is about to be generated. Users will easily miss it.

2024-08-27 23:01:46.923 - pebblo.app.utils.utils - DEBUG - JSON data written successfully to: /Users/sridhar/.pebblo_test_1234/acme-sharepoint-ai-search-loader-app-2/e0f5e1ed-8680-4a97-b114-5474c6e7078f/report.json2024-08-27 23:01:46.925 - pebblo.app.service.service - DEBUG - Generating report in pdf format
2024-08-27 23:01:46.958 - pebblo.app.service.service - ERROR - PDF report is not generated. Could not import weasyprint package. Please install weasyprint and Pango to generate report using weasyprint.
          Follow documentation for more details - https://daxa-ai.github.io/pebblo/installation"

Move this check to config validation stage and fail pebblo-server startup.

aramnhammer commented 2 months ago

@srics should it not just be added to dependencies ?

if not, is there a specific field in the config file where this can be checked if the user enabled it?

srics commented 2 months ago

@srics should it not just be added to dependencies ?

if not, is there a specific field in the config file where this can be checked if the user enabled it?

@aramnhammer Yes, the following config field (reports.renderer) would indicate the renderer choice:

reports:
  format: pdf
  renderer: weasyprint

Note, that we support the xhtml2pdf renderer as the default out-of-the-box option for report generation because it has fewer install dependencies. For weasyprint, we want the user to explicitly opt-in to make sure platform-specific pango is in place. See the note in https://daxa-ai.github.io/pebblo/config#reports