Overview

HTTPS SSH

CV

The main script makeCv.py generates my CV in different formats. It draws in data from YAML sources located in the data/ folder. It uses the Jinja2 template engine to generate Hugo-friendly markdown or a PDF (via LaTeX's moderncv document class). This project was inspired by Brandon Amos's CV generator. Since I've been wanting to learn more about Python, though, I wrote my own implementation.

Usage

Requirements

The following Python modules, not generally part of the standard Python installation, are required:

  • yaml
  • jinja2

They may be installed like so:

pip install pyyaml jinja2

Or like so:

easy_install pyyaml jinja2

It is also expected that the system as a version of the TeX system installed such as TeXLive. This is needed because latexmk generates the PDF version of the CV, running pdflatex as needed and cleaning up auxiliary files afterwards.

Making Changes

Data is included the folder data/. There are two files: cv.yaml and publications.yaml. The first contains the general data for the CV, including formatting options that are passed to the LaTeX template. The second is used to generate the publications section of the CV.

Templates, not surprisingly, are included in the folder templates/. Currently not all YAML data is utilized in the templates. Add or subtract as desired. Following Amos's template, I have changed the standard Jinja2 template block markers in the LaTeX template only as follows:

  • block_start_string: ~<
  • block_end_string: >~
  • variable_start_string: <<
  • variable_end_string: >>

NB: Jinja2 comments are currently not supported in the LaTeX template.

For each format (markdown and LaTeX), there are two templates: a standard one (cv.tex; cv.md) and a short one (cv_short.tex; cv_short.md). The shorter version cuts out descriptions of certain entries.

Running the Script

Most simply, you may run the script with no arguments:

python makeCv.py

Or, make the script executable:

chmod +x makeCv.py
./makeCv.py

This will generate a short version of both markdown and PDF files on the user's desktop. Alternatively, the following arguments are allowed:

  -h, --help
     show this help message and exit
  -o OUTPUT, --output OUTPUT
     output directory (default: ~/Desktop/)
  -f {md,pdf,both}, --format {md,pdf,both}
     what filetype to generate (default: both)
  -l {short,long}, --length {short,long}
     what template to use (default: short)

Caveats

  • The output directory is assumed to already exist
  • Strings in the YAML data are presumed to be in LaTeX style (e.g., escaped ampersands \& and formatting with \textit{} and \textbf{}
  • The deTexify.py script that's called by the main makeCv.py converts these LaTeX-style strings to markdown-style strings. It walks the dictionary data read from the YAML file in a very unsophisticated, rigid way. That is, it assumes the YAML data is in the structure it is currently in. Future versions should make this more robust and flexible.
  • The markdown generator adds basic TOML data as a header. This is so it may easily be added to a Hugo website by placing it in the content/ folder of a Hugo installation.