Notes on software engineering

Archive / page 27

521–540 of 550 posts, newest first.

  1. 2023
  2. Running Python code in a subprocess with a time limit

    I figured out how to run a subprocess with a time limit for datasette-ripgrep, using the method. The pattern looks like this: For datasette-seaborn I wanted to render a chart using the Python seaborn…

    1 min read
  3. Allowing a container in Docker Desktop for Mac to talk to a PostgreSQL server on the host machine

    I like using Postgres.app to run PostgreSQL on my macOS laptop. I use it for a bunch of different projects.

    1 min read
  4. Find local variables in the traceback for an exception

    For sqlite-utils issue 309 I had an error that looked like this: And I wanted to display the values of the and variables as part of a custom error message.

    1 min read
  5. git bisect

    I fixed two bugs in Datasette using - a tool which lets you run an automated binary search against a commit log to find the source of a bug.

    1 min read
  6. Tracking SQLite table history using a JSON audit log

    Today I decided to try a slightly different approach, using JSON to store changes to a table in an audit log.

    3 min read
  7. Very basic tsc usage

    I guess I have to learn TypeScript now. Here's how I got started in as few steps as possible, with the help of Get Started With Typescript in 2019 by Robert Cooper.

    2 min read
  8. Defining setup.py dependencies using a URL

    For sqlite-utils issue 464 I implemented a fix to a tiny bug in a dependency in my own fork on GitHub.

    1 min read
  9. Decorators with optional arguments

    sqlite-utils provides a decorator for registering custom Python functions that looks like this: I wanted to add an optional deterministic=True parameter to the decorator.

    1 min read
  10. Ordered group_concat() in SQLite

    I was trying to use to glue together some column values into a stiched together Markdown document. My first attempt looked like this: This attempt didn't work, because the order of the elements…

    1 min read
  11. Dump out all GitHub Actions context

    Useful for seeing what's available for conditions (see context and expression syntax). I copied this example action from here and deployed it here. Here's an example run.

    1 min read
  12. Building a specific version of SQLite with pysqlite on macOS/Linux

    I wanted the ability to test my Python software against specific version of SQLite on macOS. I found a way to do that using pysqlite3.

    1 min read
  13. Querying newline-delimited JSON logs using AWS Athena

    I've been writing my Fly logs to S3 in newline-delimited JSON format using the recipe described in Writing Fly logs to S3. I recently needed to run a search against those logs.

    2 min read
  14. Set environment variables for all steps in a GitHub Action

    From this example I learned that you can set environment variables such that they will be available in ALL jobs once at the top of a workflow: I had previously been using this much more verbose…

    1 min read
  15. Using uv to develop Python command-line applications

    I finally figured out a process that works for me for hacking on Python CLI utilities using uv to manage my development environment, thanks to a little bit of help from Charlie Marsh.

    3 min read
  16. A tip for debugging pytest-httpx

    I use pytest-httpx in a bunch of my projects. Occasionally I run into test failures like this one, which can sometimes be really hard to figure out: Today I figured out a pattern for investigating…

    1 min read
  17. Using pytest and Playwright to test a JavaScript web application

    I wrote the tests using playwright-pytest, which lets you write tests in Python using Microsoft's Playwright browser automation library.

    2 min read
  18. A simple Python implementation of the ReAct pattern for LLMs

    A popular nightmare scenario for AI is giving it access to tools, so it can make API calls and execute its own code and generally break free of the constraints of its initial environment.

    1 min read
  19. Comparing two training datasets using sqlite-utils

    WizardLM is "an Instruction-following LLM Using Evol-Instruct". It's a fine-tuned model on top of Meta's LLaMA.

    3 min read
  20. Preventing double form submissions with JavaScript

    I needed this for VIAL issue 722. I decided to disable form submissions for two seconds after they are submitted, to protect against accidental double submissions without risk of unexpected issues…

    1 min read
  21. Writing tests for the ASGI lifespan protocol with HTTPX

    Uvicorn silently ignores exceptions that occur during startup against the ASGI lifespan protocol - see starlette/issues/486.

    1 min read