Sinopsis
Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.
Episodios
-
#239 No module named pythonbytes
23/06/2021 Duración: 43minWatch the live stream: Watch on YouTube About the show Sponsored by us: Check out the courses over at Talk Python And Brian’s book too! Special guest: Nick Muoh Brain #1: ormar : an async mini ORM for Python, with support for Postgres, MySQL, and SQLite. suggested by John Hagen From John: “It's a really cool ORM that combines Pydantic models and SQL models into a single definition. What is great about this, is it can be used to reduce repetitive duplication between Models for an ORM and the Pydantic Models that FastAPI needs to describe serialization. … If you have very pure-data heavy abstractions where your input and outputs through the API are roughly equivalent to your database, this helps you avoid needing to duplicate tons of SQLAlchemy classes and Pydantic that look identical and now you need to keep them in sync (DRY issue).” Michael #2: No module named via Garett Dunn Website: nomodulenamed.com Get an error like Python Error: No module named dateutil, maybe you need pip install python_
-
#238 A cloud-based file system for Python and a new GUI!
15/06/2021 Duración: 47minWatch the live stream: Watch on YouTube 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: Julia Signell Brain #1: Practical SQL for Data Analysis Haki Benita Pandas is awesome, but … “In this article I demonstrate how to use SQL to perform fast and efficient data analysis.” First part of the article. SQL is faster than Pandas But they are great together Then tons of examples showing exactly how to best use SQL queries and Pandas in data analysis:: Basics including random data and sampling Descriptive statistics Subtotals including rollup and groupign sets Pivot tables, both conditional expressions and aggregate expressions Running and cumulative agregation Linear Regression Interpolation Super cheat sheet for useful SQL queries Michael #2: Git Blame in your Python Tracebacks via Ruslan Portnoy, by Ofer Koren Helpful Modules: traceback & linecache traceback uses linecache,
-
#237 Separate your SQL and Python, asynchronously with aiosql
09/06/2021 Duración: 39minWatch the live stream: Watch on YouTube 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: Mike Groves Michael #1: Textual Textual (Rich.tui) is a TUI (Text User Interface) framework for Python using Rich as a renderer. Rich TUI will integrate tightly with its parent project, Rich. This project is currently a work in progress and may not be usable for a while. Brian #2: Pinning application dependencies with pip-tools compile via John Hagen pip-tools has more functionality than this, but compile alone is quite useful Start with a loose list of dependencies in requirements.in: rich Can have things like >= and such if you have fixed dependencies. Now pip install pip-tools, and pip-compile requirements.in or python -m piptools compile requirements.in both have same effect. Now you’ll have a requirements.txt file with pinned dependencies: # autogenerated by: pip-comp
-
#236 Fuzzy wuzzy wazzy fuzzy was faster
02/06/2021 Duración: 37minWatch the live stream: Watch on YouTube 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: Anastasiia Tymoshchuk Brian #1: Using accessible colors, monolens & CMasher Tweet by Matthew Feickert, @HEPfeickert “I need to give some serious praise to fellow Scikit-HEP dev Hans Dembinski on his excellent monolens tool for interactive simulation of kinds of color blindness. It works really quite well and the fact that is a pipx install away is awesome! monolens lets you “view part of your screen in greyscale or simulated colorblindness” So simple. Just pops up a box that you can drag around your monitor and view stuff in greyscale. Reply tweet by Niko, @NikoSercevic “I mean to use cmasher so I know it’s cb friendly” CMasher : “Scientific colormaps for making accessible, informative and cmashing plots” Provides a collection of scientific colormaps and utility functions to be used b
-
#235 Flask 2.0 Articles and Reactions
26/05/2021 Duración: 46minWatch the live stream: Watch on YouTube 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. 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] Brian #1: Flask 2.0 articles and reactions Change list Async in Flask 2.0 Patrick Kennedy on testdriven.io blog Great description discussion of how the async works in Flask 2.0 examples how to test async routes An opinionated review of the most interesting aspects of Flask 2.0 Miguel Grinberg video covers route decorators for common methods, ex @app.post(``"``/``"``) instead of @app.route("/", methods=["POST"]) web socket support async support Also includes some extensions Miguel has written
-
#234 The Astronomy-filled edition with Dr. Becky
19/05/2021 Duración: 49minWatch the live stream: Watch on YouTube 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: Dr. Becky Smethurst Brian #1: Powering the Python Package Index in 2021 Dustin Ingram A lot has changed in 5 years since the previous write-up From 3 people to 3 maintainers/admins 5 moderators 3 commiters Companies donate about $1.8M per month in services Fastly, mostly Google Cloud ~ $10K AWS ~ $7K Also Statuspage, Sentry, Datadog, Digicert, Pingdom Awesome grants to fund projects rewrite of PyPI Localization, internationalization, API tokens and 2FA Malware Detection and Update Framework Foundational Tool Improvements & Productionized Malware Detection Support Staff (a project manager) Growth, now up to (per day) 1.7 B requests pypi 55.4 TB pypi Next steps FUNDABLES.md, which is a non-exhaustive wishlist of large projects we’d like to see happen become a member, donate, or volunt
-
#233 RaaS: Readme as a Service
12/05/2021 Duración: 50minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guest: Marlene Mhangami Brian #1: readme.so Recommended by Johnny Metz This is not only useful, it’s fun Interactively create a README.md file Suggested sections great There are lots of sections though, so really only pick the ones you are willing to fill in. I think this is nicer than the old stand by of “copying the README.md of another project” because that other project might not have some of these great sections, like: Acknowledgements API Reference Authors FAQ Features Logo Roadmap Usage/Examples Running Tests Note, these sections are listed in alphabetical order, not necessarily the right order for how they should go in your README.md Produces a markdown file you can copy or download Also an editor so you can edit right there. (But I’d probably throw together the skeleton with dummy text and edit it in something with v
-
#232 PyPI in a box and a revolutionary keyboard
05/05/2021 Duración: 38minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guest: Annette Lewis Brian #1: Sphinx Themes Gallery update Curated and maintained by @pradyunsg and @shirou. I actually don’t know what it looked like before, but this is great. I’m working on my first real Sphinx project, so this is awesome to have. Features: Main image for each theme shows what theme looks like in wide, narrow, and phone layout Demos (click on an image): Main page that shows you quick start: install and config theme name Link to theme documentation Example of Navigation Kitchen sink paragraph level markup including inline, math, meta, blocks, code with sidebars, references, directives, footnotes, and more API documentation example essential if you are using this for documenting code Lists and tables Michael #2: Mongita - Like SQLite but for MongoDB Mongita is a lightweight embedded document data
-
#231 Go Python, Go!
28/04/2021 Duración: 44minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guests: Cecil Phillip Brian #1: For-Else: A Weird but Useful Feature in Python Yang Zhou After a for loop, you can put an else block. The else block only executes when there is no break in the loop. If the loop got all the way to the end, and off the end, the else block will run. First, I’m not used to putting break or else anywhere in my Python code, so I’m also curious why you’d want to do this. Yang explains the feature, then talks about 3 scenarios for use: Iterate and find items without needing a flag variable. break when you find what you are looking for, and the else only runs if you didn’t find it. Help to break out of nested loops I’m still confused by this one Help to handle exceptions Kind of a cool use. try/except in a for loop. Have a break in the except block. Then the else block will be fore code where y
-
#230 PyMars? Yes! FLoC? No!
21/04/2021 Duración: 45minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guests: Peter Kazarinoff Brian #1: calmcode.io by Vincent D. Warmerdam Suggested by Rens Dimmendaal Great short intro tutorials & videos. Not deep dives, but not too shallow either. Suggestions: pytest rich datasette I watched the whole series on datasette this morning and learned how to turn a csv data file into a sqlite database use datasette to open a server to explore the data filter the data visualize the data with datasette-vega plugin and charting options learn how I can run random SQL, but it’s safe because it’s read only use it as an API that serves either CSV or json deploy it to a cloud provider by wrapping it in a docker container and deploying that add user authentication to protect the service explore tons of available data sets that have been turned into live services with datasette Michael #2: Natural
-
#229 Has one of your dependencies died?
15/04/2021 Duración: 42minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guests: Gwendolyn Faraday Gwendolyn’s YouTube Brian #1: Coverage.py (5.6b1) and third-party code Problems If you put your virtual environment in the same directory as your code, and try to run coverage, it’s tricky to get coverage to not attempt to cover everything in your venv also. Or even just running coverage run -m pytest with no --source specified, it just kinda reports on everything, even stuff in site-packages, not just your code. Solution pip install coverage==5.6b1 As of 5.6b1, coverage knows where third party code is and doesn’t measure it. Super awesome Also, it’s still beta. Net wants help testing it out and making sure it works right. I’m curious if it still works right with pytest plugins and such, so I’ll be testing a bunch of stuff to make sure it still makes sense. Michael #2: So you want your own P
-
#228 Supreme Court decides API copyright battle
07/04/2021 Duración: 43minWatch the live stream: Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training pytest book Patreon Supporters Special guest Guy Royse Brian #1: How to make an awesome Python package in 2021 Anton Zhiyanov, @ohmypy Also thanks John Mitchell, @JohnTellsAll for posting about it. Great writing taking you through everything in a sane order. Stubbing a project with just .gitignore and a directory with a stub __init__.py. Test packaging and publishing use flit init to create initial pyproject.toml set up your ~/.pypirc file publish to the test repo Make the real thing make an implementation publish Extras Adding README.md & CHANGELOG.md and updating pyproject.toml to include README.md and a Python version selector. Adding linting and testing with pytest, tox, coverage, and others Building in the cloud with GH Actions, Codecov, Code Climate Adding badges Task automation with a Makefile Publishing to PyPI from a GH Action Missing (but possibl
-
#227 No more awaiting, async comes to SQLAlchemy
31/03/2021 Duración: 33minWatch the live stream: Watch on YouTube About the show Sponsored by us! Special guest: Micaela Reyes Brian #1: Number One, that's "retract plank," not "remove plank." Yanking vs removing versions on PyPI https://twitter.com/nedbat/status/1376901333958201352?s=20 https://pypi.org/help/#yanked see also https://doughellmann.com/posts/so-youve-released-a-broken-package-to-pypi-what-do-you-do-now/ Michael #2: SQLAlchemy 1.4.0 Released Exciting: 1st release to properly support an async API Has a new select() + execute() rather than session.query() API Intended to unify Core and ORM. See new vs. old API compared. Requires aiosqlite for async API + SQLite: conn_str = 'sqlite+aiosqlite:///filename' Micaela #3: django-tenants by Tom Turner Multi-tenancy Implementation for Django (typically for SaaS websites e.g. Shopify) currently on v3.2.1 (Aug 2020) release Requirements: Django 2 and PostgreSQL It was largely based on django-tenant-schemas library Data Architecture: shared database, separate schema f
-
#226 Teaching Python podcast on the podcast!
25/03/2021 Duración: 46minSpecial guests: Kelly Schuster-Paredes Sean Tibor Watch on YouTube Brian #1: DataClass vs NamedTuple vs Object: A Battle of Performance in Python Jack Song I’ve been using dataclass for a while now and love it. For some reason, I thought I heard there was some performance hit from them, so I was a bit worried before reading this. Jack came up with “a performance tests to compare the different size and speed when creating, reading and executing functions for Object, NamedTuple and the new DataClass introduced in Python 3.7” Object NamedTuple DataClass create 2.94 µs 2.01 µs 2.34 µs read property 24.7 ns 26.9 ns 24.7 ns nested property 48.1 ns 75.8 ns 52.1 ns execute function 829 ns 946 ns 821 ns size 56 bytes 80 bytes 56 bytes Marvelous. Dataclass is still awesome. At the very least, it’s on the same order of size and speed as other structures. Further questions: This was a limited bit of code, and performance metrics always depen
-
#225 SELECT Pydantic FROM MongoDB
17/03/2021 Duración: 39minSponsored by Linode! pythonbytes.fm/linode Special guest: Sebastian Witowski Watch on YouTube Brian #1: Raspberry Pi Pico Release Announcement A review $4 microcontroller Small Extremely low power needs. Built on RP2040, a brand-new chip developed by Raspberry Pi Related: Mu : codewith.mu, 1.1.0-beta.2 Mu is “a simple Python editor for beginner programmers.” 1.1.0 support new boards, including Pico, Lego Spike, plus lots of new fixes. Michael #2: New MongoDB ODM: Beanie via PyCoders Beanie - is an asynchronous ODM for MongoDB, based on Motor and Pydantic. Very new but also very exciting. Main component of Beanie is Pydantic. It helps to implement the main feature - data structuring. Beanie Document - is an abstraction over the Pydantic BaseModel that allows working with Python objects at the application level and JSON objects at the database level. Example, classes: class TagColors(str, Enum): RED = "RED" BLUE = "BLUE" GREEN = "GREEN" class Tag(BaseModel):
-
#224 Join us on a Python adventure back to 1977
10/03/2021 Duración: 37minSpecial guest: Calvin Hendryx-Parker Live stream Watch on YouTube Michael #1: AWSimple by James Abel AWSimple is a more object oriented interface on top of boto3 for some of the common “serverless” AWS services: S3, DynamoDB, SNS, and SQS. Features: Simple Object Oriented API on top of boto3 One-line S3 file write, read, and delete Automatic S3 retries Locally cached S3 accesses True file hashing (SHA512) for S3 files (S3's etag is not a true file hash) DynamoDB full table scans (with local cache option) DynamoDB secondary indexes Built-in pagination (e.g. for DynamoDB table scans and queries). Always get everything you asked for. Can automatically set SQS timeouts based on runtime data (can also be user-specified) Caching: S3 objects and DynamoDB tables can be cached locally to reduce network traffic, minimize AWS costs, and potentially offer a speedup. Brian #2: coverage and installed packages I’ve covered coverage.py a lot on Test & Code, starting with episode 12, and even talked about it
-
#223 Beware: A ninja is shadowing Sebastian from FastAPI
03/03/2021 Duración: 50minSponsored by Datadog: pythonbytes.fm/datadog Special guest: Sebastián Ramírez Live stream Watch on YouTube Brian #1: Python Developers Survey 2020 Results Using Python for? Lots of reductions in percentages. Increases in Education, Desktop, Games, Mobile, and Other Python 3 vs 2 94% Python3 vs 90% last year Python 3.8 has 44% of Python 3 usage, 3.5 or lower down to 3% environment isolation 54% virtualenv (I assume that includes venv) 32% Docker 22% Conda Web frameworks 46% Flask 43% Django 12% FastAPI … 2% Pyramid :( … Unit testing 49% pytest 28% unittest 13% mock OS 68% Linux, 48% Windows, 29% Mac, 2% BSD, 1% other CI: Gitlab, Jenkins, Travis, CircleCI … (Where’s GH Actions?) Editors: PyCharm, VS Code, Vim, … Lots of other great stuff in there Michael #2: Django Ninja - Fast Django REST Framework via Marcus Sharp and Adam Parkin (Codependent Codr) independently Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints. This project was heavily inspire
-
#222 Autocomplete with type annotations for AWS and boto3
24/02/2021 Duración: 38minSponsored by Linode! pythonbytes.fm/linode Special guest: Greg Herrera YouTube live stream for viewers: Watch on YouTube Michael #1: boto type annotations via Michael Lerner boto3's services are created at runtime IDEs aren't able to index its code in order to provide code completion or infer the type of these services or of the objects created by them. Type systems cannot verify them Even if it was able to do so, clients and service resources are created using a service agnostic factory method and are only identified by a string argument of that method. boto3_type_annotations defines stand in classes for the clients, service resources, paginators, and waiters provided by boto3's services. Example with “bare” boto3: Example with annotated boto3: Brian #2: How to have your code reviewer appreciate you By Michael Lynch Suggested by Miłosz Bednarzak Actual title “How to Make Your Code Reviewer Fall in Love with You” but
-
#221 Pattern matching and accepting change in Python with Brett Cannon
19/02/2021 Duración: 59minSponsored by Datadog: pythonbytes.fm/datadog Special guest: Brett Cannon Brian #1: Keeping up with Rich Will McGugan has been building Rich It looks like it’s on its way to becoming a full fledged TUI (text user interface) December: Live view: no blog post on that, I don’t think. January: Tree view: Rendering a tree view in the terminal with Python and Rich February: Layouts: Building Rich terminal dashboards fun fullscreen.py example, uses Live view Also, python -m rich will display a demo screen that shows tons of the stuff that Rich can do Many of the features also have a stand alone demo built in, like: $ python -m rich.layout $ python -m rich.tree $ python -m rich.live Although I haven’t figured out how to kill the live demo. it doesn’t seem to time out, and it eats Ctrl-C in my terminal. I’d really like to use Rich for interactive stuff, like keyboard interrupts and arrow keys and tab and such. It’d be fun. Which brings me to the bottom right corner of the python -m rich output.
-
#220 What, why, and where of friendly errors in Python
11/02/2021 Duración: 47minSponsored by Datadog: pythonbytes.fm/datadog Special guest: Hannah Stepanek Watch on YouTube Michael #1: We Downloaded 10,000,000 Jupyter Notebooks From Github – This Is What We Learned by Alena Guzharina from JetBrains Used the hundreds of thousands of publicly accessible repos on GitHub to learn more about the current state of data science. I think it’s inspired by work showcased here on Talk Python. 2 years ago there were 1,230,000 Jupyter Notebooks published on GitHub. By October 2020 this number had grown 8 times, and we were able to download 9,720,000 notebooks. 8x growth. Despite the rapid growth in popularity of R and Julia in recent years, Python still remains the most commonly used language for writing code in Jupyter Notebooks by an enormous margin. Python 2 went from 53% → 11% in the last two years. Interesting graphs about package usage Not all notebooks are story telling with code: 50% of notebooks contain fewer than 4 Markdown cells and more than 66 code cells. Although there are some out