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

24H24L
Evento en línea, de 24 horas de duración que consiste en la emisión de 24 audios de diversas temáticas sobre GNU/Linux. Estos son los audios del evento en formato podcast.

The Infinite Monkey Cage
Brian Cox and Robin Ince host a witty, irreverent look at the world through scientists' eyes.

Talking Kotlin
A bimonthly podcast that covers the Kotlin programming language by JetBrains, as well as related technologies. Hosted by Hadi Hariri
#345 Some Big Time Releases
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training The Python People Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Cython 3.0 Long in development, the new major release of the Python-to-C compiler sheds legacy Python support and readies Cython developers for big changes in Python. Cython 3 cleans up and modernizes Cython. Pure Python mode allows Python developers to use their existing Python linting and code analysis tools on Cython. Brian #2: Reading code : An important but seldom-discussed skill Eric Matthes A cool walk through of several techniques to read code Strategies Ignore function definitions And in the example, also ignore comments Simplify repetitive blocks Examples shows mentally lumping a bunch of print statements into “print message” Utilize IDE tools, like folding to hide functions your not looking at Also includes a note about writing readable code. Notes: People believe your function and variable names, they should be descriptive, and they should not be deceptive. Michael #3: Major new version of MicroPython: v1.20.0 via Matt Trentini >10 months, >1000 mainline commits from >100 contributors This release of MicroPython introduces a new lightweight package manager called mip. In the MicroPython runtime, core/built-in types have been compressed by only including in the C-level type struct as many slots for C function pointers as is needed for a given type → Any third-party C extensions will need to be updated to work with this change. Massive list of detailed changes. Brian #4: Advanced Python Tips for Development Scofield Idehen There’s 15 in the article, here’s a few 1 & 2. Use List Comprehensions and Generator Expressions. It’s cool to see them side by side enumerate() is fun Embrace zip(). It’s weird, but very useful. Utilize slots to Reduce Memory Usage Extras Brian: Hear the story behind the quote “I came for the language, but I stayed for the community.” and learn about fountain pens, tea, and a Murderbot, on this week‘s Python People. Michael: Search (LLM like) Talk Python: explore-talk-python-to-me.streamlit.app by Aguss Joke: You’re full stack now Seriously, take the HTMX course :)
#344 AMA: Ask Us Anything
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Main topic: AMA questions from the audience. Use the transcript search to find timestamps if you want to locate a particular one. Extras Michael: Deputy CPython Developer in Residence position accepting applications. My Make Your Python Web App Fly Around the World with CDNs talk at PWC 2023 is online. “Joke”: Ode to Python recommended by FelixTheCat
#343 So Much Pydantic!
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Pydantic v2 released Pydantic V2 is compatible with Python 3.7 and above. There is a migration guide. Check out the bump-pydantic tool to auto upgrade your classes Brian #2: Two Ways to Turbo-Charge tox Hynek Not just tox run-parallel or tox -p or tox --``parallel , but you should know about that also. The 2 ways Build one wheel instead of N sdists Run pytest in parallel tox builds source distributions, sdists, for each environment before running tests. that’s not really what we want, especially if we have a test matrix. It’d be better to build a wheel once, and use that for all the environments. Add this to your tox.ini and now we get one wheel build [testenv] package = wheel wheel_build_env = .pkg It will save time. And a lot if you have a lengthy build. Run pytest in parallel, instead of tox in parallel, with pytest -n auto Requires the pytest-xdist plugin. Can slow down tests if your tests are pretty fast anyway. If you’re using hypothesis, you probably want to try this. There are some gotchas and workarounds (like getting coverage to work) in the article. Michael #3: Awesome Pydantic A curated list of awesome things related to Pydantic! 🌪️ Notable items for me: ML: spaCy 🌟(26575) - spaCy is a free open-source library for Natural Language Processing in Python. It features NER, POS tagging, dependency parsing, word vectors and more. ray 🌟(26496) - Ray provides a simple, universal API for building distributed applications. jina 🌟(18734) - Jina is geared towards building search systems for any kind of data, including text, images, audio, video and many more. With the modular design & multi-layer abstraction, you can leverage the efficient patterns to build the system by parts, or chaining them into a Flow for an end-to-end experience. Data Beanie 🌟(1287) - Beanie - is an Asynchronous Python object-document mapper (ODM) for MongoDB, based on Motor and Pydantic. Utilities datamodel-code-generator 🌟(1694) - Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources. Goodconf 🌟(99) - A thin wrapper over Pydantic's settings management. Allows you to define configuration variables and load them from environment or JSON/YAML file. Also generates initial configuration files and documentation for your defined configuration. Brian #4: CLI tools hidden in the Python standard library Simon Willison (and hat tip to Seth Larson) Simon looked for all of the command line goodies in the standard library. I knew about python -m http.server to run a server at port 8000 from the local directory, but there’s so much more. Here are a few python -m gzip --decompress pypi.db.gz as a gzip utility. Especially handy on Windows as it doesn’t come with gzip by default python -m base64 with -d decode, -e encode, and -t encode and decode python -m asyncio for an asyncio REPL Tokenize a Python file with python -m tokenize somefile.py View the AST with python -m ast somefile.py Pretty print JSON with python -m json.tool Extras Brian: Congrats to Seth Larson, PSFs first Security Developer-in-Residence Announcing Our New Security Developer in Residence! - PSF announcement I am the first PSF Security Developer-in-Residence - Seth’s announcement PythonPeople.fm is live "The NEW podcast about the people who make the Python community awesome.” I’m focusing more on the people, and less on the tech. First episode is with Michael Kennedy Upcoming episodes in the works with Paul Everitt, Paul McGuire, and Steve Holden. More people scheduled, many asked, and many more to be asked. Michael: MongoDB with Async Python course is out! (talkpython.fm/async-mongodb) Meta commits to dedicate three engineer-years to implement the removal of the GIL from Python PyPI has a blog Joke: Containers, that’ll fix it Bonus dad joke: 5 ants rent an apartment. Invite 5 other ants to share the rent. Now there are tenants.
#342 Don't Believe Those Old Blogging Myths
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Plumbum: Shell Combinators and More Suggested by Henry Schreiner last week. (Also, thanks Michael for the awesome search tool on PythonBytes.fm that includes transcripts, so I can find stuff discussed and not just stuff listed in the show notes.) Plumbum is “ a small yet feature-rich library for shell script-like programs in Python. The motto of the library is “Never write shell scripts again”, and thus it attempts to mimic the shell syntax (shell combinators) where it makes sense, while keeping it all Pythonic and cross-platform.” Supports local commands piping redirection working directory changes in a with block. So cool. lots more fun features Michael #2: Our plan for Python 3.13 The big difference is that we have now finished the foundational work that we need: Low impact monitoring (PEP 669) is implemented. The bytecode compiler is a much better state. The interpreter generator is working. Experiments on the register machine are complete. We have a viable approach to create a low-overhead maintainable machine code generator, based on copy-and-patch. We plan three parallelizable pieces of work for 3.13: The tier 2 optimizer Enabling subinterpreters from Python code (PEP 554). Memory management Details on superblocks Brian #3: Some blogging myths Julia Evans <from Brian: I’m not sure if I’m including this to convince all of you to blog more, or to convince myself. Hopefully both happens.> myths (more info of each in the blog post): you need to be original you need to be an expert posts need to be 100% correct writing boring posts is bad you need to explain every concept page views matter more material is always better everyone should blog I’d add Write posts to help yourself remember something. Write posts to help future prospective employers know what topics you care about. You know when you find a post that is outdated and now wrong, and the code doesn’t work, but the topic is interesting to you. Go ahead and try to write a better post with code that works. Michael #4: Jupyter AI A generative AI extension for JupyterLab An %%ai magic that turns the Jupyter notebook into a reproducible generative AI playground. This works anywhere the IPython kernel runs (JupyterLab, Jupyter Notebook, Google Colab, VSCode, etc.). A native chat UI in JupyterLab that enables you to work with generative AI as a conversational assistant. Support for a wide range of generative model providers and models (AI21, Anthropic, Cohere, Hugging Face, OpenAI, SageMaker, etc.). Official project from Jupyter Provides code insights Debug failing code Provides a general interface for interaction and experimentation with currently available LLMs Lets you collaborate with peers and an Al in JupyterLab Lets you ask questions about local files Video presentation: David Qiu - Jupyter AI — Bringing Generative AI to Jupyter | PyData Seattle 2023 Extras Brian: Textual has some fun releases recently Textualize youtube channel with 3 tutorials so far trogon to turn Click based command line apps into TUIs video example of it working with sqlite-utils. Python in VSCode June Release includes revamped test discovery and execution. You have to turn it on though, as the changes are experimental: "python.experiments.optInto": [ "pythonTestAdapter", ] I just turned it on, so I haven’t formed an opinion yet. Michael: Michael’s take on the MacBook Air 15” (black one) Joke: Phishing
#341 Shhh - For Secrets and Shells
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Pydantic roadmap via Mario Munoz Back in February [Samuel] [announced](https://pydantic.dev/announcement/) Pydantic Inc., but I didn't explain what services we were building. The problem is that even with Pydantic in your corner, working with data when it leaves Python often still sucks. We want to build a data platform to make working with data quick, easy, and enjoyable — where developer experience is our north star. There are five key components to the Pydantic Data Platform that we're thinking of building. Python Analytics/Observability — a logging and metrics platform with tight Python and Pydantic integration, designed to make the data flowing through your application more readily usable for both engineering and business analytics. More info... Data Gateway for object stores — Add validation, transformation and cataloguing in front of object stores like S3, with a schema defined in Pydantic models then validated by our Rust service. More info... Data Gateway for data warehouses — the same service as above, but integrated with your existing data warehouse. More info... Schema Catalog — for many, Pydantic already holds the highest fidelity representation of their data schemas. Our Schema Catalog will take this to the next level, serving as an organization-wide single source of truth for those schemas, tracking their changes, and integrating with our other tools and your wider platform. More info... Dashboards and UI powered by Pydantic models — a managed platform to deploy and control dashboards, auxiliary apps and internal tools where everything from UI components (like forms and tables) to database schema would be defined in Python using Pydantic models. More info... Tell them what you think with their survey Brian #2: The Right Way to Run Shell Commands From Python Martin Heinz Should have a tagline of “especially if you’re on Mac or Linux”. Includes discussion of Python native tools - recommended a few os module functions - but otherwise avoid relying too much on os. subprocess.run() - stick with run() if you can. sh third party package - should be second choice if on Linux or Mac Michael #3: US: Yep, We're Buying Your Data, Including Your Embarrassing Secrets Digital information can be purchased from commercial data brokers and 'deanonymized' to ID the person it's tied to, including US citizens, the Office of the Director of National Intelligence says. The Office of the Director of National Intelligence (ODNI) on Friday declassified(Opens in a new window) a report from January 2022 that outlines the US government’s approach to using Commercially Available Information (CAI), which can come from data brokers working in the internet ad and analytics industries. The purchased information includes details from users' smartphones and social media accounts. To all the “please disable your ad blockers” companies out there 1) It’s not just about supporting your website 2) Ad blockers are not just avoiding ads. 3) It’s not even necessary (our ads are not blocked on the podcast or the website) Consider browser != Chrome and/or nextdns.io for your whole network Brian #4: Pro-Tip – pytest fixtures are magic! Frank Wiles “The magic of pytest fixtures is how they are injected into your tests for you to use and their composability. When done well, writing tests is considerably easier and actually fun.” Setup code is often the biggest headache of test writing. pytest fixtures help solve the setup problem. Fixtures are used by just including them in a tests parameter list can build on top of each other can be used in any test in the project, if you put it in a central conftest.py can return all kinds of things: static data, instantiated objects, callables to make other things, Frank includes an interesting way to organize fixtures such that they are defined in local test directories but usable across a project, under “Organizing Your Fixtures”. Plugins with fixtures: A shoutout to pytest-django and a Revsys plugin called django-test-plus. Built-in fixtures. See also tmp_path. autouse One bit of incorrect info: autouse doesn’t work like that. The value of global_thing cannot be grabbed unless you list it in the parameter list. It will run before every function (since it’s scope=``"``function``" by default), but you gotta list it to get the value. To be fair, it’s really hard to come up with good autouse examples. Partly because there are so few good reasons to use autouse. Extras Brian: Porting Python projects to Rust International Obfuscated Python Code Competition Michael: Remember the AMA (submit your question). “Scheduled” on July 11th at 11am. Joke: Marked as duplicate
#340 Snorkel not included
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Ask me anything episode: Submit your question(s) for our upcoming AMA episode: form here. Thank you! Brian #1: PythonGUIS Martin Fitzpatrick A site with a collection of resources, guides, books, comparisons, etc, around GUIs in Python. Martin recommends starting with PyQT6 However, there are tutorials covering PyQT6 PySide6 PyQT5 TkInter PySide even Kivy Michael #2: JupyterLab 4.0 is Here The next major release of our full-featured development environment You can upgrade by running pip install --upgrade jupyterlab or conda install -c conda-forge jupyterlab. JupyterLab is now faster, thanks to improvements such as CSS rules optimization, CodeMirror 6, MathJax 3, and notebook windowing. JupyterLab 3 was when working with large notebooks. There are additional performance improvements available via opt-in settings: Faster tab-switching on Chromium browsers: “Settings” → “JupyterLab Shell” → switch “Hidden mode” to “contentVisibility” Better performance with long notebooks: “Settings” → “Notebook” → switch “Windowing mode” to “full” An upgraded text editor. Better real time collaboration. Bug fixes. More than 100 bugs have been addressed and resolved, enhancing JupyterLab’s stability and performance. Brian #3: Proposing a struct syntax for Python Brett Cannon This would be a cool syntax for a data only type: struct Point(x: int, y: int) No positional only parameters No inheritance No methods Instances would be immutable, so p = Point(1, 2) would create an object that could be used as a key. A data only focused set of types. Michael #4: Python 3.13 Removes 20 Stdlib Modules via PyCoders From PEP 594 – Removing dead batteries from the standard library we’re saying goodbye to aifc, audioop, cgi, cgitb, chunk, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib As well as the 2to3 program and lib2to3 module in Python. Python 3.12 final release is scheduled in 4 months (October 2023) and Python 3.13 final release is scheduled in 1 year and 4 months (October 2024). Extras Brian: Affirming your PSF Membership voting status You have until June 15 to affirm your voting rights in the upcoming Board Election, if you care about such things. Michael: 5 Career Tips for Budding Python Developers video PyCon US 2023 videos are up Python 3.11.4, 3.10.12, 3.9.17, 3.8.17, 3.7.17, and 3.12.0 beta 2 are now available Joke: Snorkel not included
#339 Actual Technical People
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: pystack PyStack is a tool that uses forbidden magic to let you inspect the stack frames of a running Python process or a Python core dump, helping you quickly and easily learn what it's doing. PyStack has the following amazing features: 💻 Works with both running processes and core dump files. 🧵 Shows if each thread currently holds the Python GIL, is waiting to acquire it, or is currently dropping it. 🗑️ Shows if a thread is running a garbage collection cycle. 🐍 Optionally shows native function calls, as well as Python ones. In this mode, PyStack prints the native stack trace (C/C++/Rust function calls), except that the calls to Python callables are replaced with frames showing the Python code being executed, instead of showing the internal C code the interpreter used to make the call. 🔍 Automatically demangles symbols shown in the native stack. 📈 Includes calls to inlined functions in the native stack whenever enough debug information is available. 🔍 Optionally shows the values of local variables and function arguments in Python stack frames. 🔒 Safe to use on running processes. PyStack does not modify any memory or execute any code in a process that is running. It simply attaches just long enough to read some of the process's memory. ⚡ Optionally, it can perform a Python stack analysis without pausing the process at all. This minimizes impact to the debugged process, at the cost of potentially failing due to data races. 🚀 Super fast! It can analyze core files 10x faster than general-purpose tools like GDB. 🎯 Even works with aggressively optimized Python interpreter binaries. 🔍 Even works with Python interpreters' binaries that do not have symbols or debug information (Python stack only). 💥 Tolerates memory corruption well. Even if the process crashed due to memory corruption, PyStack can usually reconstruct the stack. 💼 Self-contained: it does not depend on external tools or programs other than the Python interpreter used to run PyStack itself. Brian #2: Securing PyPI accounts via Two-Factor Authentication Donald Stufft “… every account that maintains any project or organization on PyPI will be required to enable 2FA on their account by the end of 2023.” “One of the key security promises that PyPI makes is that when you're downloading something, that only the people associated with that project are going to be able to upload, delete, or otherwise modify a project. That when you look at that project and see that it is owned by someone that you trust, that you can be assured that nobody else is making changes to that package on PyPI.” If you maintain a package on PyPI to a point where you are uploading to PyPI or plan to soon, enable 2FA on you account. May as well do it sooner than later. But officially, you have the rest of the year. This has already been a requirement for “critical projects” since last summer. (top 1% of downloads, about 3,500 projects.) See episode 293. Now it’s going to be for everyone. Michael #3: Propan - a declarative Python MQ framework Propan is a powerful and easy-to-use Python framework for building asynchronous web services that interact with any MQ Broker. It's following by fastapi, simplify Message Brokers around code writing and provides a helpful development toolkit, which existed only in HTTP-frameworks world until now. It is a modern, high-level framework on top of popular specific Python brokers libraries, based on pydantic and fastapi, pytest concepts. The key features are Simple: Designed to be easy to use and learn. Intuitive: Great editor support. Autocompletion everywhere. Dependencies management: Minimization of code duplication. Access to dependencies at any level of the call stack. Integrations: Propan is fully compatible with any HTTP framework you want MQ independent: Single interface to popular MQ: Redis (based on redis-py) RabbitMQ (based on aio-pika) Kafka (based on aiokafka) SQS (based on aiobotocore) Nats (based on nats-py) RPC: The framework supports RPC requests over MQ, which will allow performing long operations on remote services asynchronously. Great to develop: CLI tool provides great development experience: framework-independent way to manage the project environment application code hot reload robust application templates Testability: Propan allows you to test your app without external dependencies: you do not have to set up a Message Broker, you can use a virtual one! Brian #4: Makefile tricks for Python projects Ricardo Ander-Egg A pretty short basic starter template Makefile for Python projects with some cool snippets. Some default settings to have make behave sanely exit on error, warn about undefined variables, disable built-in rules set up working directory correctly if called from a different dir A $(py) definition that picks up the virtual environment if it’s there. Also $(pip) from the virtual env. Default goal and help message cool trick so that make with no arguments just prints the help And also picks up target comments as help text for the target. Neat. Injecting paths into PYTHONPATH, and an example on how that works if you need it. A .venv target create a virtual environment, update setuptools, wheel, build, and install requirments Extras Michael: PyCon Portugal CFP DjangoCon 2024 Apple Vision Pro Duet App Joke: Actual technical people
#338 Scripting iOS with Python
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Special guest: GUEST_PROFILE Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: The Basics of Python Packaging in Early 2023 Jay Qi Good description of a minimal-ish pyproject.toml file, which includes a build backend and project metadata. That’s all you need for a Python-only project. Discussion of how to choose a build backend. Mostly it’s baed on extra features you might want, like hatchling’s include/exclude features for source distributions. Some discussion of frontend choices. Nice discussion of non-Python-only builds. Specifically, if you need to compile C or C++ extensions, you can use scikit-build-core, or meson-python, or setuptools. Related: "Sharing is Caring - Sharing pytest Fixtures" by Brian Okken (PyCascades 2023) My PyCascades 2023 on packaging pytest plugins is up on YouTube Michael #2: vecs via Oli Python collection-like interface to storing and searching vectors in postgres. Vector search is a key component in building AI chatbots, and semantic document search. If you're familiar with the space, it's effectively Pinecone built on free OSS It's under the Supabase github org but it's fully open source, and compatible with any pgvector vendor, e.g. RDS, or locally in docker If you’re on macOS and need Postgres, Postgres App is a good option. Brian #3: Introducing Grasshopper - An Open Source Python Library for Load Testing Jacob Fiola “Grasshopper is a library for automated load testing, written in Python.” Open source project from Alteryx, On GitHub and PyPI under the name locust-grasshopper Built on Locust. Adds Tag-based suites for trend analysis and evaluating changes. Custom trends. Useful for actions that span multiple http calls, and you want to see timing trends for the whole action. Checks. Checks validate boolean conditions in the test. Custom tagging for all metrics Send data to time series db & dashboards. Thresholds. Reporting results to other locations. Some reusable base classes that take care of the majority of the boilerplate that tests often contain Readme has a very thorough introduction including configuration and samples. Michael #4: memocast by Daniel Engvall A small iOS app for e.g. iPhone that allow you to add links heard in podcasts into reminders. Good example of how to use Pythonista to build python scripts for iOS Pythonista just made an update (2 weeks ago) so that'd use Python 3.10 on the iOS which makes it even more interesting. Extras Brian: Help test Python 3.12 beta! Python Language Summit write-ups available PyPI was subpoenaed Michael: You Can Ignore This Post Joke: Careful or you might end up summoning a demon.
#337 Backtracking For a Package
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Special guest: GUEST_PROFILE Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Ruff PyCharm plugin via John Hagen Ruff PyCharm plugin has great integration, it will highlight Ruff lint errors in the IDE as you type and you can even apply Alt+Enter (⌥⏎ on Mac) quick fixes through the IDE. Ruff will automatically fix the fixable issues. John also added additional PyCharm-specific instructions for black/Ruff Brian #2: Writing Python like it's Rust Kobzol Rust lessons guiding use of types and type hints in Python Add type hints tun function signatures Use dataclasses instead of tuples or dictionaries to increase clarity and type safety Union types to clarify | typing Michael #3: Pip 23.1 Released - Massive improvement to backtracking Pip 23.1 was released last month Highlight the significant improvement in backtracking that is part of the requirement resolver process in Pip. This process involves Pip finding a set of packages that meet your requirements and whose requirements themselves don't conflict. Prior to Pip 20.3, the default process for Pip would allow conflicting requirements to install if they were transitive dependencies where the last one specified would be the one installed. Once the new resolver was turned on by default it immediately hit problems where backtracking would get stuck for a long time. Pip separates out the resolution logic into a library called resolvelib. It had been discovered that there was a logical error under certain circumstances, and also there was a known better backtracking technique it could employ called backjumping. Both of these were recently fixed and implemented in resolvelib, which were then vendored in to Pip 23.1. Brian #4: Markdown Code Runner markdown-code-runner is a Python package that automatically executes code blocks within a Markdown file, including hidden code blocks, and updates the output in-place. Works with Python & Bash see also cog Extras Michael: Python 3.12.0a7 is out python3 -m venv --upgrade-deps venv (via John Hagen) Talk submissions are now open for both remote and in-person talks at the 2023 PyConZA? The conference will be held on 5 and 6 October 2023 in Durban, South Africa. South Africa is GMT+2, so the times are convenient for Africa, Europe and much of Asia, although probably less so for the rest of the world. All details are on za.pycon.org - via Kim van Wik Trail discovery/riding apps onX offroad Gaia Picture of Michael on one of these trails Joke: User Inyerface
#336 We found one of your batteries
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: Python's Missing Batteries: Essential Libraries You're Missing Out On Martin Heinz Fun collection of a bunch of libraries you may not know about (or forgot about), with code examples. Utilities boltons : iterate through json and dates, quickly grab data out of nested structures, and convert nested data with jsonutils, timeutils, and iterutils sh : conveniently call shell funcitons Data Validation validators : validate email addresses, credit cars, IP addresses, and more. the fuzz : fuzzy string comparisons Debugging stackprinter : nice stack traces with exception messages higlighted Testing freezegun : stop time, change dates, … dirty_equals : comparing things that are kinda equal CLI tqdm : add a progress bar to command line apps Michael #2: awesome-polars A curated list of Polars talks, tools, examples & articles. Mostly articles and tutorials however. Brian #3: Running Headless Selenium in Python (2023) Siddiqi First off, if you are doing automated testing with Selenium, I hope you already know about headless. It’s awesome and speeds up testing. Next, there’s changes to how you code headless, as of Selenium 4.8.0 (Jan. 2023). Old: options.headless` `**=**` `True New: options.add_argument('--headless=new') for Chrome options.add_argument('--headless') for Firefox Reasons: Read Headless is Going Away! post on Selenium blog. Subtitle: “Now that we got your attention, headless is not actually going away, just the convenience method to set it in Selenium” Michael #4: Gracy Gracy helps you handle failures, logging, retries, throttling, and tracking for all your HTTP interactions. Has support for Parsing per status code Throttling Retries Custom validation Record/replay for testing A bit non-pythonic but perhaps inspriation for some out there Extras Michael: Mobile apps are finally out Take the git course for free for a limited time. Michael's blog post announcing the apps Joke: It’s practice
#335 Should you get your mojo on?
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Introducing 'Trusted Publishers’ PyPI package maintainers can adopt a new, more secure publishing method that does not require long-lived passwords or API tokens to be shared with external systems. Our term for using the OpenID Connect (OIDC) standard to exchange short-lived identity tokens between a trusted third-party service and PyPI. Instead, PyPI maintainers can configure PyPI to trust an identity provided by a given OpenID Connect Identity Provider (IdP). These API tokens never need to be stored or shared rotate automatically by expiring quickly provide a verifiable link between a published package and its source Additional security hardening is available Brian #2: Mojo : a new programming language for all AI developers. Mojo may be the biggest programming language advance in decades - fast.ai blog Suggested by many listeners “Mojo combines the usability of Python with the performance of C, unlocking unparalleled programmability of AI hardware and extensibility of AI models.” A programming language compatible with Python, with performance similar to C++/Rust. “Mojo is designed to become a superset of Python over time by preserving Python’s dynamic features while adding new primitives for systems programming.” - emphasis from Brian It’s not there yet, but still super cool Built on a MLIR, not LLVM “How compatible is Mojo with Python really? Mojo already supports many core features of Python including async/await, error handling, variadics, etc, but… it is still very early and missing many features - so today it isn’t very compatible. Mojo doesn’t even support classes yet!” Michael #3: django-prose Wonderful rich-text editing for your Django project. Rendering rich-text in templates Small rich-text content (as model fields) Django Prose is using Bleach to only allow certain tags and attributes See the website for a screenshot of it in action Brian #4: pylyzer is a static code analyzer / language server for Python, written in Rust. Shunsuke Shibayama Suggested by Owen Features fast detailed analysis type checking plus things like out-of-bounds accesses to lists, and non-existent key references to dicts more readable reports and a VS Code extension pylyzer vs ruff “Ruff, like pylyzer, is a static code analysis tool for Python written in Rust, but Ruff is a linter and pylyzer is a type checker & language server. pylyzer does not perform linting, and Ruff does not perform type checking.” Some limitations and incomplete “todo list”. See README for more details. Joke: Escape Room
#334 Packaging Organizations
Watch on YouTube About the show Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: rye - Python workflow tool Armin Ronacher Rust built tool, currently only for Linux and MacOS Project workflow commands, like init - new project add - add a dependency (including optional) remove - remove a dependency build - build wheel lock - update lock file virtualenv commands add —dev - install in environment sync - install/update dependencies in env based on pyprojec.toml run - run command within environment Install Python fetch - Fetches a Python interpreter for the local machine Register existing Python toolchain Helper utility to manage Python toolchains Kinda like pipx install - Installs a package as global tool uninstall - Uninstalls a global tool I didn’t see that it added anything to my PATH, so this addition made it work: Bonus Everything lives under ~/.rye So it’s easy to stop using, and doesn’t muck up see also Simon Willison’s A few notes on Rye Python Bytes #332, where we talked about huak Michael #2: PyPI Organizations The first step in our plan to build financial support and long-term sustainability of the Python Packaging Index (PyPI) Small fee for organizations rather than individual users Like Github orgs Brian #3: 5 tips to learn any new Python library faster Bob Belderbos The tiips RTFM - at lest the getting started docs Install it Explore the library - play. Bob recommends Jupyter notebook for this. Apply it to a real world problem - deliberate practice Build something with it (bonus) Teach it - blog, TIL, video tutorial, etc. Michael #4: Python gets down to (the) Metal Extras Brian: frogmouth - Markdown viewer / browser for your terminal, built with Textual. Michael: Was going to talk about Serenade, but seems to have gone silent. Packaging follow up discussion. Joke: It’s the progress that counts
#333 Live From PyCon
Watch on YouTube Sponsored by us! Support our work through: Our courses at Talk Python Training Test & Code Podcast Patreon Supporters Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.orgx Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: Introducing Microsoft Security Copilot Security Copilot combines this advanced large language model (LLM) with a security-specific model from Microsoft. When Security Copilot receives a prompt from a security professional, it uses the full power of the security-specific model to deploy skills and queries that maximize the value of the latest large language model capabilities. Your data and stays within your control. It is not used to train the foundation AI models, and in fact, it is protected by the most comprehensive enterprise compliance and security controls. Brian #2: PEP 695 – Type Parameter Syntax “This PEP specifies an improved syntax for specifying type parameters within a generic class, function, or type alias. It also introduces a new statement for declaring type aliases.” To get a feel for this, jump to the examples One example Here is an example of a generic function today. from typing import TypeVar _T = TypeVar("_T") def func(a: _T, b: _T) -> _T: ... - And the new syntax. def func[T](a: T, b: T) -> T: ... Michael #3: Auto-GPT An experimental open-source attempt to make GPT-4 fully autonomous. This program, driven by GPT-4, chains together LLM "thoughts", to autonomously achieve whatever goal you set. Features 🌐 Internet access for searches and information gathering 💾 Long-term and short-term memory management 🧠 GPT-4 instances for text generation 🔗 Access to popular websites and platforms 🗃️ File storage and summarization with GPT-3.5 Brian #4: Astral : Ruff is now a company Charlie Marsh announces Astral, starting off with a healthy $4m in seed money. Not a bad start Astral will continue building high-performance developer tools for the Python ecosystem — to keep building Ruff, and to build more Ruff-like things. “to make the Python ecosystem more productive by building high-performance developer tools.” Undoubtedly Rust-ifying more of the Python tool chain. Related: In a discussion at PyCon, someone asked me if Ruff was a replacement for Black. My answer, “not really, more of a flake8 replacement and a few other tools, but a partial overlap with Black. Real answer is at the FAQ Is Ruff compatible with Black? Yes. Ruff is compatible with Black out-of-the-box, as long as the line-length setting is consistent between the two. As a project, Ruff is designed to be used alongside Black and, as such, will defer implementing stylistic lint rules that are obviated by autoformatting.” Extras Brian: Registration open for SciPy 2023 Michael: Android Mobile App is out. Please give us feedback Joke: Releasing to prod
#332 A Python, a Slurpee, and Some Chaos
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Brian #1: huak - A Python package manager written in Rust. Inspired by Cargo Suggested by Owen Tons of workflows activate - activate a virtual environment add add a dependency to a project pip install it into your virtual environment, and add it to the dependency list in pyproject.toml test - run pytest update update dependencies lint - run ruff, installing it first if necessary fix - autofix fixable lint conflicts build - build wheel in isolated virtual environment using hatchling Honestly I was considering building my own workflow tool, but this is darned close to what I want. Even though it’s still “in an experimental state”. There are rough edges (ruff edges, get it), but still, way cool. I just don’t know how to pronounce it. Is it like “walk”, or more like “whack”? Michael #2: PSF expresses concerns about a proposed EU law that may make it impossible to continue providing Python and PyPI to the European public After reviewing the proposed Cyber Resilience Act and Product Liability Act, the PSF has found issues that put the mission of our organization and the health of the open-source software community at risk. As currently written, the authors of open-source components might bear legal and financial responsibility for the way their components are applied in someone else’s commercial product. The risk of huge potential costs would make it impossible in practice for us to continue to provide Python and PyPI to the European public. Brian #3: ChaosToolkit Suggested by the maintainer, Sylvain Hellegouarch Declare and store your Chaos Engineering experiments as JSON/YAML files so you can collaborate and orchestrate them as any other piece of code. Extensible through an Open API Can be automated in CI/CD pipeline Michael #4: PEP 711 – PyBI: a standard format for distributing Python Binaries “Like wheels, but instead of a pre-built python package, it’s a pre-built python interpreter” Joke: It’s the effort that counts
#331 Python From the Future
Watch on YouTube About the show Sponsored by InfluxDB from Influxdata. Connect with the hosts Michael: @mkennedy@fosstodon.org Brian: @brianokken@fosstodon.org Show: @pythonbytes@fosstodon.org Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesdays at 11am PT. Older video versions available there too. Michael #1: makeapp via Felix Ingram Simplifies Python application rollout and publishing. Link to its mention on Talk Python. Simplifies Python application rollout and publishing: Make a skeleton for your new application with one console command Automatically create a VCS repository for your application. Automatically check whether the chosen application name is not already in use. Customize new application layouts with skeleton templates. Put some skeleton default settings into a configuration file not to mess with command line switches anymore. Easily add entries to your changelog. Publish your application to remotes (VCS, PyPI) with single command. Brian #2: Looking forward to Python 3.12 We’re on 3.12.0a7 now, the last alpha, final is scheduled for October schedule So far, in 3.12.0a7 What’s new in Python 3.12 page has some examples of the Improved Error Messages Recent addition, PEP 684 - A Per-Interpreter GIL was approved recently “… sufficient isolation would facilitate true multi-core parallelism …” seems like a good thing. But also, “… this is an advanced feature meant for a narrow set of users of the C-API. “, so not really sure how this will affect us. Still, seems cool. Michael #3: Python 3.11.3 is out Fixes a HIGH level CVE in OpenSSL (so patch it) Lots of changes in Core and Builtins Brian #4: How to Make a Great Conference Talk Sebastian Witowski Lots of great advice for tech conf talks. Don’t skip the last half of this, getting your talk accepted is really when the work starts. Good sections to make sure you don’t miss Live demos “First of all - do you really need a demo? …” Rehearsing Don’t skip this. Do this. A lot. Out loud. With a timer. While standing. Memorize the first few minutes, and the last few. Know how you’re going to open and close. Night before get enough sleep Day of eat well. Don’t drink too much liquids. Be comfortable. Sebastian was honest in saying this stuff works for him, but do what works for you. From Brian: I deviate from Sebastian in quite a few places, but still don’t disagree with his advice. I can’t give a talk without slides, as I use them for prompts to know what I’m talking about next. My talks usually have a lot of code snippets. Obviously, that would be difficult without slides. I write my talk and my slides in Markdown. Sebastian writes in something else, then builds slides as visual aids. That’s cool. Do what works for you. Bonus tool from the article: demo-magic - If I’m ever tempted to live code again, I think I’ll try this instead. Extras Michael: NOW the CDN course is out. Django 4.2 released. Joke: Using A.I. for Efficiency