Quantcast
Channel: Planet Python
Viewing all articles
Browse latest Browse all 23375

Python Bytes: #374 Climbing the Python Web Mountain

$
0
0
<strong>Topics covered in this episode:</strong><br> <ul> <li><a href="https://www.piglei.com/articles/en-6-ways-to-improve-the-arch-of-you-py-project/"><strong>6 ways to improve the architecture of your Python project (using import-linter)</strong></a></li> <li><a href="https://github.com/piercefreeman/mountaineer">Mountaineer</a></li> <li><a href="https://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html"><strong>Why Python's Integer Division Floors</strong></a></li> <li><a href="https://hatchet.run"><strong>Hatchet</strong></a></li> <li><strong>Extras</strong></li> <li><strong>Joke</strong></li> </ul><a href='https://www.youtube.com/watch?v=SaV3sJ8FlZU' style='font-weight: bold;'data-umami-event="Livestream-Past" data-umami-event-episode="374">Watch on YouTube</a><br> <p><strong>About the show</strong></p> <p>Sponsored by ScoutAPM: <a href="https://pythonbytes.fm/scout"><strong>pythonbytes.fm/scout</strong></a></p> <p><strong>Connect with the hosts</strong></p> <ul> <li>Michael: <a href="https://fosstodon.org/@mkennedy"><strong>@mkennedy@fosstodon.org</strong></a></li> <li>Brian: <a href="https://fosstodon.org/@brianokken"><strong>@brianokken@fosstodon.org</strong></a></li> <li>Show: <a href="https://fosstodon.org/@pythonbytes"><strong>@pythonbytes@fosstodon.org</strong></a></li> </ul> <p>Join us on YouTube at <a href="https://pythonbytes.fm/stream/live"><strong>pythonbytes.fm/live</strong></a> to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too.</p> <p><strong>Brian #1:</strong> <a href="https://www.piglei.com/articles/en-6-ways-to-improve-the-arch-of-you-py-project/"><strong>6 ways to improve the architecture of your Python project (using import-linter)</strong></a></p> <ul> <li>Piglei</li> <li>Using <a href="https://github.com/seddonym/import-linter">import-linter</a> to <ul> <li>define architectural layers</li> <li>check to make sure imports don’t violate (import from upper layers)</li> <li>can also check for more contracts, such as <ul> <li>forbidden - disallow a specific from/to import </li> <li>independence - list of modules that shouldn’t import from each other</li> </ul></li> </ul></li> <li>Fixing violations <ul> <li>a process introduced to set exceptions for each violation in a config file</li> <li>then fix violations 1 at a time (nice approach)</li> <li>use the whole team if you can</li> </ul></li> <li>Common methods for fixing dependency issues <ul> <li>Merging and splitting modules</li> <li>Dependency Injection, including using protocols to keep type hints without the need to import just for types</li> <li>Use simpler dependency types</li> <li>Delaying function implementations <ul> <li>module global methods set by caller, or adding a simple plugin/callback system</li> </ul></li> <li>Configuration driven <ul> <li>Setting import statements in a config file and using <code>import_string()</code> at runtime</li> </ul></li> <li>Replace function calls with event-driven approaches</li> </ul></li> </ul> <p><strong>Michael #2:</strong> <a href="https://github.com/piercefreeman/mountaineer">Mountaineer</a></p> <ul> <li>Mountaineer is a batteries-included web framework for Python and React.</li> <li>Mountaineer focuses on developer productivity above all else, with production speed a close second. <ul> <li>📝 Typehints up and down the stack: frontend, backend, and database</li> <li>🎙️ Trivially easy client[HTML_REMOVED]server communication, data binding, and function calling</li> <li>🌎 Optimized server rendering for better accessibility and SEO</li> <li>🏹 Static analysis of web pages for strong validation: link validity, data access, etc.</li> <li>🤩 Skip the API or Node.js server just to serve frontend clients</li> </ul></li> </ul> <p><strong>Brian #3:</strong> <a href="https://python-history.blogspot.com/2010/08/why-pythons-integer-division-floors.html"><strong>Why Python's Integer Division Floors</strong></a></p> <ul> <li>Guido van Rossum</li> <li>Integer division always floors (toward negative infinity) instead of truncating. (C truncates)</li> <li>5//2 → 2</li> <li>-5//2 → -3</li> <li>5//-2 → -3</li> <li>Reason, <ul> <li>For nice mathematical relationships with // and % (modulo).</li> <li>a//b = quotient (q), a%b = remainder (r)</li> <li>such that b*q + r = a, and 0 &lt;= r &lt; b <ul> <li>This works for both positive and negative a values</li> <li>For negative b, the second rule has to change to 0 &gt;= r &gt; b </li> </ul></li> </ul></li> <li>If you truncate (like C does), you have to use abs(r) for the first rule to work.</li> <li>Theory of why C doesn’t do it this way: Probably a hardware limitation at the time when C was designed, due to “sign + magnitude” integers instead of modern two’s compliment integers.</li> </ul> <p><strong>Michael #4:</strong> <a href="https://hatchet.run"><strong>Hatchet</strong></a></p> <ul> <li>Hatchet is a distributed, fault-tolerant task queue which replaces traditional message brokers and pub/sub systems. </li> <li>It’s built to solve problems like concurrency, fairness, and durability</li> <li>Concurrency, Fairness, and Rate limiting: Enable FIFO, LIFO, Round Robin, and Priority Queues with built-in strategies to avoid common pitfalls.</li> <li>Architected for Resiliency: Customizable retry policies and built-in error handling to recover from transient failures.</li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://pythontest.com/216"><strong>Charlie Marsh on uv in PythonTest episode 216</strong></a></li> </ul> <p>Michael:</p> <ul> <li><a href="https://training.talkpython.fm/courses/build-an-audio-ai-app-with-python-and-assemblyai"><strong>Build An Audio AI App Course</strong></a> [free!]</li> <li><a href="https://training.talkpython.fm/courses/python-type-hint-course-with-hands-on-examples"><strong>Rock Solid Python with Python Typing Course</strong></a></li> <li><a href="https://mstdn.social/@RayScript/111919177551660638"><strong>Coolio</strong></a></li> </ul> <p><strong>Joke:</strong> <a href="https://workchronicles.com/not-if-but-when/"><strong>Breaking Prod</strong></a></p>

Viewing all articles
Browse latest Browse all 23375

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>