The Real Python Podcast

Real Python
undefined
Jan 20, 2023 • 56min

Exploring Python With bpython & Formalizing f-String Grammar

Have you used the Python Read-Eval-Print Loop (REPL) to explore the language and learn about how it operates? Would it help if it provided syntax highlighting, definitions, and code completion and behaved more like an IDE? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. We discuss the drop-in REPL replacement bpython. bpython enhances the interactivity of a Python REPL session. It’s also a powerful teaching tool for instructors and students to experiment with and explore Python code. Christopher shares a recent Python Enhancement Proposal (PEP) about formalizing the grammar for f-strings. The PEP describes a reduction in the underlying parser code complexity and provides for future features like comments in multiline f-strings. We share several other articles and projects from the Python community, including a news roundup, a collection of surveys to classify Python virtual environment workflows, a course about context managers and Python’s with statement, a discussion about microfeatures that we would like to see adopted in Python, a Python terminal music player, and an infinite array powered by AI. Course Spotlight: Context Managers and Python’s with Statement In this video course, you’ll learn what the Python with statement is and how to use it with existing context managers. You’ll also learn how to create your own context managers. Topics: 00:00:00 – Introduction 00:02:21 – Pillow 9.4.0 Released 00:02:47 – Django Bugfix Release: 4.1.5 00:02:56 – Plone 6.0 Released 00:03:16 – PyCon Italia 2023 00:03:54 – Discover bpython: A Python REPL With IDE-Like Features 00:13:55 – PEP 701: Syntactic Formalization of f-Strings 00:17:07 – Sponsor: Influx Data 00:17:57 – Classifying Python Virtual Environment Workflows 00:30:26 – Context Managers and Python’s with Statement 00:36:32 – Video Course Spotlight 00:37:47 – Microfeatures I’d Like to See in More Languages 00:49:34 – Python Terminal Music Player 00:51:19 – Infinite AI Array 00:55:05 – Thanks and goodbye News: Pillow 9.4.0 Released Django Bugfix Release: 4.1.5 Plone 6.0 Released PyCon Italia 2023 Show Links: Discover bpython: A Python REPL With IDE-Like Features – In this tutorial, you’ll learn about bpython, an alternative Python REPL that brings code suggestions and many other IDE-like features to the terminal. Once you discover how much bpython can improve your productivity, you’ll never want to return to using the vanilla Python REPL again. PEP 701: Syntactic Formalization of f-Strings – This Python Enhancement Proposal describes the formalization of a grammar for f-strings, allowing a reduction in the underlying parser code complexity and providing future features like comments in multiline f-strings. Classifying Python Virtual Environment Workflows – This article discusses the various ways of creating and managing Python virtual environments, including what kinds of tools you could use. It categorizes the different styles and describes how the choices that you make affect your workflow. Context Managers and Python’s with Statement – In this video course, you’ll learn what the Python with statement is and how to use it with existing context managers. You’ll also learn how to create your own context managers. Microfeatures I’d Like to See in More Languages – Some language features are intrinsic to the language. Others are syntactic sugar that other programming languages could easily borrow. This opinion piece from Hillel highlights some features that the mainstream should steal from more obscure languages. Two Python features that he’d like to see in more languages are chained evaluations (2 <= x < 10) and numbers with separators (1000000 == 1_000_000). Projects: Python Terminal Music Player Infinite AI Array – Learn about an insane library containing special lists and dicts so that any missed calls automatically go to GPT3 and add a predictive value in its place. Additional Links: Christopher Trudeau’s - Act function for virtual environments Level up your Python skills with our expert-led courses: Working With Python Virtual Environments Python 3's F-Strings: An Improved String Formatting Syntax Context Managers and Using Python's with Statement Support the podcast & join our community of Pythonistas
undefined
6 snips
Jan 13, 2023 • 58min

Speeding Up Your DataFrames With Polars

