<p><strong>Watch the live stream:</strong></p>
<a href='https://www.youtube.com/watch?v=GVGnN-EIZhs' style='font-weight: bold;'>Watch on YouTube</a><br>
<br>
<p><strong>About the show</strong></p>
<p>Sponsored by <strong>us:</strong></p>
<ul>
<li>Check out the <a href="https://training.talkpython.fm/courses/all"><strong>courses over at Talk Python</strong></a></li>
<li>And <a href="https://pytestbook.com"><strong>Brian’s book too</strong></a>!</li>
</ul>
<p>Special guest: <a href="https://twitter.com/kjaymiller"><strong>Jay Miller</strong></a></p>
<p><strong>Michael #1:</strong> <a href="https://twitter.com/ywalia01/status/1390629366527234051"><strong>Autosync all branches of a fork</strong></a></p>
<ul>
<li>Use GitHub actions to keep your fork in sync</li>
<li>Step 1: make changes in a separate branch (a branch other than main) to keep the working tree clean and avoiding conflicts with upstream</li>
<li>Step 2: Add a new workflow under the “actions” section. We are going to follow the Fork-Sync-With-Upstream-action from the Actions Marketplace. Copy the YAML in the article being careful to use the right repo/branch names</li>
<li>Step 3: click on Start Commit and Commit new file and that's it!</li>
<li>See your running workflow in the actions tab</li>
</ul>
<p><strong>Brain #2:</strong> <a href="https://pythonspeed.com/articles/measuring-memory-python/"><strong>Measuring memory usage in Python: it’s tricky!</strong></a></p>
<ul>
<li>Itamar Turner-Trauring</li>
<li>Nice, easy to follow discussion of memory</li>
<li>Cool example to allocate 3 GB
<ul>
<li><code>arr = np.ones((1024, 1024, 1024, 3), dtype=np.uint8)</code></li>
<li>that’s a 4 dimensional array of bytes, 1k x 1k x 1k x 3</li>
</ul></li>
<li>“Resident Memory” measured with <code>psutil.Process().memory_info().rss</code>
<ul>
<li>rss = “Resident Set Size”, or “non-swapped physical memory”</li>
<li>returns bytes, so <code>/ (1024 * 1024)</code> gives MB</li>
</ul></li>
<li>Shows a little more than 3 GB</li>
<li>Doing nothing to process, but opening a few tabs in a browser and re-running <code>rss</code> shows a reduction due to some memory being saved to disk.</li>
<li>Fil profiler can show peak allocated memory.</li>
<li>Memory
<ul>
<li>Resident Memory : RAM usage</li>
<li>Allocated Memory : what we asked for, not really measurable</li>
<li>Peak Allocated Memory : kinda the same, but not, and it’s measurable</li>
</ul></li>
<li>Tradeoffs between measuring the two</li>
</ul>
<p><strong>Jay #3:</strong> <a href="https://www.youtube.com/watch?v=BxUxX1Ku1EQ"><strong>Python f-strings can do more than you thought. f'{val=}', f'{val!r}', f'{dt:%Y-%m-%d}'</strong></a></p>
<ul>
<li>Caution! Just because you can doesn’t mean you should but sometimes you will be looking for a way to do something</li>
</ul>
<p><strong>Michael #4:</strong> <a href="https://www.youtube.com/watch?v=EsWTf5LOp3E"><strong>10 Tips and Tools You Can Adopt in 15 minutes or Less To Level Up Your Dev Productivity</strong></a></p>
<ol>
<li>Upgrade your shell (ohmyzsh or ohmyposh) + Windows Terminal with PS 7</li>
<li><a href="https://secure.readthedocs.io/en/latest/index.html">Secure.py</a> (or NWebSec for ASP.NET or …)</li>
<li>Use a UI for git (SourceTree, GitHub Desktop, PyCharm, VS Code, etc)</li>
<li>Sync your github forks</li>
<li>Use a good logging framework: Logbook, Loguru, even Sentry</li>
<li>SSL/TLS with Let’s Encrypt</li>
<li>80/20 testing with sitemaps</li>
<li>PageSpeed insights (e.g for <a href="https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fpythonbytes.fm%2F&tab=desktop">Python Bytes</a>)</li>
<li>Use an OS package manager: <a href="https://brew.sh/">Homebrew</a>, <a href="https://chocolatey.org/">Chocolaty</a>, or Linux’s built in)</li>
<li>Manage your dependencies with dependabot or even <code>pip-compile requirements.in --upgrade</code></li>
<li><a href="https://www.youtube.com/watch?v=aGPYQ8LgtF8">Full conference</a> video</li>
</ol>
<p><strong>Brian #5:</strong> <a href="https://simpleisbetterthancomplex.com/tutorial/2021/06/27/how-to-start-a-production-ready-django-project.html"><strong>How to Start a Production-Ready Django Project</strong></a></p>
<ul>
<li>Vitor Freitas</li>
<li>Some great points for really any project, not just Django projects</li>
<li>Make sure different environments work with the project, in this priority:
<ul>
<li>local, so clone and run is easy and new people can onboard fast</li>
<li>test, also local, so devs actually test with no issues</li>
<li>production, can be more complicated since only experienced people will need it, or it will get run by your CI/CD chain</li>
<li>production is also used in staging</li>
</ul></li>
<li>Configure git and venv from the beginning.</li>
<li>Cool requirements files example with a <code>requirements</code> directory containing
<ul>
<li><code>base.txt</code></li>
<li><code>test.txt</code> : <code>base.txt</code> + test stuff</li>
<li><code>local.txt</code> : <code>test.txt</code> + dev stuff</li>
<li><code>production.txt</code> : <code>base.txt</code> + any production only stuff</li>
</ul></li>
<li>Settings setup, also with switched implementation for local, test, prod</li>
<li>Shared editor configuration, interesting addition</li>
<li>Shared linting and styling tools, isort, black, flake8, …</li>
<li>There are some Django specifics also, like app structure.</li>
</ul>
<p><strong>Jay #6:</strong> <a href="https://bunchapp.co"><strong>Bunch</strong></a></p>
<ul>
<li>macOS application that allows you to create starting and finishing workflows</li>
<li><strong><a href="https://youtu.be/zDsyw5uU0wA">How Jay sets up and tears down the newsletter video</a></strong></li>
</ul>
<p><strong>Extras</strong></p>
<p><strong>Jay</strong></p>
<ul>
<li><a href="http://monodraw.helftone.com/">Monodraw - Make diagrams or outlines using ascii art</a></li>
</ul>
<p><strong>Joke</strong> </p>
<p><img src="https://trello-attachments.s3.amazonaws.com/58e3f7c543422d7f3ad84f33/6025c6be09aa4603ccbbd487/8de8bd2a05ce79c62668723263a3126b/joke.png" alt="" /></p>
↧