Python Bytes

#447 Going down a rat hole


Listen Later

Topics covered in this episode:
  • rathole
  • pre-commit: install with uv
  • A good example of what functools.Placeholder from Python 3.14 allows
  • Converted 160 old blog posts with AI
  • 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.

      Michael #1: rathole

      • A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
      • Features
        • High Performance Much higher throughput can be achieved than frp, and more stable when handling a large volume of connections.
        • Low Resource Consumption Consumes much fewer memory than similar tools. See Benchmark. The binary can be as small as ~500KiB to fit the constraints of devices, like embedded devices as routers.
          • On my server, it’s currently using about 2.7MB in Docker (wow!)
          • Security Tokens of services are mandatory and service-wise. The server and clients are responsible for their own configs. With the optional Noise Protocol, encryption can be configured at ease. No need to create a self-signed certificate! TLS is also supported.
          • Hot Reload Services can be added or removed dynamically by hot-reloading the configuration file. HTTP API is WIP.
          • Brian #2: pre-commit: install with uv

            • Adam Johnson
            • pre-commit doesn’t natively support uv, but you can get around that with pre-commit-uv
            • $ uv tool install pre-commit --with pre-commit-uv
            • Installing pre-commit like this
              • Installs it globally
              • Installs with uv
              • adds an extra plugin “pre-commit-uv” to pre-commit, so that any Python based tool installed via pre-commit also uses uv
              • Very cool. Nice speedup
              • Brian #3: A good example of what functools.Placeholder from Python 3.14 allows

                • Rodrigo Girão Serrão
                • Remove punctuation functionally
                • Also How to use functools.Placeholder, a blog post about it.
                • functools.partial is cool way to create a new function that partially binds some parameters to another function.
                • It doesn’t always work for functions that take positional arguments.
                • functools.Placeholder fixes that with the ability to put in placeholders for spots where you want to be able to pass that in from the outer partial binding.
                • And all of this sounds totally obscure without a good example, so thank you to Rodgrigo for coming up with the punctuation removal example (and writeup)
                • Michael #4: Converted 160 old blog posts with AI

                  • They were held-hostage at wordpress.com to markdown and integrated them into my Hugo site at mkennedy.codes

                  • Here is the chat conversation with Claude Opus/Sonnet.

                    • Had to juggle this a bit because the RSS feed only held the last 50. So we had to go back in and web scrape. That resulted in oddies like comments on wordpress that had to be cleaned etc.
                    • Whole process took 3-4 hours from idea to “production”duction”.
                    • The chat transcript is just the first round getting the RSS → Hugo done. The fixes occurred in other chats.
                    • This article is timely and noteworthy: Blogging service TypePad is shutting down and taking all blog content with it

                    • This highlights why your domain name needs to be legit, not just tied to the host. I’m looking at you pyfound.blogspot.com. I just redirected blog.michaelckennedy.net to mkennedy.codes

                    • Carefully mapping old posts to a new archived area using NGINX config. This is just the HTTP portion, but note the /sitemap.xml and location ~ "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.+?)/?$" { portions. The latter maps posts such as https://blog.michaelckennedy.net/2018/01/08/a-bunch-of-online-python-courses/ to https://mkennedy.codes/posts/r/a-bunch-of-online-python-courses/

                    • server {
                      listen 80;
                      server_name blog.michaelckennedy.net;
                      # Redirect sitemap.xml to new domain
                      location = /sitemap.xml {
                      return 301 ;
                      }
                      # Handle blog post redirects for HTTP -> HTTPS with URL transformation
                      # Pattern: /YYYY/MM/DD/post-slug/ ->
                      location ~ "^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.+?)/?$" {
                      return 301 $4/>;
                      }
                      # Redirect all other HTTP URLs to mkennedy.codes homepage
                      location / {
                      return 301 ;
                      }
                      }

                      Extras

                      Brian:

                      • SMS URLs and Draft SMS and iMessage from any computer keyboard from Seth Larson
                      • Test and Code Archive is now up, see announcement
                      • Michael:

                        • Python: The Documentary | An origin story is out!
                        • Joke: Do you know him? He is me.

                          ...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 by se-radio@computer.org

                          Software Engineering Radio

                          273 Listeners

                          The Changelog: Software Development, Open Source by Changelog Media

                          The Changelog: Software Development, Open Source

                          290 Listeners

                          Software Engineering Daily by Software Engineering Daily

                          Software Engineering Daily

                          624 Listeners

                          Talk Python To Me by Michael Kennedy

                          Talk Python To Me

                          587 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

                          303 Listeners

                          Data Engineering Podcast by Tobias Macey

                          Data Engineering Podcast

                          145 Listeners

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

                          Syntax - Tasty Web Development Treats

                          984 Listeners

                          CoRecursive: Coding Stories by Adam Gordon Bell - Software Developer

                          CoRecursive: Coding Stories

                          189 Listeners

                          DataFramed by DataCamp

                          DataFramed

                          268 Listeners

                          Practical AI by Practical AI LLC

                          Practical AI

                          213 Listeners

                          The Stack Overflow Podcast by The Stack Overflow Podcast

                          The Stack Overflow Podcast

                          62 Listeners

                          The Real Python Podcast by Real Python

                          The Real Python Podcast

                          141 Listeners

                          Oxide and Friends by Oxide Computer Company

                          Oxide and Friends

                          59 Listeners

                          The Pragmatic Engineer by Gergely Orosz

                          The Pragmatic Engineer

                          64 Listeners