Python Bytes

#444 Begone Python of Yore!


Listen Later

Topics covered in this episode:
  • Coverage.py regex pragmas
  • * Python of Yore*
  • * nox-uv*
  • * A couple Django items*
  • Extras
  • Joke
  • Watch 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: @[email protected] / @mkennedy.codes (bsky)
    • Brian: @[email protected] / @brianokken.bsky.social
    • Show: @[email protected] / @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 Batchelder

      • The 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.*)\\Z
          • Allow start and stop delimiters with # no cover: start(?s:.*?)# no cover: stop
          • Exclude empty placeholder methods with ^\\s*(((async )?def .*?)?\\)(\\s*->.*?)?:\\s*)?\\.\\.\\.\\s*(#|$)
          • See Ned’s article for explanations of these
          • Michael #2: Python of Yore

            • via Matthias
            • Use 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 Hagen
              • What 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 Metz
                  • Resetting migrations is sometimes the right thing.
                  • Overly simplified summary: delete migrations and start over
                  • dj-lite
                    • Adam Hill
                    • Use 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 Cloud
                      • pythontest.com: pytest fixtures nuts and bolts - revisited
                      • Michael:

                        • New course: Just Enough Python for Data Scientists
                        • My live stream about uv is now on YouTube
                        • Cursor CLI: Built to help you ship, right from your terminal.
                        • Joke: Copy/Paste

                          ...more
                          View all episodesView all episodes
                          Download on the App Store

                          Python BytesBy Michael Kennedy and Brian Okken

                          • 4.7
                          • 4.7
                          • 4.7
                          • 4.7
                          • 4.7

                          4.7

                          212 ratings


                          More shows like Python Bytes

                          View all
                          Software Engineering Radio - the podcast for professional software developers by se-radio@computer.org

                          Software Engineering Radio - the podcast for professional software developers

                          271 Listeners

                          The Changelog: Software Development, Open Source by Changelog Media

                          The Changelog: Software Development, Open Source

                          283 Listeners

                          Data Skeptic by Kyle Polich

                          Data Skeptic

                          477 Listeners

                          Talk Python To Me by Michael Kennedy

                          Talk Python To Me

                          584 Listeners

                          Software Engineering Daily by Software Engineering Daily

                          Software Engineering Daily

                          626 Listeners

                          Test & Code by Brian Okken

                          Test & Code

                          70 Listeners

                          Super Data Science: ML & AI Podcast with Jon Krohn by Jon Krohn

                          Super Data Science: ML & AI Podcast with Jon Krohn

                          295 Listeners

                          Data Engineering Podcast by Tobias Macey

                          Data Engineering Podcast

                          141 Listeners

                          Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

                          Syntax - Tasty Web Development Treats

                          987 Listeners

                          CoRecursive: Coding Stories by Adam Gordon Bell - Software Developer

                          CoRecursive: Coding Stories

                          189 Listeners

                          DataFramed by DataCamp

                          DataFramed

                          269 Listeners

                          Practical AI by Practical AI LLC

                          Practical AI

                          189 Listeners

                          The Stack Overflow Podcast by The Stack Overflow Podcast

                          The Stack Overflow Podcast

                          64 Listeners

                          The Real Python Podcast by Real Python

                          The Real Python Podcast

                          141 Listeners

                          Oxide and Friends by Oxide Computer Company

                          Oxide and Friends

                          58 Listeners