How can you get more performance from your existing data science infrastructure? What if a DataFrame library could take advantage of your machine’s available cores and provide built-in methods for handling larger-than-RAM datasets? This week on the show, Liam Brannigan is here to discuss Polars. Liam is an experienced data scientist working in finance, technology, and environmental analysis. He’s recently started contributing to the documentation for Polars and developing a training course for the library. We talk about the library’s overall speed and lack of additional dependencies. Liam explains the advantages of lazy vs eager mode and which to choose when performing data exploration or attempting to load a dataset larger than your RAM. We also discuss potential barriers to switching to Polars from a pandas workflow. Across our conversation, we explore several other libraries and technologies, including Apache Arrow, DuckDB, query optimization, and the “rustification” of Python tools. Course Spotlight: Graph Your Data With Python and ggplot In this course, you’ll learn how to use ggplot in Python to build data visualizations with plotnine. You’ll discover what a grammar of graphics is and how it can help you create plots in a very concise and consistent way. Show Topics: 00:00:00 – Introduction 00:02:06 – Liam’s background and intro to Polars 00:03:37 – Hurdles to switching to Polars 00:05:23 – Creating training resources 00:08:15 – No index 00:09:46 – Data science 2025 predictions 00:12:02 – Contributions to Polars 00:15:07 – Eager vs lazy mode & query optimization 00:19:25 – Sponsor: Anaconda Nucleus 00:20:00 – Apache Arrow and parquet 00:24:43 – DuckDB and column orientation 00:29:27 – The “rustification” of libraries 00:34:49 – Video Course Spotlight 00:36:16 – GPUs and memory requirements 00:45:49 – No additional library requirements 00:47:37 – Development of the ecosystem 00:51:33 – Chaining operations 00:53:39 – How can people follow your work? 00:54:51 – What are you excited about in the world of Python? 00:56:09 – What do you want to learn next? 00:56:58 – Thanks and goodbye Show Links: Liam Brannigan - Data Scientist Polars polars - PyPI Coming from Pandas - Polars - User Guide Rho-Signal Data Analytics - YouTube Cheatsheet for Pandas to Polars - Rho Signal Data Analysis with Polars - Udemy I wrote one of the fastest DataFrame libraries - Polars Database-like ops benchmark comparison Data science 2025 - Liam Brannigan DuckDB - An in-process SQL OLAP database management system The great Python DataFrame showdown, part 1: Demystifying Apache Arrow Apache Arrow Learn Rust - Rust Programming Language Modern Polars Anaconda - PyScript Updates: Bytecode Alliance, Pyodide, and MicroPython Jupytext - Jupyter Notebooks as Markdown Documents, Julia, Python or R Scripts Polars up and running - Liam Brannigan Liam Brannigan - Data Scientist - Blog Liam Brannigan (@braaannigan) - Twitter Liam Brannigan - LinkedIn Level up your Python skills with our expert-led courses: Threading in Python Reading and Writing Files With pandas Graph Your Data With Python and ggplot Support the podcast & join our community of Pythonistas
undefined
Jan 6, 2023 • 45min

Surveying Comprehension Constructs & Python Parallelism Infighting

Have you embraced the use of comprehensions in your Python journey? Are you familiar with all the varieties of comprehension constructs? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. We discuss a recent article that surveys Python’s comprehensions and generators. This overview includes code snippets and the fundamentals of creating list, set, and dictionary comprehensions. We weigh the advantages of using a comprehension versus the more familiar for loops that they replace. Christopher shares an article about how there may be infighting between the parallelism in your Python code and the parallelism within the libraries that you’re using. These complex system interactions can cause processing slowdowns and hard-to-trace bottlenecks. We share several other articles and projects from the Python community, including a news roundup, a Python linter comparison, an overview of multiprocessing race conditions in Python, a discussion covering import statement styles, a project for WASM-powered Jupyter tools running in the browser, and a collection of easter eggs and jokes hidden inside Python itself. Course Spotlight: Understanding Python List Comprehensions Python list comprehensions make it easy to create lists while performing sophisticated filtering, mapping, and conditional logic on their members. In this course, you’ll learn when to use list comprehensions in Python and how to create them effectively. Topics: 00:00:00 – Introduction 00:02:41 – PyPy v7.3.10 Release 00:03:17 – Django Bugfix Release: 4.1.4 00:03:28 – Python 3.11.1, 3.10.9, 3.9.16, 3.8.16, 3.7.16 Released 00:03:56 – Python Linter Comparison 2022 00:11:51 – Who Controls Parallelism? A Disagreement That Leads to Slower Code 00:15:58 – Sponsor: InfluxDB 00:16:47 – A Crash Course in Comprehensions and Generators 00:24:23 – Multiprocessing Race Conditions in Python 00:27:46 – Video Course Spotlight 00:28:55 – What Style of import Statement Do You Use? 00:36:54 – jupyterlite: WASM Powered Jupyter Running in the Browser 00:40:35 – python-easter-eggs: Easter Eggs and Hidden Jokes in Python 00:43:18 – PyCoder’s Weekly: Submit a Link 00:43:46 – Thanks and goodbye News: PyPy v7.3.10 Release Django Bugfix Release: 4.1.4 Python 3.11.1, 3.10.9, 3.9.16, 3.8.16, 3.7.16 Released Show Links: Python Linter Comparison 2022 – There are many linter choices for Python. This article covers a lot of them: Pylint, Pyflakes, Flake8, autopep8, Bandit, Prospector, Pylama, Pyroma, Black, Mypy, Radon, and mccabe. Who Controls Parallelism? A Disagreement That Leads to Slower Code – In complex systems, there may be a fight between the parallelism in your code vs the parallelism in the libraries that you’re using. This fight can cause things to slow down. This article shows some examples and explores what you can do about the issue. A Crash Course in Comprehensions and Generators – A great collection of code snippets that showcase the power and flexibility of list comprehensions, generators, and related constructs. Multiprocessing Race Conditions in Python – A race condition happens when parallel tasks attempt to execute code at the same time and the results are dependent on order of execution. Finding race conditions can be challenging. This article gives some hints as to how to find the different kinds of race conditions when coding with the multiprocessing module. Discussion: What Style of import Statement Do You Use? Using wildcard imports (from … import *) — Python Anti-Patterns documentation Python import: Advanced Techniques and Tips – Real Python Projects: jupyterlite: WASM Powered Jupyter Running in the Browser python-easter-eggs: Easter Eggs and Hidden Jokes in Python Additional Links: Episode #39: Generators, Coroutines, and Learning Python Through Exercises – The Real Python Podcast How to Use Generators and yield in Python – Real Python PyCoder’s Weekly: Submit a Link Level up your Python skills with our expert-led courses: Threading in Python Understanding Python List Comprehensions Python Generators 101 Support the podcast & join our community of Pythonistas
undefined
Dec 23, 2022 • 1h 16min

