<p>Sponsored by Datadog: <a href="http://pythonbytes.fm/datadog"><strong>pythonbytes.fm/datadog</strong></a></p>
<p>Special guest: <a href="https://twitter.com/Penguin"><strong>Jeremy Tanner</strong></a></p>
<a href='https://www.youtube.com/watch?v=XQ8P7j6hxN0' style='font-weight: bold;'>Watch on YouTube</a><br>
<br>
<p><strong>Brian #1:</strong> <a href="https://arpitbhayani.me/blogs/constant-folding-python"><strong>Constant Folding in Python</strong></a></p>
<ul>
<li>Arpit Bhayani</li>
<li>Constant Folding is when a language replaces constant expressions at compile time rather than computing them at runtime.</li>
<li>CPython does this while creating the bytecode.</li>
<li>We can use <code>dis</code> to see it in action</li>
</ul>
<pre><code> >>> import dis
>>> dis.dis("day_sec = 24 * 60 * 60")
1 0 LOAD_CONST 0 (86400)
2 STORE_NAME 0 (day_sec)
4 LOAD_CONST 1 (None)
6 RETURN_VALUE
</code></pre>
<ul>
<li>Python tries to fold lots of constants, but not all.</li>
<li>Seems to be based on size</li>
</ul>
<pre><code> >>> x = 2 ** 64 # folded
>>> x = 4 ** 64 # not folded
>>> a = "-" * 4096 # folded
>>> a = "-" * 4097 # not folded
</code></pre>
<ul>
<li>Discussion continues with a discussion of how CPython folding is implemented recursively and elegantly.</li>
<li>Key takeaway for me:
<ul>
<li>Remember to not try to pre-compute constants while coding. </li>
<li>Make them easy to read and Python will handle the optimization for you.</li>
</ul></li>
</ul>
<p><strong>Michael #2:</strong> <a href="https://stackabuse.com/python-update-all-packages-with-pip-review/"><strong>Update All Packages With pip-review</strong></a></p>
<ul>
<li>via PyCoders</li>
<li>Updating Python packages can be a hassle.</li>
<li>There are many of them - it's hard to keep track of all the newest versions</li>
<li>When you decide what to update, you still have to update each of them manually.</li>
<li>Originally a part of the <code>pip-tools</code> package, it now lives on as a standalone convenience wrapper around <code>pip</code>.</li>
<li>Usage</li>
</ul>
<pre><code> (venv) $ pip install pip-review
(venv)$ pip-review
scikit-learn==0.23.2 is available (you have 0.23.1)
scipy==1.5.4 is available (you have 1.4.1)
seaborn==0.11.0 is available (you have 0.10.1)
...
</code></pre>
<ul>
<li>Once you've identified if you'd like to update your packages, you can update them all, automatically, using <code>pip-review --auto</code>
<ul>
<li>Limit with constraints.txt file</li>
</ul></li>
<li>Can do it interactively via <code>pip-review --interactive</code> </li>
</ul>
<p><strong>Jeremy #3:</strong> <a href="https://qmk.fm"><strong>Quantum Mechanical Keyboard Firmware</strong></a></p>
<ul>
<li>How does the Python get into your computer? Much of it, through the keyboard</li>
<li>Why mechanical keyboards?
<ul>
<li>Ergonomics</li>
<li>Where is QWERTY from?</li>
<li>And when?</li>
<li>Keymaps</li>
<li>and because it’s essentially an escape room built of hardware and open source software and dodgy international transactions</li>
</ul></li>
<li>I’ve fallen further down the mechanical keyboard rabbit hole
<ul>
<li><a href="https://www.rgbkb.net/">RGBKB</a> Sol</li>
<li><a href="https://keyboard.io">Keyboardio</a> Atreus</li>
</ul></li>
<li>Keyboard firmware is mostly written in c
<ul>
<li><a href="https://github.com/qmk">https://github.com/qmk</a></li>
</ul></li>
<li>But there are Python portions
<ul>
<li><a href="https://github.com/qmk/qmk_cli">https://github.com/qmk/qmk_cli</a></li>
<li>Compiler helper</li>
<li>API</li>
<li>Reporting</li>
</ul></li>
<li>So the CLI is Python, where else is Python?
<ul>
<li>When looking to improve your keymap, key logging w/ Python to process logs for heatmaps
<ul>
<li><a href="https://github.com/qmk/qmk_firmware/issues/714">https://github.com/qmk/qmk_firmware/issues/714</a></li>
<li><a href="https://github.com/algernon/ergodox-layout/blob/master/tools/log-to-heatmap.py">https://github.com/algernon/ergodox-layout/blob/master/tools/log-to-heatmap.py</a></li>
</ul></li>
</ul></li>
</ul>
<p><strong>Brian #4:</strong> <a href="https://hackernoon.com/reinventing-the-python-logo-interview-with-a-ui-designer-pm6m343q"><strong>Reinventing the Python Logo</strong></a></p>
<ul>
<li>Carlo Occhiena interview with Jessica Williamson</li>
<li>Some cool logo history</li>
<li><p>Early logo
<img src="https://paper-attachments.dropbox.com/s_F9A2A0911FFE1F78C1A86C3DF0B67FFAAD84704801453ECE7274E60D39131BB8_1611771909328_python_logo_early.png" alt="" /></p></li>
<li><p>Current, from 2006, designed by Tim Parklin
<img src="https://paper-attachments.dropbox.com/s_F9A2A0911FFE1F78C1A86C3DF0B67FFAAD84704801453ECE7274E60D39131BB8_1611771946517_python_current.png" alt="" /></p></li>
<li><p><em>“The logo is actually based on mayan representations of snakes which very often represent only the head and perhaps a short length of tail. The structure of the snake representations the natural coiling/nesting of a snake as seen side on.” -</em> <a href="https://www.thecodingforums.com/threads/proposed-python-logo.356848/?ref=hackernoon.com"><em>Tim Parklin</em></a></p></li>
<li><p>Jessica Williamson proposed a new one in 2020:
<img src="https://paper-attachments.dropbox.com/s_F9A2A0911FFE1F78C1A86C3DF0B67FFAAD84704801453ECE7274E60D39131BB8_1611772091298_python_jessica.jpeg" alt="" /></p></li>
<li><p>Then there’s the rest of the article talking about the design process, etc.</p></li>
<li>But….. just wanted to throw this out there. I’m happy with the 2006 version. - Brian</li>
<li>MK: Have you ever seen <a href="https://play.google.com/store/apps/collection/cluster?clp=ggEICgZweXRob24%3D:S:ANO1ljJ4iE8&gsr=CguCAQgKBnB5dGhvbg%3D%3D:S:ANO1ljLF6ws">the logos on the app stores</a>?</li>
</ul>
<p><strong>Michael #5:</strong> <a href="https://github.com/hathawsh/aws-lambda-pypi"><strong>Private PyPI with Serverless Computing</strong></a></p>
<ul>
<li>Project: <a href="https://github.com/hathawsh/aws-lambda-pypi">aws-lambda-pypi</a></li>
<li>Brings together a few pieces so you can easily run a small PyPICloud instance as an AWS Lambda function with the help of Terraform.</li>
<li>PyPICloud lets you publish Python packages privately.</li>
<li>AWS Lambda lets you run a small service for free.</li>
<li>Terraform ensures the service is deployed and maintained correctly.</li>
<li>Security: This project takes the following security precautions.</li>
<li>The session keys are auto-generated and stored in a secret.</li>
<li>The server configuration file, which contains the session keys, is generated on the fly to minimize the possibility of exposure.</li>
<li>The lambda function runs with a role limited to accessing only what it needs.</li>
<li>PyPICloud is configured to display no packages to unauthenticated users.</li>
</ul>
<p><strong>Jeremy #6:</strong> <a href="https://inventwithpython.com/beyond/"><strong>Beyond the Basic Stuff w/Python</strong></a></p>
<ul>
<li>Al Sweigart</li>
<li>Want to become less feral?</li>
</ul>
<p>Extras:</p>
<p>Michael:</p>
<ul>
<li><a href="https://www.djangoproject.com/weblog/2021/jan/19/django-32-alpha-1-released/">Django 3.2 alpha 1 released</a></li>
<li>mypy 0.800 with Python 3.9 Support</li>
<li>pip 21.0 out and it drops Python 2</li>
<li><a href="https://www.zdnet.com/article/elastic-changes-open-source-license-to-monetize-cloud-service-use/">Elastic changes open-source license to monetize cloud-service use</a></li>
</ul>
<p>Brian: </p>
<ul>
<li>We talked about <a href="https://pythonbytes.fm/208">pip-chill in episode 208</a>
<ul>
<li>pip-chill now has a <code>--no-chill</code> option to not list itself. Nice.</li>
</ul></li>
<li>I was just on https://www.twitch.tv/microsoftdeveloper, short, but fun</li>
</ul>
<p>Joke</p>
<ul>
<li>via Wolf</li>
<li><p><a href="https://twitter.com/ctrlshifti/status/1352103674030432257">by Kat Maddox</a></p></li>
<li><p><strong>developer</strong>: so i have good news and bad news</p></li>
<li><strong>manager</strong>: what's the good news?</li>
<li><strong>developer</strong>: i've discovered that the "5 second rule" only applies to food</li>
<li><strong>manager</strong>: and the bad news?</li>
<li><strong>developer</strong>: i dropped our tables</li>
</ul>
↧