Wednesday, May 26, 2021

Python Bytes: #235 Flask 2.0 Articles and Reactions

<p><strong>Watch the live stream:</strong></p> <a href='https://www.youtube.com/watch?v=JXX6h-wqBhA' style='font-weight: bold;'>Watch on YouTube</a><br> <br> <p><strong>About the show</strong></p> <p>Sponsored by Sentry:</p> <ul> <li>Sign up at <a href="https://pythonbytes.fm/sentry"><strong>pythonbytes.fm/sentry</strong></a></li> <li>And please, when signing up, click <strong><em>Got a promo code? Redeem</em></strong> and enter <strong>PYTHONBYTES</strong></li> </ul> <p>Special guest: Vincent D. Warmerdam <a href="https://koaning.io/">koaning.io</a>, Research Advocate @ Rasa and maintainer of a <a href="https://scikit-lego.netlify.app/">whole</a> <a href="https://github.com/koaning/human-learn">bunch</a> of <a href="https://calmcode.io/">projects</a>. </p> <p>Intro: Hello and Welcome to Python Bytes Where we deliver Python news and headlines directly to your earbuds. This is episode 235, recorded May 26 2021 I’m Brian Okken [HTML_REMOVED] [HTML_REMOVED]</p> <p><strong>Brian #1:</strong> <strong>Flask 2.0 articles and reactions</strong></p> <ul> <li><a href="https://flask.palletsprojects.com/en/2.0.x/changes/">Change list</a></li> <li><a href="https://testdriven.io/blog/flask-async/">Async in Flask 2.0</a> <ul> <li>Patrick Kennedy on testdriven.io blog</li> <li>Great description</li> <li>discussion of how the async works in Flask 2.0</li> <li>examples</li> <li>how to test async routes</li> </ul></li> <li><a href="https://www.youtube.com/watch?v=0KU67snMjtQ">An opinionated review of the most interesting aspects of Flask 2.0</a> <ul> <li>Miguel Grinberg video</li> <li>covers</li> <li>route decorators for common methods, <ul> <li>ex <code>@app.post(``"``/``"``)</code> instead of <code>@app.route("/", methods=["POST"])</code></li> </ul></li> <li>web socket support</li> <li>async support</li> <li>Also includes some extensions Miguel has written to make things easier</li> <li>Great discussion, worth the 25 min play time.</li> </ul></li> <li>See also: <a href="https://talkpython.fm/episodes/show/316/flask-2.0">Talk Python Episode 316</a></li> </ul> <p><strong>Michael #2:</strong> <a href="https://twitter.com/driscollis/status/1392947869657731072?s=12"><strong>Python 3.11 will be 2x faster?</strong></a></p> <ul> <li>via <a href="https://twitter.com/driscollis">Mike Driscoll</a></li> <li>From the Python Language summit</li> <li>Guido asks "Can we make CPython faster?”</li> <li>We covered the <a href="https://github.com/markshannon/faster-cpython">Shannon Plan for speedups</a>.</li> <li>Small team funded by Microsoft: Eric Snow, Mark Shannon, myself (might grow)</li> <li>Constrains: Mostly don’t break things.</li> <li>How to reach 2x speedup in 3.11 <ul> <li>Adaptive, specializing bytecode interpreter</li> <li>“Zero overhead” exception handling</li> <li>Faster integer internals</li> <li>Put __dict__ at a fixed offset (-1?)</li> </ul></li> <li>There’s machine code generation in our future</li> <li>Who will benefit <ul> <li>Users running CPU-intensive pure Python code •Users of websites built in Python</li> <li>Users of tools that happen to use Python</li> </ul></li> </ul> <p><strong>Vincent #3:</strong></p> <ul> <li>DEON, a project with <a href="https://deon.drivendata.org/#default-checklist">meaningful checklists</a> for data science projects! <ul> <li>It’s a command line app that can generate checklists.</li> <li>You customize checklists</li> <li>There’s a <a href="https://deon.drivendata.org/examples/">set of examples</a> (one for for each check) that explain why the checks it is matter. </li> <li>Make a little course on <a href="https://calmcode.io/deon/introduction.html">calmcode</a> to cover it.</li> </ul></li> </ul> <p><strong>Brian #4:</strong> <a href="https://towardsdatascience.com/3-tools-to-track-and-visualize-the-execution-of-your-python-code-666a153e435e"><strong>3 Tools to Track and Visualize the Execution of your Python Code</strong></a></p> <ul> <li>Khuyen Tran</li> <li><a href="https://github.com/Delgan/loguru">Loguru</a> — print better exceptions <ul> <li>we covered in <a href="https://pythonbytes.fm/episodes/show/111/loguru-python-logging-made-simple">episode 111</a>, Jan 2019, but still super cool</li> </ul></li> <li><a href="https://github.com/alexmojaki/snoop">snoop</a> — print the lines of code being executed in a function <ul> <li>covered in <a href="https://pythonbytes.fm/episodes/show/141/debugging-with-f-strings-coming-in-python-3.8">episode 141</a>, July 2019, also still super cool</li> </ul></li> <li><a href="https://github.com/alexmojaki/heartrate">heartrate</a> — visualize the execution of a Python program in real-time <ul> <li>this is new to us, woohoo</li> </ul></li> <li>Nice to have one persons take on a group of useful tools <ul> <li>Plus great images of them in action.</li> </ul></li> </ul> <p><strong>Michael #5:</strong> <a href="https://duckdb.org/2021/05/14/sql-on-pandas.html"><strong>DuckDB + Pandas</strong></a></p> <ul> <li>via <a href="https://twitter.com/__AlexMonahan__/status/1393206122291503105"><strong>__AlexMonahan__</strong></a></li> <li>What’s <a href="https://duckdb.org/"><strong>DuckDB</strong></a>? An in-process SQL OLAP database management system</li> <li>SQL on Pandas: After your data has been converted into a Pandas DataFrame often additional data wrangling and analysis still need to be performed. Using DuckDB, it is possible to run SQL efficiently right on top of Pandas DataFrames.</li> <li>Example</li> </ul> <pre><code> import pandas as pd import duckdb mydf = pd.DataFrame({'a' : [1, 2, 3]}) print(duckdb.query("SELECT SUM(a) FROM mydf").to_df()) </code></pre> <ul> <li>When you run a query in SQL, DuckDB will look for Python variables whose name matches the table names in your query and automatically start reading your Pandas DataFrames.</li> <li>For many queries, you can use DuckDB to process data faster than Pandas, and with a much lower total memory usage, <em>without ever leaving the Pandas DataFrame binary format</em> (“Pandas-in, Pandas-out”).</li> <li>The automatic query optimizer in DuckDB does lots of the hard, expert work you’d need in Pandas.</li> </ul> <p><strong>Vincent #6:</strong></p> <ul> <li>I work for a company called <a href="https://rasa.com/">Rasa</a>. We make a python library to make virtual assistants and there’s a few community projects. There’s a bunch of cool showcases, but one stood out when I was checking our community showcase last week. There’s a project that warns folks about forest fire updates over text. The project is open-sourced on GitHub and can be found <a href="https://github.com/amittallapragada/CalFireAlertChatBot">here</a>. There’s also a GIF demo <a href="https://rasa.com/showcase/wildfire/">here</a>. <ul> <li>Amit Tallapragada and Arvind Sankar observed that in the early days of the fires, news outlets and local governments provided a confusing mix of updates about fire containment and evacuation zones, leading some residents to evacuate unnecessarily. They teamed up to build a chatbot that would return accurate information about conditions in individual cities, including nearby fires, air quality, and weather data.</li> <li>What’s cool here isn’t just that Vincent is biased (again, he works for Rasa), it’s also a nice example of grass-roots impact. You can make a lot of impact if there’s open APIs around.</li> <li>They host a scraper that scrapes fire/weather info every 10 seconds. It also fetches evacuation information.</li> <li>You can text a number and it will send you up-to-date info based on your city. It will also notify you if there’s an evacuation order/plan. </li> <li>They even do some fuzzy matching to make sure that your city is matched even when you make a typo. </li> </ul></li> </ul> <p><strong>Extras</strong></p> <p><strong>Michael</strong></p> <ul> <li><a href="https://pycon.blogspot.com/2021/05/pycon-us-2024-and-2025-announcement.html">PyCon US 2024 and 2025 Announced</a></li> </ul> <p><strong>Vincent</strong>: Human-Learn: a suite of tools to have humans define models before resorting to machines.</p> <ul> <li>It’s scikit-learn compatible. </li> <li>One of the main features is that you’re able to <a href="https://koaning.github.io/human-learn/guide/drawing-classifier/drawing.html#lets-draw">draw a model</a>! </li> <li>There’s a small guide that shows how to outperform a deep learning implementation by doing exploratory data analysis. It turns out, you can <a href="https://koaning.github.io/human-learn/examples/model-mining.html">outperform Keras sometimes</a>. </li> <li>There’s a suite of tools to turn python functions into <a href="https://koaning.github.io/human-learn/guide/function-classifier/function-classifier.html#functionclassifier">scikit-learn compatible models</a>. Keyword arguments become grid-search-able. </li> <li>Tutorial on <a href="https://calmcode.io/human-learn/introduction.html">calmcode.io</a> to anybody interested.</li> <li>Can also be used for <a href="https://github.com/RasaHQ/rasalit#bulk-labelling">Bulk Labelling</a>.</li> </ul> <p><strong>Joke</strong> </p> <p><img src="https://ift.tt/3bSrbZm" 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...