quantifiedcode / python-anti-patterns

An open collection of Python anti-patterns and worst practices.
https://quantifiedcode.github.io/python-anti-patterns
Other
1.71k stars 249 forks source link

Pdf version #102

Closed haegemon closed 7 years ago

haegemon commented 7 years ago

Can u create pdf/fb2/... version of book?

programmdesign commented 7 years ago

Hi, there's already a PDF version. It's linked on the main page of the Anti-Pattern book: https://docs.quantifiedcode.com/python-anti-patterns/latex/The-Little-Book-of-Python-Anti-Patterns-1.0.pdf

haegemon commented 7 years ago

Thanks

gamesbook commented 5 years ago

Apologies for the "me too" but is there a single downloadable, readable version for all chapters in this book?

duongdominhchau commented 4 years ago

Edit: There is link to prebuilt PDF in README, this comment is obsoleted.

You can build it yourself, all the required files are available here. I managed to build a PDF on Arch. If you use Arch you can use my PKGBUILD at the end of this comment. I don't use Windows anymore so I don't know how to do this on Windows. Other distros please follow the instructions below.

  1. Install the dependencies, on Arch they are python-sphinx, texlive-core, texlive-latexextra, check your distro repo for corresponding packages.
  2. Download/Clone this book repo and cd to docs directory.
  3. Run make latex (don't run make latexpdf as it reports some strange errors).
  4. Run cp logo_qc.png _build/html/python-anti-patterns/latex to copy the logo to latex directory. I don't know why it is missing in the first place, but for now to make it work just copy it manually.
  5. Run make -C _build/html/python-anti-patterns/latex to build the PDF.
  6. When it finishes, run cp _build/html/python-anti-patterns/latex/*.pdf . to copy the result back to docs directory.

(For Arch only) And here is the PKGBUILD, create an empty directory and put it inside, then run makepkg -s in that directory, done. All the steps above are done automatically.

# Maintainer: Duong Do Minh Chau <duongdominhchau@gmail.com>
pkgname=python-anti-patterns
pkgver=20200227
pkgrel=1
pkgdesc="Python anti-pattern book"
arch=(any)
url="https://github.com/quantifiedcode/python-anti-patterns"
license=('CCPL')
makedepends=(python-sphinx texlive-core texlive-latexextra)
source=("${pkgver}.zip::https://github.com/quantifiedcode/python-anti-patterns/archive/master.zip")
sha256sums=(SKIP)

build() {
    cd "${pkgname}-master/docs"
    make latex
    cp logo_qc.png _build/html/python-anti-patterns/latex
    make -C _build/html/python-anti-patterns/latex
}

package() {
    cd "${pkgname}-master/docs/_build/html/python-anti-patterns/latex"
    cp *.pdf "${srcdir}/../The Little Book of Python Anti-Patterns.pdf"
    exit
}