Python Bytes Podcast Por Michael Kennedy and Brian Okken capa

Python Bytes

Python Bytes

De: Michael Kennedy and Brian Okken
Ouça grátis

Sobre este áudio

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.Copyright 2016-2025 Política e Governo
Episódios
  • #445 Auto-activate Python virtual environments for any project
    Aug 18 2025
    Topics covered in this episode: pyx - optimized backend for uv* Litestar is worth a look** Django remake migrations** django-chronos*ExtrasJokeWatch on YouTube About the show Python Bytes 445 Sponsored by Sentry: pythonbytes.fm/sentry - Python Error and Performance Monitoring Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: pyx - optimized backend for uv via John Hagen (thanks again)I’ll be interviewing Charlie in 9 days on Talk Python → Sign up (get notified) of the livestream here.Not a PyPI replacement, more of a middleware layer to make it better, faster, stronger.pyx is a paid service, with maybe a free option eventually. Brian #2: Litestar is worth a look James BennettMichael brought up Litestar in episode 444 when talking about rewriting TalkPython in QuartJames brings up scaling - Litestar is easy to split an app into multiple filesNot using pydantic - You can use pydantic with Litestar, but you don’t have to. Maybe attrs is right for you instead.Michael brought up Litestar seems like a “more batteries included” option.Somewhere between FastAPI and Django. Brian #3: Django remake migrations Suggested by Bruno Alla on BlueSkyIn response to a migrations topic last weekdjango-remake-migrations is a tool to help you with migrations and the docs do a great job of describing the problem way better than I did last week“The built-in squashmigrations command is great, but it only work on a single app at a time, which means that you need to run it for each app in your project. On a project with enough cross-apps dependencies, it can be tricky to run.”“This command aims at solving this problem, by recreating all the migration files in the whole project, from scratch, and mark them as applied by using the replaces attribute.”Also of note The package was created with CopierMichael brought up Copier in 2021 in episode 219It has a nice comparison table with CookieCutter and YoemanOne difference from CookieCutter is yml vs json.I’m actually not a huge fan of handwriting either. But I guess I’d rather hand write yml.So I’m thinking of trying Copier with my future project template needs. Michael #4: django-chronos Django middleware that shows you how fast your pages load, right in your browser.Displays request timing and query counts for your views and middleware.Times middleware, view, and total per request (CPU and DB). Extras Brian: Test & Code 238: So Long, and Thanks for All the Fish after 10 years, this is the goodbye episode Michael: Auto-activate Python virtual environment for any project with a venv directory in your shell (macOS/Linux): See gist.Python 3.13.6 is out.Open weight OpenAI modelsJust Enough Python for Data Scientists CourseThe State of Python 2025 article by Michael Joke: python is better than java
    Exibir mais Exibir menos
    30 minutos
  • #444 Begone Python of Yore!
    Aug 11 2025
    Topics covered in this episode: Coverage.py regex pragmas* Python of Yore** nox-uv** A couple Django items*ExtrasJokeWatch on YouTube About the show Sponsored by DigitalOcean: pythonbytes.fm/digitalocean-gen-ai Use code DO4BYTES and get $200 in free credit Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Brian #1: Coverage.py regex pragmas Ned BatchelderThe regex implementation of how coverage.py recognizes pragmas is pretty amazing.It’s extensible through plugins covdefaults adds a bunch of default exclusions, and also platform- and version-specific comment syntaxes.coverage-conditional-plugin gives you a way to create comment syntaxes for entire files, for whether other packages are installed, and so on.A change from last year (as part of coverage.py 7.6 allows multiline regexes, which let’s us do things like: Exclude an entire file with \\A(?s:.*# pragma: exclude file.*)\\ZAllow start and stop delimiters with # no cover: start(?s:.*?)# no cover: stopExclude empty placeholder methods with ^\\s*(((async )?def .*?)?\\)(\\s*->.*?)?:\\s*)?\\.\\.\\.\\s*(#|$)See Ned’s article for explanations of these Michael #2: Python of Yore via MatthiasUse YORE: ... comments to highlight CPython version dependencies. # YORE: EOL 3.8: Replace block with line 4. if sys.version_info < (3, 9): from astunparse import unparse else: from ast import unparse Then check when they go out of support: $ yore check --eol-within '5 months' ./src/griffe/agents/nodes/_values.py:11: Python 3.8 will reach its End of Life within approx. 4 months Even fix them with fix . Michael #3: nox-uv via John HagenWhat nox-uv does is make it very simple to install uv extras and/or dependency groups into a nox session's virtual environment.The versions installed are constrained by uv's lockfile meaning that everything is deterministic and pinned.Dependency groups make it very easy to install only want is necessary for a session (e.g., only linting dependencies like Ruff, or main dependencies + mypy for type checking). Brian #4: A couple Django items Stop Using Django's squashmigrations: There's a Better Way Johnny MetzResetting migrations is sometimes the right thing.Overly simplified summary: delete migrations and start overdj-lite Adam HillUse SQLite in production with Django“Simplify deploying and maintaining production Django websites by using SQLite in production. dj-lite helps enable the best performance for SQLite for small to medium-sized projects. It requires Django 5.1+.” Extras Brian: Test & Code 237 with Sebastian Ramirez on FastAPI Cloudpythontest.com: pytest fixtures nuts and bolts - revisited Michael: New course: Just Enough Python for Data ScientistsMy live stream about uv is now on YouTubeCursor CLI: Built to help you ship, right from your terminal. Joke: Copy/Paste
    Exibir mais Exibir menos
    26 minutos
  • #443 Patching Multiprocessing
    Aug 4 2025
    Topics covered in this episode: rumdl - A Markdown Linter written in Rust* Coverage 7.10.0: patch** aioboto3** You might not need a Python class*ExtrasJokeWatch on YouTube About the show Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky)Brian: @brianokken@fosstodon.org / @brianokken.bsky.socialShow: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: rumdl - A Markdown Linter written in Rust via Owen LamontSupports toml file config settingsInstall via uv tool install rumdl.⚡️ Built for speed with Rust - significantly faster than alternatives🔍 54 lint rules covering common Markdown issues🛠️ Automatic fixing with -fix for most rules📦 Zero dependencies - single binary with no runtime requirements🔧 Highly configurable with TOML-based config files🌐 Multiple installation options - Rust, Python, standalone binaries🐍 Installable via pip for Python users📏 Modern CLI with detailed error reporting🔄 CI/CD friendly with non-zero exit code on errors Brian #2: Coverage 7.10.0: patch Ned BatchelderActually up to 7.10.2 as of todaypatch allows coverage to run better when a covered project uses subprocessesos._exit()execv family of functionsLooking at subprocess “Coverage works great when you start your program with coverage measurement, but has long had the problem of how to also measure the coverage of sub-processes that your program created. The existing solution had been a complicated two-step process of creating obscure .pth files and setting environment variables. Whole projects appeared on PyPI to handle this for you.”From release notes for 7.10.0 A new configuration option: “[run] patch” specifies named patches to work around some limitations in coverage measurement. These patches are available: patch = _exit lets coverage save its data even when os._exit() is used to abruptly end the process. This closes long-standing issue 310 as well as its duplicates: issue 312, issue 1673, issue 1845, and issue 1941.patch = subprocess measures coverage in Python subprocesses created with subprocess, os.system(), or one of the execv or spawnv family of functions. Closes old issue 367 and duplicate issue 378.patch = execv adjusts the execv family of functions to save coverage data before ending the current program and starting the next. Not available on Windows. Closes issue 43 after 15 years! Michael #3: aioboto3 via Pat DeckerWrapper to use boto3 resources with the aiobotocore async backendaiobotocore allows you to use near enough all of the boto3 client commands in an async manner just by prefixing the command with await.With aioboto3 you can now use the higher level APIs provided by boto3 in an asynchronous manner. Brian #4: You might not need a Python class Adam GrantThis is an important periodic reminder to everyone coming into Python from other languages. Many other languages lean on classes a lot more than we need to in PythonAdams suggestions Simple Data Containers: Use Named Tuples or Data ClassesStateless Utility Functions: Just Use FunctionsGrouping Constants: Use ModulesManaging State with Simple Structures: Use Dictionaries or ListsSimple One-off Operations: Use Lambdas or Comprehensions I’ll add “just use functions”Avoiding Complexity: Built-in LibrariesWhen You Actually Need a Class I’ll add You probably don’tIf you think you do, ask a friend. Friends don’t let friends create extraneous classes in Python.If you think your case is an exception, it probably isn’tIf you think dataclasses aren’t right for you, check out attrs Extras Brian: PyPI Incident Report: Phishing Attack -Sent in by listener John HagenBoth of Adam Johnson’s recent-ish interviews are now up on Test & Code 236: Git Tips for Testing - Adam Johnson235: pytest-django - Adam Johnson Michael: Dive into uv webcast with me and Will Vincent Joke: Default text editor
    Exibir mais Exibir menos
    26 minutos
Ainda não há avaliações