Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book

#235: Flask 2.0 Articles and Reactions

Published Wed, May 26, 2021, recorded Wed, May 26, 2021

Watch the live stream:

Watch this episode on YouTube
Play on YouTube
Watch the live stream replay

About the show

Sponsored by Sentry:

  • Sign up at pythonbytes.fm/sentry
  • And please, when signing up, click Got a promo code? Redeem and enter PYTHONBYTES

Special guest: Vincent D. Warmerdam koaning.io, Research Advocate @ Rasa and maintainer of a whole bunch of projects.

Brian #1: Flask 2.0 articles and reactions

Michael #2: Python 3.11 will be 2x faster?

  • via Mike Driscoll
  • From the Python Language summit
  • Guido asks "Can we make CPython faster?”
  • We covered the Shannon Plan for speedups.
  • Small team funded by Microsoft: Eric Snow, Mark Shannon, myself (might grow)
  • Constrains: Mostly don’t break things.
  • How to reach 2x speedup in 3.11
    • Adaptive, specializing bytecode interpreter
    • “Zero overhead” exception handling
    • Faster integer internals
    • Put __dict__ at a fixed offset (-1?)
  • There’s machine code generation in our future
  • Who will benefit
    • Users running CPU-intensive pure Python code •Users of websites built in Python
    • Users of tools that happen to use Python

Vincent #3:

  • DEON, a project with meaningful checklists for data science projects!
    • It’s a command line app that can generate checklists.
    • You customize checklists
    • There’s a set of examples (one for for each check) that explain why the checks it is matter.
    • Make a little course on calmcode to cover it.

Brian #4: 3 Tools to Track and Visualize the Execution of your Python Code

  • Khuyen Tran
  • Loguru — print better exceptions
    • we covered in episode 111, Jan 2019, but still super cool
  • snoop — print the lines of code being executed in a function
    • covered in episode 141, July 2019, also still super cool
  • heartrate — visualize the execution of a Python program in real-time
    • this is new to us, woohoo
  • Nice to have one persons take on a group of useful tools
    • Plus great images of them in action.

Michael #5: DuckDB + Pandas

  • via __AlexMonahan__
  • What’s DuckDB? An in-process SQL OLAP database management system
  • 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.
  • Example

        import pandas as pd
        import duckdb
    
        mydf = pd.DataFrame({'a' : [1, 2, 3]})
        print(duckdb.query("SELECT SUM(a) FROM mydf").to_df())
    
  • 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.

  • For many queries, you can use DuckDB to process data faster than Pandas, and with a much lower total memory usage, without ever leaving the Pandas DataFrame binary format (“Pandas-in, Pandas-out”).
  • The automatic query optimizer in DuckDB does lots of the hard, expert work you’d need in Pandas.

Vincent #6:

  • I work for a company called Rasa. 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 here. There’s also a GIF demo here.
    • 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.
    • 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.
    • They host a scraper that scrapes fire/weather info every 10 seconds. It also fetches evacuation information.
    • 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.
    • They even do some fuzzy matching to make sure that your city is matched even when you make a typo.

Extras

Michael

Vincent: Human-Learn: a suite of tools to have humans define models before resorting to machines.

  • It’s scikit-learn compatible.
  • One of the main features is that you’re able to draw a model!
  • There’s a small guide that shows how to outperform a deep learning implementation by doing exploratory data analysis. It turns out, you can outperform Keras sometimes.
  • There’s a suite of tools to turn python functions into scikit-learn compatible models. Keyword arguments become grid-search-able.
  • Tutorial on calmcode.io to anybody interested.
  • Can also be used for Bulk Labelling.

Joke


Want to go deeper? Check our projects