<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Liam Thompson</title>
    <description>The latest articles on DEV Community by Liam Thompson (@leemthompo).</description>
    <link>https://dev.to/leemthompo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F665666%2F8c4cdddc-7566-4881-bfff-f39398e23d23.jpeg</url>
      <title>DEV Community: Liam Thompson</title>
      <link>https://dev.to/leemthompo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leemthompo"/>
    <language>en</language>
    <item>
      <title>pdoc: Auto-generated Python Documentation
</title>
      <dc:creator>Liam Thompson</dc:creator>
      <pubDate>Fri, 10 Sep 2021 17:58:37 +0000</pubDate>
      <link>https://dev.to/leemthompo/pdoc-auto-generated-python-documentation-2ndj</link>
      <guid>https://dev.to/leemthompo/pdoc-auto-generated-python-documentation-2ndj</guid>
      <description>&lt;p&gt;&lt;em&gt;This short post looks at &lt;code&gt;pdoc&lt;/code&gt;, a lightweight documentation&lt;br&gt;
generator for Python programs, provides an example used on the logline docs page, and explores some advantages of automatic docgen for the pragmatic programmer.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Radical simplicity
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://pdoc3.github.io/pdoc/doc/pdoc"&gt;pdoc&lt;/a&gt; is a super simple tool for auto-generating Python program documentation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Python package &lt;code&gt;pdoc&lt;/code&gt; provides types, functions, and a command-line interface for accessing public documentation of Python modules, and for presenting it in a user-friendly, industry-standard open format. It is best suited for small- to medium-sized projects with tidy, hierarchical APIs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's a &lt;code&gt;pip&lt;/code&gt; package, so a simple command-line installation will have you up and running in seconds. &lt;code&gt;pdoc&lt;/code&gt; is a lightweight alternative to Sphinx with minimal cognitive overhead. If you love &lt;code&gt;Markdown&lt;/code&gt; you'll probably love &lt;code&gt;pdoc&lt;/code&gt;. And if you don't love it, you'll like it.&lt;/p&gt;
&lt;h2&gt;
  
  
  Less is more
&lt;/h2&gt;

&lt;p&gt;You can output your documentation in PDF or HTML format with a simple flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; pdoc &lt;span class="nt"&gt;--PDF&lt;/span&gt; &amp;lt;filename&amp;gt;
 pdoc &lt;span class="nt"&gt;--HTML&lt;/span&gt; &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The PDF option is a personal favorite because it produces a nice &lt;code&gt;LaTeX&lt;/code&gt; document that would make Donald Knuth smile. You can even push it to the &lt;a href="https://arxiv.org/"&gt;arXiv&lt;/a&gt; and pretend you're a physicist.&lt;/p&gt;

&lt;p&gt;Autogenerated documentation is not exactly the Platonic ideal of &lt;a href="https://en.wikipedia.org/wiki/Literate_programming"&gt;literate programming&lt;/a&gt;, but if you have well-docstringed modules, functions, and classes, pdoc produces a user-friendly breakdown of your code into clean, modular sub-headings.&lt;/p&gt;

&lt;h2&gt;
  
  
  The AKQ Game
&lt;/h2&gt;

&lt;p&gt;The Ace-King-Queen Game is a toy model poker game written in Python. You can check out the &lt;a href="https://github.com/leemthompo/A-K-Q"&gt;GitHub repo here&lt;/a&gt;. It's a command-line game that contains the essence of hand ranges, bluffing frequencies, and calling frequencies, in a cartoonishly simple three-card game for two players. This implementation pits the human player against an &lt;em&gt;artificially intelligent&lt;/em&gt; computer player.&lt;/p&gt;

&lt;p&gt;I used &lt;code&gt;pdoc&lt;/code&gt; to auto-generate the HTML &lt;a href="https://www.logline.fr/docs/AKQ/"&gt;documentation for the game&lt;/a&gt;. A few tweaks and it was fit to publish on the &lt;strong&gt;logline&lt;/strong&gt; website.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Overview Effect
&lt;/h2&gt;

&lt;p&gt;Per &lt;a href="https://en.wikipedia.org/wiki/Overview_effect"&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;overview effect&lt;/strong&gt; is a cognitive shift in awareness reported by some astronauts during spaceflight, often while viewing the Earth from outer space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On a more mundane plane, checking out your code at a high level can be clarifying, where you inspect the atomic elements of a script neatly arranged and indexed. The beauty of &lt;code&gt;pdoc&lt;/code&gt; is how lightweight and fast it makes the docgen process. You can use it as part of an iterative development workflow --- to take a periodic birds-eye view of your code and survey the big picture.&lt;/p&gt;

&lt;p&gt;Function-wise inspection of a program makes a lot of sense. If all the function names and docstrings pass the smell test after a quick run through &lt;code&gt;pdoc&lt;/code&gt;, you're probably on the right path. Otherwise, it can help weed out faulty logic or potential missteps before they sabotage your script.&lt;/p&gt;

</description>
      <category>python</category>
      <category>documentation</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
