Avoids the awkward file system structure by using pdfkit.from_url, but creates one .pdf for each chapter. I tried using a list of urls, but pdfkit failed because my version of wkhtmltopdf did not accept multiple input files.
Edit: pdfkit.from_file also fails on my system when passing multiple files. If that works for you, multiple urls are probably fine, too.
I think it was a mistake to try shaving off a couple of lines and a step at the price of a more convoluted install and a brittle process. Most people would probably be best off just converting one HTML file at a time to pdf (e.g. pdfkit.from_file(filename_in_html,filename_in_html[:-4]+".pdf") in some sort of iteration over the file names) and then concatenating the resulting PDF:s, for instance from command line by
pdftk TOC.pdf acknowledgements.pdf notation.pdf intro.pdf part_basics.pdf linear_algebra.pdf prob.pdf numerical.pdf ml.pdf part_practical.pdf mlp.pdf regularization.pdf optimization.pdf convnets.pdf rnn.pdf guidelines.pdf applications.pdf part_research.pdf linear_factors.pdf autoencoders.pdf representation.pdf graphical_models.pdf monte_carlo.pdf partition.pdf inference.pdf generative_models.pdf bib.pdf index-.pdf cat output Goodfellow-et-al-2016-Book.pdf
Sorry if I contributed to wasting your time.
edit: changed ".pdf" from a slightly longer approach to ".html" which actually exists in this workflow. Thanks @TheCabin!
edit(2): ... and gave a valid path to this listdir. Check before I post... check before I post...
edit(3): ... and removed the os.listdir line no longer needed in this approach. Gosh. Just ignore what I was saying and build your own approach. That'll probably be faster at this rate.
edit(4): Don't import os without using it.