2022 Real Python Tutorial & Video Course Wrap Up

It’s been another year of changes at Real Python! The Real Python team has written, edited, curated, illustrated, and produced a mountain of Python material this year. We added some new members to the team, updated the site’s features, and created new styles of tutorials and video courses. Three members of the Real Python team join us this week, Kate Finegan, Geir Arne Hjelle, and Leodanis Pozo Ramos. We wanted to share a year-end wrap-up with tutorials, step-by-step projects, and video courses that showcase what our team created this year. Kate and Geir Arne help to shepherd articles through the multi-stage editing process. Along with the rest of the team, they make sure these resources impart crucial Python knowledge and provide a thorough didactic experience. Leodanis’ name has been featured many times on this podcast, and it was great to talk to him about writing tutorials and diving deep into the Pythonic details. We hope you enjoy this review! Programming note, there won’t be an episode next week, but we’ll be back in January and look forward to bringing you a year full of great guests, articles, and topics. Course Spotlight: Building Python Project Documentation With MkDocs In this video course, you’ll learn how to build professional documentation for a Python package using MkDocs and mkdocstrings. These tools allow you to generate nice-looking and modern documentation from Markdown files and, more importantly, from your code’s docstrings. Topics: 00:00:00 – Introduction 00:03:02 – Geir Arne and RP content direction 00:04:31 – Kate Finegan and editing tutorials 00:07:35 – Leodanis Pozo Ramos and writing tutorials 00:09:14 – Changes for Real Python in 2022 00:18:56 – Your Python Coding Environment on Windows 00:23:32 – Sponsor: TelemetryHub 00:24:16 – Why Is It Important to Close Files in Python? 00:28:40 – Python and TOML: New Best Friends 00:33:47 – Sneaky REST APIs With Django Ninja 00:36:24 – Manage Your To-Do Lists Using Python and Django 00:39:52 – Python Constants: Improve Your Code’s Maintainability 00:42:59 – Build Your Python Project Documentation With MkDocs 00:49:28 – Building a URL Shortener With FastAPI and Python 00:51:24 – Video Course Spotlight 00:52:40 – Image Processing With the Python Pillow Library 00:57:20 – Draw the Mandelbrot Set in Python 01:05:01 – Using Python’s pip to Manage Your Projects’ Dependencies 01:11:39 – Exploring Scopes and Closures in Python 01:14:49 – Thanks and goodbye Show Links: Your Python Coding Environment on Windows: Setup Guide Why Is It Important to Close Files in Python? Python and TOML: New Best Friends Sneaky REST APIs With Django Ninja – Video Course Manage Your To-Do Lists Using Python and Django Python Constants: Improve Your Code’s Maintainability Build Your Python Project Documentation With MkDocs Building a URL Shortener With FastAPI and Python – Video Course Image Processing With the Python Pillow Library Draw the Mandelbrot Set in Python Using Python’s pip to Manage Your Projects’ Dependencies Exploring Scopes and Closures in Python – Video Course Additional Links: Building Python Project Documentation With MkDocs – Video Course Build a URL Shortener With FastAPI and Python – Step-by-Step Tutorial Level up your Python skills with our expert-led courses: Building Python Project Documentation With MkDocs Sneaky REST APIs With Django Ninja Exploring Scopes and Closures in Python Support the podcast & join our community of Pythonistas
undefined
4 snips
Dec 16, 2022 • 1h

