This is my custom resume generator. It creates a static website and/or a PDF document.
Why I am not using an already existing static site generator like Jekyll or Hugo?
I wanted to get more familiar with one of my weak spots - web development: HTML, CSS and templating with Jinja.
- Input data as JSON resume
- Exclude/include private data
- Python 3.10
- Responsive design for mobile devices
- Jinja for HTML templating
- pyTailwindCSS standalone Tailwind CSS in Python without Node.js
WeasyPrintPlaywrightfor PDF document creation- Automatic creation of output files in case of changes during development by Watchdog
- Poetry for dependency management
$ curl -sSL https://install.python-poetry.org | python3 -
$ poetry install
Usage: main.py [OPTIONS] COMMAND [ARGS]...
Watch for file changes, trigger automatic build
Options:
--include-private-data Include private data
--help Show this message and exit.
Commands:
one-shot Build CSS file and render Jinja template one time and exit
Input resume data is placed in input/resume.json
.
Private resume data can be placed in input/private/private_resume.json
.
$ poetry run python3 main.py --include-private-data
At first I used WeasyPrint for PDF export, which worked very good beside the fact that it does not fully support CSS flexbox. Which lead to the layout for the PDFs being not consistent with that from the HTML output.
Then I switched over the Playwright to use the built-in PDF export from Chromium. This made the PDFs look as expected. Important with this approach is that we instruct Playwright to wait until the whole page is loadedwait_for_function("document.fonts.status === 'loaded'"
, else the PDF is created with the fallback font.