<a href='https://www.youtube.com/watch?v=jH9scQESXJY' style='font-weight: bold;'>Watch on YouTube</a><br>
<br>
<p><strong>About the show</strong></p>
<p>Sponsored by <a href="http://pythonbytes.fm/foundershub2022"><strong>Microsoft for Startups Founders Hub</strong></a>.</p>
<p>Special guest: </p>
<ul>
<li><strong><a href="https://amhopkins.com/">Adam Hopkins</a></strong></li>
<li><strong><a href="https://sanicbook.com/">Python Web Development with Sanic</a></strong></li>
</ul>
<p><strong>Brian #1:</strong> <a href="https://pybit.es/articles/tips-for-clean-code-in-python/"><strong>Tips for clean code in Python</strong></a></p>
<ul>
<li>Bob Belderbos</li>
<li>Generally some great tips to think about to keep code maintainable:
<ul>
<li>Smaller units. Break things up into single responsibility. SRP: Single Responsibility Principle</li>
<li>Move magic numbers into constants or parameters.</li>
<li>Avoid global scope. (even though it’s not really global)</li>
<li>Use linters and auto-formatters.</li>
<li>Use very narrow try/except blocks.</li>
<li>Idiomatic Python. (Although I agree, this is a weird one as it’s hard for new people to follow).</li>
<li>Pay attention to data structure choice and learn to utilize standard structures and those in collections.</li>
<li>Use the standard libary.</li>
<li>Use mappings</li>
<li>Flat is better than nested.</li>
</ul></li>
<li>But I’m gonna focus on the “smaller units” because it applies to modules as well.
<ul>
<li>Try to keep modules organized such that you can keep relevant and related code concepts in your head.</li>
</ul></li>
</ul>
<p><strong>Michael #2:</strong> <strong>Mastodon is picking up speed</strong></p>
<ul>
<li><a href="https://fosstodon.org/web/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li>
<li><a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li>
<li><a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li>
<li><strong><a href="https://fosstodon.org/@admhpkns">@admhpkns@fosstodon.org</a></strong></li>
<li>I’m calling this a “Mastodon First” strategy rather than “Let’s burn down Twitter and scatter”</li>
<li>Just <a href="https://talkpython.fm/episodes/show/390/mastodon-for-python-devs"><strong>did a Talk Python</strong></a> about it</li>
<li>Money in mouth: I became <a href="https://www.patreon.com/fosstodon"><strong>a patreon of Fosstodon</strong></a> and <a href="https://patreon.com/mastodon"><strong>Mastodon’s company</strong></a></li>
<li>Mastodon is open source, <a href="https://github.com/mastodon/mastodon"><strong>find it here</strong></a></li>
<li><a href="https://www.technologyreview.com/2022/11/11/1063162/twitters-imminent-collapse-could-wipe-out-vast-records-of-recent-human-history/"><strong>Twitter’s potential collapse could wipe out vast records of recent human history</strong></a></li>
<li>Python’s API for Mastodon: <a href="https://pypi.org/project/toot/"><strong>toot</strong></a></li>
<li>Download a proper Twitter archive with <a href="https://mathstodon.xyz/@timhutton/109316834651128246"><strong>this Python script</strong></a></li>
<li><strong><a href="https://fosstodon.org/@mkennedy/109334951352292627">Integrated the API into stream deck</a></strong></li>
<li>You can install it as a PWA:
<img src="https://python-bytes-static.nyc3.digitaloceanspaces.com/install-mastodon.png" alt="" /></li>
</ul>
<p><strong>Adam</strong> <strong>#3:</strong> <strong>Correction to Sanic Worker Manager in v22.9</strong></p>
<ul>
<li><a href="https://pythonbytes.fm/episodes/show/308/conference-season-is-heating-up"><strong>Episode #308</strong></a> covered a recent article published on a new feature in Sanic v22.9 </li>
<li>Blog article: <strong><a href="https://amhopkins.com/posts/background-job-worker.html">Pushing work to the background of your Sanic app</a></strong></li>
<li>The segment focused on the celery-like job queue in Sanic</li>
<li>Clarification:
<ul>
<li>Goal of the feature is to bring a consistent development experience from dev thru prod</li>
<li>Enables usage of multiprocessing-safe shared objects</li>
<li>Simple pattern for managing multiple long-running processes</li>
</ul></li>
<li><strong><a href="https://sanic.dev/en/guide/release-notes/v22.9.html">Release notes for Sanic v22.9</a></strong></li>
<li><strong><a href="https://sanic.dev/en/guide/deployment/manager.html">Sanic documentation on the Worker Manager</a></strong></li>
</ul>
<p><strong>Brian #4:</strong> <strong>Some FastAPI news, and some great READMEs.</strong></p>
<ul>
<li><a href="https://fastapi.tiangolo.com/release-notes/#0870">FastAPI 0.87.0</a> has some interesting notes
<ul>
<li>Upgraded <a href="https://github.com/encode/starlette/releases/tag/0.21.0">Starlette</a>, which includes TestClient based on HTTPX instead of Requests</li>
<li>Since that might break some peoples use of TestClient, someone named Kludex built <a href="https://github.com/Kludex/bump-testclient">bump-testclient</a> to help automatically convert test code to the new interface. That’s so cool!</li>
<li>Use <a href="https://pypi.org/project/ruff/">Ruff</a> for linting</li>
<li>Add a <a href="https://fastapi.tiangolo.com/help-fastapi/#help-maintain-fastapi">Help Maintain FastAPI</a> section to the docs that emphasizes that it’s super helpful to:
<ul>
<li>Help others with issues</li>
<li>Review PRs</li>
<li>Both of those sections have other expanded sections to describe what that means.</li>
</ul></li>
<li>The FastAPI commitment to great documentation is amazing and worth emulating.</li>
<li>It also has a really good <a href="https://github.com/tiangolo/fastapi">README</a>.
<ul>
<li>Interesting sponsors section. Cool way for a popular project to get maintenance funding.</li>
<li>Testimonials. It’s like a sales landing page, which really, a README kinda is.</li>
<li>Other common good practices and cool items
<ul>
<li>Images</li>
<li>Some use of collapsable sections.</li>
</ul></li>
</ul></li>
</ul></li>
<li>Other notable READMEs
<ul>
<li><a href="https://pypi.org/project/pytest/">pytest</a>
<ul>
<li>short example right away to show how simple it can be to use.</li>
</ul></li>
<li><a href="https://github.com/Textualize/textual">textual</a> and <a href="https://github.com/Textualize/rich">rich</a>
<ul>
<li>great use of images and short examples</li>
<li>highlighting often missed features, such as pretty and inspect</li>
<li>Utilizing expandable/collapsable sections for longer examples</li>
</ul></li>
<li><a href="https://pypi.org/project/httpx/">httpx</a>
<ul>
<li>like pytest, shows a small example quickly, </li>
<li>redirects many other sections to more thorough docs.</li>
</ul></li>
</ul></li>
</ul>
<p><strong>Michael #5:</strong> <a href="https://twitter.com/btskinn/status/1587987145444163585?s=12&t=tE1LoCVynDVdhocfaMhNHw"><strong>Closevember</strong></a></p>
<ul>
<li>An annual event focused on sustainable open source development practices and maintainer well-being.</li>
<li>Let's support open source maintainers by helping them close issues and pull requests throughout November.</li>
<li>Over at <a href="https://closember.org"><strong>closember.org</strong></a></li>
<li><em>Contributing</em> to a project carries a number of responsibilities, in order to make it as easy as possible for a project to receive that contribution.</li>
<li><strong>For Maintainers: How to Get Ready</strong> (<a href="https://closember.org"><strong>see site</strong></a>)
<ul>
<li>If you only want assistance with closing some issues and PRs, then tag your repo with <code>closember</code> and you’re all set.</li>
<li>One thing that we often find helpful is to declutter our physical and digital environment: tidying our desks a bit, decluttering our computers’ desktops, unsubscribing from some email lists ... that sort of thing.</li>
<li>I did this this month actually. Spent 6 hours completely rebuilding my desk to have zero wires and look tidy and clean (hint: 3m of industrial velcro and things stuck upside down) and formatted my computer to a fresh OS after two years.</li>
</ul></li>
<li><strong>For the Community: How to Participate</strong> (<a href="https://closember.org"><strong>see site</strong></a>)
<ul>
<li>If you’ve never used GitHub before, your first step is going to be <a href="https://github.com/signup">signing up for a free account</a>.</li>
<li>Also, if you’re super new to git: <a href="https://talkpython.fm/git"><strong>talkpython.fm/git</strong></a></li>
<li>If you’ve opened issues or PRs on projects in the past, you can start by taking a look at <a href="https://github.com/issues">your own GitHub issues</a> and <a href="https://github.com/pulls">your own PRs</a> to see if any of them are outdated or have already been fixed—if so, close them! </li>
<li>After that, start browsing projects: take a look at your favorite projects and see if they’ve been tagged with <code>closember</code>, or browse the <a href="https://github.com/topics/closember">list of</a> <a href="https://github.com/topics/closember">closember</a> <a href="https://github.com/topics/closember">projects</a>.</li>
</ul></li>
<li>Check out the close boards (on the site)</li>
</ul>
<p><strong>Adam</strong> <strong>#6:</strong> <strong>Super simple “Cache with async power” using Cashews</strong></p>
<ul>
<li>Recently popped up in my <a href="https://github.com/explore">GitHub Explore</a>
<ul>
<li><a href="https://github.com/Krukov/cashews">Cashews:</a> <em>Async cache framework with simple API to build fast and reliable applications</em></li>
</ul></li>
<li>Super simple out-of-the-box API
<ul>
<li>supports in memory, Redis, DiskCache (local sqlite)</li>
<li>one-line setup then implemented as a decorator</li>
<li>Human-friendly TTL values: example “3h”</li>
</ul></li>
<li>Client-side caching - For example, if you are using Redis backend you do not need to make a network call on every cache request</li>
<li>Strategies for common cache issues
<ul>
<li>cache hits, early recalculation, soft TTL, resource locking, <strong>rate limiting!</strong>, circuit breaker</li>
</ul></li>
<li>Has its own interface for middleware</li>
</ul>
<p><strong>Extras</strong> </p>
<p>Michael:</p>
<ul>
<li><a href="https://mas.to/@davidism/109342591948410223">Take the PSF survey</a></li>
</ul>
<p>Adam: </p>
<ul>
<li>Voting season is upon us: <strong>Python Steering Council <a href="https://discuss.python.org/t/steering-council-nominations-are-now-open-2023-term/21062/2">nominations are open</a></strong></li>
</ul>
<p><strong>Joke:</strong> <a href="https://fosstodon.org/web/@mav@hackers.town/109315711016629418"><strong>JavaScript has been Banned from Twitter</strong></a></p>
↧