Start Using a Build System & Continuous Integration in Python

What advantages can a build system provide for a Python developer? What new skills are required when working with a team of developers? This week on the show, Benjy Weinberger from Toolchain is here to discuss the Pants build system and getting started with continuous integration (CI). Benjy is one of the core developers of the Pants build system. He talks about the software tools and processes that a build system simplifies. We discuss how an individual developer can take advantage of continuous integration. We also cover some of the expectations when moving into professional software development. Have you learned about or started to use tools like linters, code formatters, import sorters, type checkers, and packaging systems? A build system is designed to combine all of those tools into a simplified, one-step process to share your best code. Benjy explains concepts like implementing fine-grained invalidation, moving to a monorepo, and using a build system for data science projects. He also shares his tips for getting started with Pants and finding help within the community. Course Spotlight: Testing Your Code With pytest In this video course, you’ll learn how to take your testing to the next level with pytest. You’ll cover intermediate and advanced pytest features such as fixtures, marks, parameters, and plugins. With pytest, you can make your test suites fast, effective, and less painful to maintain. Topics: 00:00:00 – Introduction 00:03:19 – Working on Pants 00:05:24 – Background on Toolchain 00:08:26 – Individual developer using CI 00:11:04 – When did you start using these types of tools? 00:14:30 – Was the organization open to the development of CI tools? 00:15:45 – Having a foundation with Git 00:17:11 – Moving toward workflows 00:23:30 – Sponsor: InfluxDB 00:24:20 – What’s fine-grained invalidation? 00:29:32 – Setting up test coverage 00:33:07 – Moving into packaging and deployment 00:37:22 – Advantages of a monorepo 00:42:10 – Video Course Spotlight 00:43:36 – Reasons for deeper Python integration 00:47:40 – Using the build system with data science projects 00:52:21 – Getting started with Pants 00:55:47 – What are you excited about in the world of Python? 00:57:12 – What do you want to learn next? 00:58:41 – How can people follow your work online? 00:59:27 – Thanks and goodbye Show Links: Pants 2: The ergonomic build system GitHub - pantsbuild/pants: The Pantsbuild developer workflow system Toolchain Labs E387 Build All the Things with Pants Build System - Talk Python To Me Continuous Integration With Python: An Introduction – Real Python Introduction to Git and GitHub for Python Developers – Real Python Monorepo Explained pex - PyPI pantsbuild/example-python: An example repo to demonstrate Python support The Pants community Christopher Neugebauer - Presentation at PyCon 2022 Talk - Christopher Neugebauer: Fast and reproducible tests, packaging, and deploys with… - YouTube Rust Programming Language Benjy Weinberger (@benjy) / Twitter Pantsbuild (@pantsbuild) / Twitter Level up your Python skills with our expert-led courses: Continuous Integration With Python Testing Your Code With pytest Test-Driven Development With pytest Support the podcast & join our community of Pythonistas
undefined
Dec 9, 2022 • 54min

Package Python Code With pyproject.toml & Listing Files With pathlib

