Wednesday, December 15, 2021

Python Bytes: #263 It’s time to stop using Python 3.6

<p><strong>Watch the live stream:</strong></p> <a href='https://www.youtube.com/watch?v=YHeB1U30mtk' 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://pythontest.com/pytest-book/"><strong>Brian’s book too</strong></a>!</li> </ul> <p>Special guest: <a href="https://twitter.com/lais_bsc"><strong>Laís Carvalho</strong></a></p> <p><strong>Michael #1:</strong> <a href="https://www.djangoproject.com/weblog/2021/dec/07/django-40-released/"><strong>Django 4.0 released</strong></a></p> <ul> <li>Django is picking up speed:</li> <li>4.0 Dec 2021 (+1)</li> <li>3.0 Dec 2020 (+3)</li> <li>2.0 Dec 2017 (+7)</li> <li>1.0.1 May 2010</li> <li>Feature highlights: <ul> <li>The new <a href="https://docs.djangoproject.com/en/4.0/releases/4.0/#redis-cache-backend">RedisCache backend</a> provides built-in support for caching with Redis.</li> <li>To ease customization of Forms, Formsets, and ErrorList they are now <a href="https://docs.djangoproject.com/en/4.0/releases/4.0/#template-based-form-rendering">rendered using the template engine</a>.</li> <li>The Python standard library’s zoneinfo is now the <a href="https://docs.djangoproject.com/en/4.0/releases/4.0/#zoneinfo-default-timezone-implementation">default timezone implementation in Django</a>.</li> <li><strong>scrypt password hasher</strong>: The new scrypt password hasher is more secure and recommended over PBKDF2. However, it’s not the default as it requires OpenSSL 1.1+ and more memory.</li> </ul></li> <li>Django 3.2 has reached the end of mainstream support. The final minor bug fix release, <a href="https://docs.djangoproject.com/en/stable/releases/3.2.10/">3.2.10</a>, was issued today. Django 3.2 is an LTS release and will receive security and data loss fixes until April 2024.</li> <li>Some <a href="https://docs.djangoproject.com/en/4.0/releases/4.0/#backwards-incompatible-4-0">backwards incompatible changes</a> you’ll want to be aware of when upgrading from Django 3.2 or earlier. </li> <li>They’ve <a href="https://docs.djangoproject.com/en/4.0/releases/4.0/#deprecated-features-4-0">begun the deprecation process for some features</a>.</li> <li>Django 4.0 supports Python 3.8, 3.9, and 3.10.</li> </ul> <p><strong>Brian #2:</strong> <a href="https://github.com/dflook/python-minifier"><strong>python-minifier</strong></a></p> <ul> <li>Suggested by Lance Reinsmith</li> <li>My first thought was “we don’t need a minifier for Python”</li> <li>The docs give one reason: <ul> <li>“AWS Cloudformation templates may have AWS lambda function source code embedded in them, but only if the function is less than 4KiB. I wrote this package so I could write python normally and still embed the module in a template.”</li> </ul></li> <li>Lance has another reason: <ul> <li>“I needed it because the RAM on Adafruit boards using the common M0 chip is around 192KB to 256KB total--not all of which is available to your program. To get around this, you can either 1) compile your code to an .mpy file or 2) minify it. The second worked for me and allowed me to alter it without constantly re-compiling.”</li> </ul></li> <li>Fair enough, what does it do?</li> <li>All of these features are options you can turn off, and are documented well: <ul> <li>Combine Import statements</li> <li>Remove Pass statements</li> <li>Remove literal statements (docstrings)</li> <li>Remove Annotations</li> <li>Hoist Literals</li> <li>Rename Locals, with preserved Locals list </li> <li>Rename Globals, with preserved Globals list</li> <li>Convert Positional-Only Arguments to Normal Arguments</li> </ul></li> <li>Also looks like it replaces spaces with tabs <ul> <li>Begrudgingly, that makes sense in this context.</li> </ul></li> <li><p>You can try it at <a href="https://python-minifier.com/">python-minifier.com</a></p> <p><strong>Laís #3:</strong> <a href="https://pythonspeed.com/articles/stop-using-python-3.6/"><strong>It’s time to stop using Python 3.6</strong></a></p></li> <li><p>Python 3.6 is reaching the <a href="https://pythonspeed.com/articles/stop-using-python-3.6/https://endoflife.date/python">end of it’s life</a> in 1 week and 1 day (Dec 23rd), i.e. no more releases after it.</p></li> <li>You should care because the Python dev team will no longer release security updates for 3.6 ⚠️</li> <li>if you use Linux, you have a bit more time BUT security updates will be released and bug fixes will not.</li> <li>also, Python 3rd party libraries and frameworks will drop support for 3.6 soon enough. <em>See the</em> <a href="https://twitter.com/WeldPond/status/1469313738029289476?ref_src=twsrc%5Etfw"><em>log4j issue and Java</em></a><em>.</em></li> <li>Brian might like this one: <a href="https://twitter.com/anthonypjshaw/status/1469952485687107584">Grype - a vulnerability scanner for container images and filesystems</a></li> </ul> <p><strong>Michael #4:</strong> <a href="https://medium.com/towards-formula-1-analysis/how-to-visualize-the-formula-1-championship-in-python-using-the-ergast-api-and-seaborn-ac2f88ae7248"><strong>How to Visualize the Formula 1 Championship in Python</strong></a></p> <ul> <li><a href="https://www.youtube.com/watch?v=7QJ-N-AQJYc"><strong>Race Highlights | 2021 Abu Dhabi Grand Prix</strong></a></li> <li><a href="https://www.youtube.com/watch?v=aViLtXEtgqs"><strong>Formula 1: Drive to Survive (Season 3) | Official Trailer</strong></a></li> <li>Wanting to get into Formula 1 data analysis, the <a href="https://ergast.com/mrd/"><strong>Ergast API</strong></a> is a very good starting point.</li> <li>This tutorial will show you how to use data from the Ergast API to visualize the changes in the 2021 championship standings over the rounds.</li> <li>Introduces <a href="https://pypi.org/project/fastf1/"><strong>fastf1</strong></a>: Wrapper library for F1 data and telemetry API with additional data processing capabilities.</li> </ul> <p><strong>Brian #5:</strong> <a href="https://github.com/jupyter/nbdime"><strong>nbdime</strong></a><a href="https://github.com/jupyter/nbdime"><strong>:</strong></a> <a href="https://github.com/jupyter/nbdime"><strong>Jupyter Notebook Diff and Merge tools</strong></a></p> <ul> <li>Suggestion from Henrik Finsberg</li> <li>“you recently covered ‘jut’ for viewing Jupyter notebooks from the terminal. Check out ‘mbdime’.” (that was <a href="https://pythonbytes.fm/episodes/show/258/python-built-us-an-anime-dog">episode 258</a>)</li> <li>So I did. And it looks cool.</li> <li><code>nbdime</code> provides tools for diffing and merging of Jupyter Notebooks. <ul> <li><code>nbdiff</code> compare notebooks in a terminal-friendly way</li> <li><code>nbmerge</code> three-way merge of notebooks with automatic conflict resolution</li> <li><code>nbdiff-web</code> shows you a rich rendered diff of notebooks</li> <li><code>nbmerge-web</code> gives you a web-based three-way merge tool for notebooks</li> <li><code>nbshow</code> present a single notebook in a terminal-friendly way</li> </ul></li> </ul> <p><strong>Laís #6:</strong> <a href="https://developers.redhat.com/articles/2021/11/17/customize-python-dependency-resolution-machine-learning#python_interface_and_prescriptionshttps://developers.redhat.com/articles/2021/11/17/customize-python-dependency-resolution-machine-learning#python_interface_and_prescriptions"><strong>Using AI to analyse and recommend software stacks for Python apps</strong></a></p> <ul> <li>thanks Fridolin!</li> <li>Project Thoth: an open source cloud-based Python dependency resolver <ul> <li>ML (reinforcement learning) that solves dependency issues taking into consideration runtime envs, hardware and other inputs. Using Markov’s decision process.</li> <li>“a smarter pip” that instead of using backtracking, precomputes the dependency information and stores it in a database that can be queried for future resolutions. Using pre-specified criteria by the developer.</li> </ul></li> <li>In summary: <ul> <li>Thot’s resolver uses automated bots that guarantee dependencies are locked down to specific versions, making builds and deployments reproducible;</li> <li>the aggregated knowledge (reinforcement learning from installed logs) helps the bots to lock the dependencies to the best libraries, instead of the latest.</li> <li>They are in beta phase but welcoming feedback and suggestions from the community.</li> </ul></li> </ul> <p><strong>Extras</strong> </p> <p>Brian:</p> <ul> <li><a href="https://pragprog.com/twelve-days-of-pragprog/">Pragmatic Bookshelf 12 days of Christmas</a> <ul> <li>Today, pytest book is part of the deal, nice timing, right?</li> </ul></li> </ul> <p>Michael:</p> <ul> <li><a href="https://www.youtube.com/watch?v=kNXVFB5eQfo"><strong>My talk</strong></a> at FlaskCon is out</li> <li>Firefox <a href="https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/"><strong>releases RLBox</strong></a></li> <li>We’re all <a href="https://arstechnica.com/information-technology/2021/12/the-critical-log4shell-zero-day-affects-a-whos-who-of-big-cloud-services/"><strong>getting identity theft monitoring</strong></a> for 1 year for free :-/</li> </ul> <p><strong>Laís</strong>: </p> <ul> <li>Python Ireland’s <a href="https://www.meetup.com/pythonireland/events/281468322/">speaker’s coaching session</a> is on Jan 22nd</li> <li><a href="https://learngitbranching.js.org/">Learning git</a> the visual way - cool for beginners, thorough explanations</li> <li><a href="https://realpython.com/java-vs-python/">Good read</a> for Java devs who want to start with Python (by Real Python)</li> </ul> <p><strong>Joke:</strong> </p> <ul> <li><a href="https://twitter.com/GGreg/status/1469442136961695752"><strong>Janga</strong></a></li> <li><a href="https://twitter.com/OfficialLoganK/status/1454130937730535424"><strong>Python (hellish) virtual envs</strong></a></li> </ul>

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...