Auto-Completing Click Commands

Click is a python library for creating command line applications in Python. The llm tool created by Simon uses click and it has a lot of subcommands. eg: $ llm keys set openai Enter key: ... $ llm models default gpt-4o I am building a wrapper around this CLI tool that let’s me use it in an interactive REPL. I wanted autocompletion to help me remind the available subcommands and their appropriate nested subcommands....

January 4, 2025 · 3 min

Restart a Python CLI

A simple snippet to restart a Python CLI from within the CLI. import os import sys import click @click.command() def cli(): click.echo("CLI is running.") # Logic that determines when to restart if click.confirm("Do you want to restart the CLI?"): click.echo("Restarting CLI...") executable = sys.executable args = sys.argv os.execv(executable, [executable] + args) else: click.echo("Exiting CLI.") if __name__ == '__main__': cli() os.execv is the system call that can replace the current process with a new one....

January 4, 2025 · 1 min

Python at Netflix

Zoran and I were guests on the Talk Python Podcast to discuss how Python is used at Netflix. The host of the podcast Michael Kennedy was well prepared with the background context and led the conversation in interesting ways. We got to cover a ton of different use cases at Netflix that use Python. I got to talk about some of my favorite OSS projects (bpython, pdb++, dbcli etc). We ran out of time before we could talk about pickley but we did mention it during the episode....

June 30, 2023 · 1 min

Vector Search

Recently I learned about a new kind of search called Vector Search or Semantic Search. This is a search technique that tries to find documents that match the meaning of the user’s search term instead of trying to match keywords like a Full Text Search (FTS). I wanted to try Semantic Search for my blog. I came across Alex Garcia’s post about a new SQLite extension for Vector Search called sqlite-vss....

June 1, 2023 · 6 min

Search (FTS)

Now that my blog is statically generated I need a way to support searching. Fuse.js ships with the theme and does a pretty good job of matching words in the blog posts. I want something a little bit more powerful. I mentioned in my previous post that I am using SQLite to store the blog posts. SQLite has a full text search feature that I can use to implement search....

May 30, 2023 · 2 min