How do you start packaging your code with pyproject.toml? Would you like to join a conversation that gently walks you through setting up your Python projects to share? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. We discuss a recent code conversation featuring Real Python team members Ian Currie and Geir Arne Hjelle. The video dives into the officially sanctioned way to configure your project using a pyproject.toml file. We cover how this relatively new approach will help you package your code for use on your system or for sharing with others. Christopher shares a Real Python tutorial about using pathlib to get a list of all the files within a directory. We’re both fans of pathlib and how it simplifies working with file paths. The tutorial digs into methods to recursively list all directory contents or create a conditional listing. We share several other articles and projects from the Python community, including an explanation of Python bytecode, an argument for always using [closed, open) intervals, a discussion about building the monolith before microservices, a way to parse natural language time and date expressions, and a project for posting on Mastodon. Course Spotlight: Using Python’s pathlib Module In this video course, you’ll learn how to effectively work with file system paths in Python 3 using the pathlib module in the standard library. Topics: 00:00:00 – Introduction 00:02:30 – Always Use [closed, open) Intervals 00:07:05 – Everyday Project Packaging With pyproject.toml 00:15:38 – Sponsor: InfluxDB 00:16:27 – How to Get a List of All Files in a Directory With Python 00:20:37 – Python Bytecode Explained 00:29:39 – Video Course Spotlight 00:30:48 – Build the Modular Monolith First 00:44:34 – toot - PyPI 00:49:58 – quickadd: Parse Natural Language Time and Date Expressions 00:53:09 – Thanks and goodbye Show Links: Always Use [closed, open) Intervals – “Intervals or ranges pop-up everywhere in the programming world. The classic example is picking a start and end date, like you would when booking an AirBnB or a flight. Have you ever wondered why they are always implemented as [closed, open) as opposed to [closed, closed]?” Everyday Project Packaging With pyproject.toml – In this Code Conversation video course, you’ll learn how to package your everyday projects with pyproject.toml. Playing on the same team as the import system means you can call your project from anywhere, ensure consistent imports, and have one file that’ll work for many build systems. How to Get a List of All Files in a Directory With Python – In this tutorial, you’ll be examining a couple of methods to get a list of files and folders in a directory with Python. You’ll also use both methods to recursively list directory contents. Finally, you’ll examine a situation that pits one method against the other. Python Bytecode Explained – When a Python program is run, the interpreter first parses your code and checks for syntax errors, then it translates it into bytecode instructions. This article explains some of the features of Python bytecode. Discussion: Build the Modular Monolith First – “Even talking about building a monolith today, is a bit taboo. It is all about microservices at the moment, and has been for a few years. But they aren’t a silver bullet.” Coding samples in the article aren’t Python, but the architectural advice is cross-language. Microservices and the First Law of Distributed Objects “I’m convinced that one of the biggest architectural mistakes of the past decade was going full microservice” Jason Warner - Twitter Projects: toot - PyPI quickadd: Parse Natural Language Time and Date Expressions Additional Links: Packaging Your Python Code With pyproject.toml | Complete Code Conversation - YouTube How to Publish an Open-Source Python Package to PyPI – Real Python Publishing Python Packages: Test, share, and automate your projects | Dane Hillard Episode #83: Ready to Publish Your Python Packages? – The Real Python Podcast Advanced Course on Python3 - MoserMichael - GitHub pyasmtool: Explores the Python bytecode, provides some tools to access it for fun and profit. - GitHub Episode #39: Generators, Coroutines, and Learning Python Through Exercises – The Real Python Podcast Episode #47: Unraveling Python’s Syntax to Its Core With Brett Cannon – The Real Python Podcast MVPy: Minimum Viable Python Episode #124: Exploring Recursion in Python With Al Sweigart – The Real Python Podcast Microservices and the First Law of Distributed Objects Mastodon for Python Devs - Talk Python #390 Mastodon is just blogs ActivityPub The Top 239 Activitypub Open Source Projects A 🦣 opportunity for developers - DEV Community 👩‍💻👨‍💻 Getting Started with Mastodon API in Python | Martin Heinz - Medium Christopher Trudeau (@cltrudeau) - Twitter Christopher Bailey | (@digiglean) - Twitter Christopher Bailey (@digiglean@fosstodon.org) - Fosstodon Real Python (@realpython@fosstodon.org) - Fosstodon Level up your Python skills with our expert-led courses: Lists and Tuples in Python Everyday Project Packaging With pyproject.toml Using Python's pathlib Module Support the podcast & join our community of Pythonistas
undefined
5 snips
Dec 2, 2022 • 58min

Preparing Data to Measure True Machine Learning Model Performance

