Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move weasyprint dependency pkg check to config validation #514

Closed
srics opened this issue Aug 28, 2024 · 2 comments · Fixed by #524
Closed

Move weasyprint dependency pkg check to config validation #514

srics opened this issue Aug 28, 2024 · 2 comments · Fixed by #524
Labels
good first issue Good for newcomers

Comments

@srics
Copy link
Collaborator

srics commented Aug 28, 2024

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.

@srics srics added the good first issue Good for newcomers label Aug 28, 2024
@aramnhammer
Copy link
Contributor

@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
Copy link
Collaborator Author

srics commented Aug 30, 2024

@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

aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
aramnhammer pushed a commit to aramnhammer/pebblo that referenced this issue Aug 31, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit to aramnhammer/pebblo that referenced this issue Sep 1, 2024
srics pushed a commit that referenced this issue Sep 1, 2024
* #514: remove ImportError from generator_functions.py
* #514: add ConfigValidator to config_validation.py module
* #514: add dependency validator, add WeasyPrintDependency class to validators dict
* #514: rm extra validator, move validation check to ReportsConfig
* #514: use importlib to validate weasyprint install
* #514: add a test (assumes weasyprint is not installed)
* #514: clean up

---------

Co-authored-by: aram yegiazaryan <[email protected]>
@srics srics closed this as completed in #524 Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants