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.

#337 Backtracking For a Package

May 23, 2023 00:32:18 31.26 MB Downloads: 0
Watch on YouTube

About the show

Sponsored by us! Support our work through:

Connect with the hosts

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

Joke: User Inyerface