Thursday, March 25, 2021

Python Bytes: #226 Teaching Python podcast on the podcast!

<p>Special guests: </p> <ul> <li><a href="https://twitter.com/kellypared"><strong>Kelly Schuster-Pared</strong></a><a href="https://twitter.com/kellypared"><strong>es</strong></a></li> <li><a href="https://twitter.com/smtibor"><strong>Sean Tibor</strong></a></li> </ul> <a href='https://www.youtube.com/watch?v=quWfizYHIIc' style='font-weight: bold;'>Watch on YouTube</a><br> <br> <p><strong>Brian #1:</strong> <a href="https://medium.com/@jacktator/dataclass-vs-namedtuple-vs-object-for-performance-optimization-in-python-691e234253b9"><strong>DataClass vs NamedTuple vs Object: A Battle of Performance in Python</strong></a></p> <ul> <li>Jack Song</li> <li>I’ve been using dataclass for a while now and love it. For some reason, I thought I heard there was some performance hit from them, so I was a bit worried before reading this.</li> <li>Jack came up with “a performance tests to compare the different <em>size</em> and <em>speed</em> when creating, reading and executing functions for <code>Object</code>, <code>NamedTuple</code> and the new <code>DataClass</code> introduced in Python 3.7”</li> </ul> <table> <thead> <tr> <th></th> <th><strong>Object</strong></th> <th><strong>NamedTuple</strong></th> <th><strong>DataClass</strong></th> </tr> </thead> <tbody> <tr> <td>create</td> <td>2.94 µs</td> <td><strong>2.01 µs</strong></td> <td>2.34 µs</td> </tr> <tr> <td>read property</td> <td><strong>24.7 ns</strong></td> <td>26.9 ns</td> <td><strong>24.7 ns</strong></td> </tr> <tr> <td>nested property</td> <td><strong>48.1 ns</strong></td> <td>75.8 ns</td> <td>52.1 ns</td> </tr> <tr> <td>execute function</td> <td>829 ns</td> <td>946 ns</td> <td><strong>821 ns</strong></td> </tr> <tr> <td>size</td> <td><strong>56 bytes</strong></td> <td>80 bytes</td> <td><strong>56 bytes</strong></td> </tr> </tbody> </table> <ul> <li>Marvelous. Dataclass is still awesome. At the very least, it’s on the same order of size and speed as other structures.</li> <li>Further questions: <ul> <li>This was a limited bit of code, and performance metrics always depend on what kind of example code was used. If anyone has info about different performance examples that give wildly different results or even similar results, regarding DataClass, I’d love to hear about it. </li> </ul></li> </ul> <p><strong>Michael #2:</strong> <a href="https://www.the-diy-life.com/can-my-water-cooled-raspberry-pi-cluster-beat-my-macbook/"><strong>Can My Water Cooled Raspberry Pi Cluster Beat My MacBook?</strong></a></p> <ul> <li>Did you know there were Raspberry Pi clusters? Amazing.</li> <li>Two primary things of interest <ul> <li>Pi clusters exist!</li> <li>All the tools and setup to make the pi cluster nodes run in a grid computing scenario</li> </ul></li> <li>Compared against a mediocre HP laptop: <ul> <li>10,000 → 1.69 sec</li> <li>100,000 → 74 sec</li> <li>200,000 → 268 sec</li> </ul></li> <li>Compared against an Intel MB Air: <ul> <li>10,000 → .88 sec</li> <li>100,000 → 83 sec</li> <li>200,000 → 355 sec</li> </ul></li> <li><strong>Pi cluster, one node</strong>: <ul> <li>10,000 → 1.57 sec</li> <li>100,000 → 148 sec</li> <li>200,000 → 646 sec</li> </ul></li> <li><strong>Pi cluster, grid computed</strong>: <ul> <li>10,000 → .65 sec</li> <li>100,000 → 22 sec</li> <li>200,000 → 85 sec</li> </ul></li> <li>Ran the <a href="https://www.the-diy-life.com/can-my-water-cooled-raspberry-pi-cluster-beat-my-macbook/#test_script"><strong>same script</strong></a> on my <strong>Mac Mini M1</strong> (on Python 3.9.2 Rosetta, <strong>single threaded</strong>) <ul> <li>10,000 → .33 sec</li> <li>100,000 → 24 sec</li> <li>200,000 → 91 sec</li> </ul></li> <li><p>Ran the <a href="https://gist.github.com/mikeckennedy/ffe8a65473e974d0582da0c74a8f1c67"><strong>my parallel script</strong></a> on my <strong>Mac Mini M1</strong> (on Python 3.9.2 Rosetta, <strong>multi-threaded</strong>)</p> <ul> <li>10,000 → .28 sec</li> <li>100,000 → 7 sec</li> <li>200,000 → 26 sec</li> <li>500,000 → 2m (vs. 9m on the cluster) <img src="https://ift.tt/3cm5O36" alt="" /></li> </ul></li> <li><p>Ran the <a href="https://gist.github.com/mikeckennedy/ffe8a65473e974d0582da0c74a8f1c67"><strong>my parallel script</strong></a> on my <strong>Alienware sim racing machine</strong> (<strong>16 core, multi-threaded</strong>)</p> <ul> <li>10,000 → .27 sec</li> <li>100,000 → 2.7 sec</li> <li>200,000 → 10 sec</li> <li>500,000 → 1m</li> <li><strong><a href="https://www.youtube.com/watch?v=rkRcvehsP6g">Video of the Alienware sound</a></strong></li> </ul></li> </ul> <p><strong>Kelly #3:</strong> <a href="https://www.programiz.com/learn-python"><strong>There is an app for that!</strong></a></p> <p>I am always trying to find time to practice Python and learn more ways to teach Python Basics. I amalways on the go, so having Python Practice online and an online editor is always a plus.</p> <ul> <li>Programiz a company out of Nepal, has an IOS and Android app for beginner pythonistas <ul> <li>From “Hello World” to Generators and Decorators</li> <li>Original Owners of Programiz: Ranjit Bhatta, Aswin Shrestha and Punit Jajodia</li> <li>Swipe, Learn, and Repeat</li> <li>Has an editor built in</li> <li>Leaderboards</li> <li>Quizzes and “Interview Challenges” (paid) <ul> <li>Newest update with 200+ programs</li> </ul></li> <li>Interactive IDE</li> <li>FREE, with minimal app advertising</li> <li>Paid version as well</li> <li>Learn anywhere availability, helps to reduce the Digital Divide</li> <li>826 million learners online due to Covid19</li> <li>50% of those learners do not have a household computer</li> <li>706 million have no at home internet</li> <li>The engineering behind the app and its editor function: <a href="https://www.programiz.com/blog/online-python-compiler-engineering/">https://www.programiz.com/blog/online-python-compiler-engineering/</a></li> </ul></li> </ul> <p><strong>Brian #4:</strong> <a href="https://discuss.python.org/t/new-packaging-security-funding-nyu/7792"><strong>New packaging security funding &amp; NYU</strong></a></p> <ul> <li>Sumana Harihareswara</li> <li>“New York University – specifically Professor Justin Cappos – and I (Sumana) have successfully asked the US National Science Foundation for a grant to improve Python packaging security. The NSF is awarding NYU $800,000 over two years – from mid-2021 to mid-2023 – to further improve the pip dependency resolver and to integrate The Update Framework further into the packaging toolchain.”</li> <li>“NYU researchers and developers will <ul> <li>Further assess and improve pip’s dependency resolver, following up on the work done in 2020 and making <a href="https://github.com/sarugaku/resolvelib/">ResolveLib</a> more reusable by other tools in the packaging ecology</li> <li>Secure the PyPI-to-user pipeline by integrating TUF support for signed packages throughout PyPI’s clients (we’re targeting conda, pip, and bandersnatch initially)”</li> </ul></li> <li>TUF is <a href="https://www.theupdateframework.com/">The Update Framework (TUF) specification,</a> <ul> <li>From <a href="https://theupdateframework.io/">theupdateframework.io</a>: <ul> <li>“The Update Framework (<strong>TUF</strong>) helps developers maintain the security of software update systems, providing protection even against attackers that compromise the repository or signing keys. TUF provides a flexible framework and specification that developers can adopt into any software update system.</li> </ul></li> </ul></li> <li><a href="https://github.com/sarugaku/resolvelib/">ResolveLib</a> “provides a <code>Resolver</code> class that includes dependency resolution logic.”. It’s an independent project, but vendored by pip</li> <li><a href="https://pypi.org/project/bandersnatch/">bandersnatch</a> “is a PyPI mirror client”</li> </ul> <p><strong>Michael #5: Extra x8, hear all about it</strong></p> <ol> <li>We on <a href="https://music.amazon.com/podcasts/7dc269ab-93df-4a32-b382-9e3e8c41d016/Python-Bytes"><strong>amazon</strong></a> and <a href="https://ift.tt/3lNPKdL> <strong>(so is</strong> <a href="https://music.amazon.com/podcasts/search/python"><strong>Teaching Python</strong></a><strong>)</strong></li> <li>Sourcery added <a href="https://github.com/sourcery-ai/sourcery/wiki/Skipping-refactorings"><strong>skip refactorings</strong></a>. I did major refactoring since, favorite: <ol> <li><code>url = request.url if request.url else ''</code> to</li> <li><code>url = request.url or ''</code></li> </ol></li> <li>Via <a href="https://twitter.com/HEPfeickert/status/1372425321203568642"><strong>Matthew Feickert</strong></a>, it’s easy to become a PSF member and support the PSF</li> <li><a href="https://roman-right.github.io/beanie/#indexes"><strong>Beanie adds indexes</strong></a>!</li> <li>Pycharm (and other JetBrains IDEs) in the browser via Dave Kirby <ol> <li><a href="https://lp.jetbrains.com/projector/"><strong>lp.jetbrains.com/projector</strong></a></li> <li><a href="https://github.com/JetBrains/projector-installer"><strong>github.com/JetBrains/projector-installer</strong></a></li> </ol></li> <li><a href="https://www.theregister.com/2021/03/19/audacity_3/"><strong>SQLite as a file format comes to Audacity</strong></a> (via Jon Bultmeyer)</li> <li><strong>Prayson Daniel</strong> shared <a href="https://github.com/Proteusiq/graphs"><strong>his Neo4J examples</strong></a> using Neomodel.</li> <li><a href="https://twitter.com/ChekosWH/status/1371992445093744641"><strong>Call for proposals for PyCon Latam just went live</strong></a></li> </ol> <p><strong>Sean #6:</strong> <a href="https://code.visualstudio.com/blogs/2020/07/27/containers-edu"><strong>Using Development Containers with VS Code for Students</strong></a></p> <ul> <li>One of the big chores at the start of a course is getting everyone set up in the same development environment. Usually takes at least a few classes and nearly impossible to get everyone with the same environment at the end.</li> <li><strong>Solution -</strong> use Docker images and the Remote-Containers extension to allow students to run a pre-configured container right in VS Code.</li> <li>Needs VS Code &amp; Docker Desktop (maybe a remote Docker host could make it even easier?)</li> <li>Can deploy directly from a Github repo with persistent storage volumes, default VS Code settings, and even pre-installed packages and environment variables.</li> <li>Seems well suited for universities, experienced learners, etc. Also makes it easy to create different environments by assignment or course unit. What if every Talk Python training course had a GitHub container repo with the same starting environment?</li> </ul> <p>Extras:</p> <p><strong>Kelly</strong>:</p> <ul> <li><a href="https://us.pycon.org/2021/summits/education-training/">https://us.pycon.org/2021/summits/education-training/</a> </li> </ul> <p><strong>Sean:</strong></p> <ul> <li><a href="https://blog.replit.com/python-package-cache">Repl.it adds Python package caching</a> (and gets a 40% speed boost)</li> <li><a href="https://www.home-assistant.io/blog/2021/03/18/nabu-casa-has-acquired-esphome/">Home Assistant (actually Nabu Casa) buys ESPHome</a> (makes DIY IoT devices cheap &amp; easy to integrate)</li> <li><a href="https://www.nbcnews.com/tech/security/want-vaccination-appointment-helps-know-python-programmer-rcna457">It’s good to know a Python programmer if you need a vaccine appointment</a> </li> </ul> <p>Joke (in honor of our teachers today):</p> <p><img src="https://ift.tt/3w0DSto" alt="" /></p>

from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...