How do you prepare a dataset for machine learning (ML)? How do you go beyond cleaning the data and move toward measuring how the model performs? This week on the show, Jodie Burchell, developer advocate for data science at JetBrains, returns to talk about strategies for better ML model performance. Jodie starts by defining some terms for the conversation. We talk about targets, features, and supervised learning. We discuss three common ways that data can alter model performance and which Python tools can help spot and avoid them. Jodie shares personal experiences of working through these pitfalls. We also share a healthy collection of resources to explore and learn more. Course Spotlight: Combining Data in pandas With concat() and merge() In this video course, you’ll learn two techniques for combining data in pandas: merge() and concat(). Combining Series and DataFrame objects in pandas is a powerful way to gain new insights into your data. Topics: 00:00:00 – Introduction 00:01:46 – Recent conference talks 00:03:24 – How to prepare your data for model performance 00:04:24 – Vocabulary: target, features, and supervised learning 00:06:28 – The curse of dimensionality 00:08:57 – Overfitting 00:11:08 – Underfitting 00:12:11 – Splitting the dataset 00:13:39 – K-fold cross validation 00:18:30 – Data leakage 00:21:36 – Checking for duplicates 00:26:23 – Applying transformations only after splitting data 00:31:16 – Imbalanced data 00:36:36 – Using ML to balance data 00:41:05 – Informing your model of the imbalance 00:42:56 – Video Course Spotlight 00:44:20 – Accuracy used as a measure 00:49:05 – Scikit-learn method classification_table 00:50:43 – Jet Brains blog post and conference talk 00:52:18 – How can people follow your work online? 00:54:39 – Upcoming webinars 00:56:20 – Thanks and goodbye Show Links: How to Prepare Your Dataset for Machine Learning and Analysis - The JetBrains Datalore Blog Curse of dimensionality - Wikipedia Overfitting vs. Underfitting: A Complete Example - Will Koehrsen A Gentle Introduction to k-fold Cross-Validation - MachineLearningMastery.com sklearn.model_selection.train_test_split — scikit-learn documentation Cross-validation: evaluating estimator performance — scikit-learn documentation sklearn.model_selection.cross_val_score — scikit-learn documentation Data Leakage And Its Effect On The Performance of An ML Model pandas.DataFrame.duplicated — pandas documentation pandas GroupBy: Your Guide to Grouping Data in Python – Real Python pandas.DataFrame.groupby — pandas documentation Difference between fit(), transform() and fit_transform() method in Scikit-learn - Aishwarya Chand: Nerd For Tech Imbalanced Data in Machine Learning - Google Developers Under-sampling — imbalanced-learn.org Over-sampling — imbalanced-learn.org Learn - Getting Started with Gretel.ai Classification on imbalanced data: Class weights - TensorFlow Core Tour of Evaluation Metrics for Imbalanced Classification - MachineLearningMastery.com CloudBrew - A two-day conference by AZUG, the Belgium Microsoft Azure User Group Jodie Burchell’s Blog - Standard error Jodie Burchell 🇦🇺🇩🇪 (@t_redactyl) - Twitter Jodie Burchell 🇦🇺🇩🇪 (@t_redactyl@fosstodon.org) - Fosstodon JetBrains: Essential tools for software developers and teams Level up your Python skills with our expert-led courses: Data Cleaning With pandas and NumPy Sneaky REST APIs With Django Ninja Combining Data in pandas With concat() and merge() Support the podcast & join our community of Pythonistas
undefined
16 snips
Nov 25, 2022 • 58min

Building Python REST APIs With Flask & Structuring Pull Requests

