Notes on software engineering

Archive / page 15

281–300 of 550 posts, newest first.

  1. 2024
  2. Running jupyterlab via uv tool install

    I tried to get jupyterlab working via today and ran into some sharp edges. You can start like this: That ran for a while and output: It also gave me a warning about my PATH.

    1 min read
  3. Installing different PostgreSQL server versions in GitHub Actions

    The GitHub Actions default runner currently includes an installation of PostgreSQL 13. The server is not running by default but you can interact with it like this: You can install alternative…

    1 min read
  4. Publishing a Web Component to npm

    I tried this for the first time today with my highly experimental datasette-table Web Component. Here's the source code for version 0.1.0.

    2 min read
  5. A simple Python wrapper for the ChatGPT API

    OpenAI released an API for ChatGPT yesterday. It's 1/10th of the price of the model! Their official openai Python package has been upgraded to add support for it (in this commit).

    1 min read
  6. Implementing a "copy to clipboard" button

    I had to figure this out while building datasette-copyable - demo here. The trick is to run to copy to the clipboard - but only after first ensuring that some selectable content (probably in a…

    1 min read
  7. Quickly testing code in a different Python version using pyenv

    I had a bug that was only showing up in CI against Python 3.8. I used the following pattern with pyenv to quickly run the tests against that specific version.

    1 min read
  8. Limited JSON API for Google searches using Programmable Search Engine

    I figured out how to use a JSON API to run a very limited Google search today in a legit, non-screen-scraper way.

    2 min read
  9. Start a server in a subprocess during a pytest session

    I wanted to start an actual server process, run it for the duration of my pytest session and shut it down at the end. Here's the recipe I came up with.

    1 min read
  10. Using async/await in JavaScript in Selenium

    Thanks Stuart Langridge for showing me how to do this:

    1 min read
  11. Using OpenAI functions and their Python library for data extraction

    Here's the pattern I figured out for using the openai Python library to extract structured data from text using a single call to the model.

    2 min read
  12. Using Prettier to check JavaScript code style in GitHub Actions

    I decided to adopt Prettier as the JavaScript code style for Datasette, based on my success with Black for Python code.

    1 min read
  13. Installing packages from Debian unstable in a Docker image based on stable

    For Datasette 1249 I wanted to build a Docker image from the base image ("buster" is the current stable release of Debian) but include a single package from "sid", the unstable Debian distribution.

    1 min read
  14. Redirecting all paths on a Vercel instance

    I wanted to redirect all traffic to to a different domain - preserving the path and the querystring and serving a 301 status code.

    1 min read
  15. Testing different Python versions with uv with-editable and uv-test

    A quick recipe I figured out today, for running the tests for a project against multiple Python versions. The key command option is .

    1 min read
  16. Migrating a GitHub wiki from one repository to another

    I figured out how to migrate a GitHub wiki (public or private) from one repository to another while preserving all history. The trick is that GitHub wikis are just Git repositories.

    1 min read
  17. Processing a stream of chunks of JSON with ijson

    A follow-up to Using OpenAI functions and their Python library for data extraction and Using the ChatGPT streaming API from Python.

    1 min read
  18. Upgrading packages with npm

    There's a new version of Vite out (3.0) and I wanted to upgrade my datasette-table package to use it. I mainly followed the guide on Update all the Node.js dependencies to their latest version to work…

    1 min read
  19. Registering the same Pluggy hook multiple times in a single file

    I found myself wanting to register more than one instance of a Pluggy plugin hook inside a single module. Hooks are usually registered like this: Where matches the name of a registered plugin hook.

    1 min read
  20. Running cog automatically against GitHub pull requests

    I really like Cog (previously) as a tool for automating aspects of my Python project documentation - things like the SQL schemas shown on the LLM logging page.

    1 min read
  21. Safely outputting JSON

    Carelessly including the output of in an HTML page can lead to an XSS hole, thanks to the following: Jinja has a function that avoids this in - the (simplified) implementation looks like this: Which…

    1 min read