How do you build a REST API using the Flask web framework? How can you quickly add endpoints while automatically generating documentation? This week on the show, Real Python author Philipp Acsany is here to discuss his tutorial series “Python REST APIs With Flask, Connexion, and SQLAlchemy.” Christopher Trudeau is also here with another batch of PyCoder’s Weekly articles and projects. Philipp talks about updating a set of tutorials to use current libraries and best practices. The series takes you through building the base Flask project, defining endpoints, creating documentation, adding a persistent database, and implementing models with SQLAlchemy. Christopher shares an article about contributing to an existing internal or open-source project by properly preparing pull requests. The article is titled “Ten Tasty Ingredients for a Delicious Pull Request”. We share several other articles and projects from the Python community, including more suspicious PyPI packages using new tactics, method chaining in pandas, tools to find syntax errors without stopping, a library for searching text in videos using optical character recognition (OCR), a project for visualizing CPython’s specializing adaptive interpreter, and a library for building CLI applications based on type hints. Course Spotlight: The Pandas DataFrame: Working With Data Efficiently In this course, you’ll get started with pandas DataFrames, which are powerful and widely used two-dimensional data structures. You’ll learn how to perform basic operations with data, handle missing values, work with time-series data, and visualize data from a pandas DataFrame. Topics: 00:00:00 – Introduction 00:03:09 – Philipp’s background 00:05:37 – Python REST APIs With Flask, Connexion, and SQLAlchemy 00:14:35 – Ten Tasty Ingredients for a Delicious Pull Request 00:24:25 – Sponsor: InfluxDB 00:25:13 – Method Chaining in Pandas: Bad Form or a Recipe for Success? 00:31:35 – More Suspicious PyPI Packages 00:35:48 – Video Course Spotlight 00:37:01 – What Tools Find Syntax Errors Without Stopping? 00:47:29 – Perform OCR upon entire videos 00:49:49 – Visualize CPython 3.11’s Specializing, Adaptive Interpreter 00:54:08 – Typer, build great CLIs 00:56:29 – Thanks and goodbye Show Links: About Philipp Acsany – Real Python Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 1 Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 2 Python REST APIs With Flask, Connexion, and SQLAlchemy – Part 3 Ten Tasty Ingredients for a Delicious Pull Request – LB is a core team member of the open-source project Wagtail and, as such, has a lot of experience dealing with community contributions. This article talks about how to be a good contributor, whether for your next open-source software (OSS) PR or within your own organization. Method Chaining in Pandas: Bad Form or a Recipe for Success? – Python trainer Matt Harrison has been creating a bit of a stir. Some of his pandas examples have elicited criticism from different folks in the Twitterverse. Dave Amos interviews Matt to discuss the pros and cons of his approach. More Suspicious PyPI Packages – Researchers at Phylum have come across over a dozen new malicious uploads to PyPI. Many of them are copied and pasted versions of legitimate packages that have been renamed and had malicious code inserted. This detailed article shows some of the tactics used by the bad actors. Discussion: What Tools Find Syntax Errors Without Stopping? Projects: videocr: Perform OCR upon entire videos to look for credentials or similar Visualize CPython 3.11’s Specializing, Adaptive Interpreter Typer, build great CLIs Additional Links: What Percentage Of Websites Use WordPress In 2022? “Here’s a recipe to clean up the Ames housing dataset.” Matt Harrison - Twitter Idiomatic Pandas - Matt Harrison | Conf42 Python 2021 - YouTube Episode #103: Becoming More Effective at Manipulating Data With Pandas – The Real Python Podcast Getting started - Polars - User Guide py_compile — Compile Python source files — Python 3.11.0 documentation Build a Command-Line To-Do App With Python and Typer – Real Python Level up your Python skills with our expert-led courses: Deploy Your Python Script on the Web With Flask The pandas DataFrame: Working With Data Efficiently SQLite and SQLAlchemy in Python: Moving Your Data Beyond Flat Files Support the podcast & join our community of Pythonistas
undefined
Nov 18, 2022 • 45min

Moving Projects Away From Passwords With WebAuthn and Python

What if you didn’t have to worry about managing user passwords as a Python developer? That’s where the WebAuthn protocol and new hardware standards are heading. This week on the show, Dan Moore from FusionAuth returns to discuss a password-less future. WebAuthn is a way to authenticate users using biometric, secure authentication methods. Dan dives into passkeys, ceremonies, authenticators, and hardware standards. We also cover several projects and libraries that can help you get started with WebAuthn in Python. Course Spotlight: Refactoring: Prepare Your Code to Get Help In this Code Conversation video course, you’ll explore the steps you can take to get help when you’re stuck while coding. You’ll investigate how to clean up your code to focus on the question you have. Along the way, you’ll learn how to handle errors and use custom exceptions. Topics: 00:00:00 – Introduction 00:01:36 – Dan’s WebAuthn article 00:03:26 – FIDO and WebAuthn 00:05:53 – What’s a YubiKey? 00:07:57 – Phones with biometric systems 00:12:03 – Sponsor: CData Software 00:12:45 – Similarities to HTTPS 00:16:13 – A password-less future 00:24:31 – Where’s it being used? 00:30:53 – Video Course Spotlight 00:32:26 – Python WebAuthn projects and packages 00:34:52 – Does a developer need to set up additional auth methods? 00:37:31 – How are the third-party auth services implementing this? 00:39:50 – What are you excited about in the world of Python? 00:41:24 – What do you want to learn next? 00:43:20 – Thanks and goodbye Show Links: WebAuthn Explained - FusionAuth Episode #99: OAuth 2 and Authentication Choices for Your Python Project – The Real Python Podcast All about FIDO2, CTAP2 and WebAuthn - Microsoft Community Hub YubiKey - Hardware Security Keys Apple Adopts Passwordless Authentication Technology – Hideez 1Password is launching passkey support in early 2023 - The Verge duo-labs/py_webauthn: Pythonic WebAuthn python-webauthn: Server side handlers for WebAuthN with support for Apple’s FaceID, and the FIDO metadata service pywarp - PyPI webauthn-rp documentation Going Passwordless With py_webauthn - Duo Security django-webauth: Two Factor Authentication in Django using Web Authentication API (WebAuthn) django-webauthin - PyPI python-fido2 Python 3.11.0 Release - Python.org Real Food Fermentation by Alex Lewin - Amazon Auth. Built for Devs, by Devs - FusionAuth Level up your Python skills with our expert-led courses: Exploring HTTPS and Cryptography in Python Python Basics: Finding and Fixing Code Bugs Refactoring: Prepare Your Code to Get Help Support the podcast & join our community of Pythonistas
undefined
Nov 11, 2022 • 54min

Creating Tic-Tac-Toe With an AI Player & Shortcuts for Python Decorators

How do you create a computer opponent for a simple game within Python? Would you also like to learn how to adapt the game to run in a web browser or graphical user interface (GUI)? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder’s Weekly articles and projects. Christopher shares a recent Real Python step-by-step project for creating a tic-tac-toe game engine. He talks about how to build the game engine and adapt it for different front ends. The tutorial also shows how to implement an unbeatable computer player using the minimax algorithm. We discuss an article about how to avoid repeating yourself when creating decorators with multiple parameters. We talk about how you can stop copying and pasting code several times by assigning the decorator to a new variable. We share several other articles and projects from the Python community, including a news roundup, a deep dive into Python’s doctest, several Python command line tricks, type annotations via automated refactoring, a new way to draw boxes in the terminal, a collection of projects for beginners with source code, a minimalist PDF creation library, and a tool for sensible logging in Python. Course Spotlight: Python Decorators 101 In this course on Python decorators, you’ll learn what they are and how to create and use them. Decorators provide a simple syntax for calling higher-order functions in Python. By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it. Topics: 00:00:00 – Introduction 00:02:25 – Python 3.12.0 Alpha 1 Released 00:02:45 – PyCon US 2023 Call for Proposals 00:03:27 – Python’s doctest: Document and Test Your Code at Once 00:13:59 – Build a Tic-Tac-Toe Game Engine With an AI Player in Python 00:22:12 – Sponsor: InfluxDB 00:22:59 – Python Command Line Tricks 00:30:50 – Type Annotation via Automated Refactoring 00:34:29 – A New (?) Way of Drawing Boxes in the Terminal 00:37:10 – Decorator Shortcuts 00:39:36 – Video Course Spotlight 00:41:02 – 190 Python Projects With Source Code 00:47:58 – fpdf2: Minimalist PDF Creation Library 00:50:04 – Simple, Sane, and Sensible Logging in Python 00:53:05 – Thanks and goodbye News: Python 3.12.0 Alpha 1 Released PyCon US 2023 Call for Proposals Topics: Python’s doctest: Document and Test Your Code at Once – In this tutorial, you’ll learn how to add usage examples to your code’s documentation and docstrings and how to use these examples to test your code. To run your usage examples as automated tests, you’ll use Python’s doctest module from the standard library. Build a Tic-Tac-Toe Game Engine With an AI Player in Python – In this step-by-step tutorial, you’ll build a universal game engine in Python with tic-tac-toe rules and two computer players, including an unbeatable AI player using the minimax algorithm. You’ll also create a text-based graphical front end for your library and explore two alternative front ends. Python Command Line Tricks – Using python -m you can do all sorts of things from the command line, including starting a webserver, opening a browser, parsing JSON, compressing files, and much more. Type Annotation via Automated Refactoring – Jimmy’s team at Carta decided they wanted to add type annotations to their large codebase, but doing so manually would’ve taken a very long time. This post shows you how they built automated refactoring tools to add type annotations to their code. A New (?) Way of Drawing Boxes in the Terminal – With clever use of some of the Unicode border characters, you can build a better box around your text, without any color bleeding. Decorator Shortcuts – “When using many decorators in code, there’s a shortcut you can use if you find yourself repeating them. They can be assigned to a variable just like any other Python expression.” Discussion: 190 Python Projects With Source Code Projects: fpdf2: Minimalist PDF Creation Library Simple, Sane, and Sensible Logging in Python – Get started with logging in Python or deploy advanced, flexible loggers without the boilerplate code. Learn all about log2d, a third-party wrapper for the Python logging library. Additional Links: Build Your Python Project Documentation With MkDocs – Real Python Episode #97: Improving Your Django and Python Developer Experience – The Real Python Podcast Python’s zipapp: Build Executable Zip Applications – Real Python Episode #80: Make Your Python App Interactive With a Text User Interface (TUI) – The Real Python Podcast Episode #20: Building PDFs in Python with ReportLab – The Real Python Podcast Links for Documentation FPDF and Other Ports PFython/log2d - GitHub Level up your Python skills with our expert-led courses: How to Work With a PDF in Python Python Inner Functions Python Decorators 101 Support the podcast & join our community of Pythonistas

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app