Simon Willison's Weblog
0 FOLLOWERS
Simon Willison is a British technologist and open-source advocate who runs Simon Willison's Weblog. The blog covers a wide range of topics related to software development, data engineering, and open data. Simon writes about his experiences working with web technologies, databases, and programming languages, and shares his insights on best practices, emerging trends, and industry news. He..
Simon Willison's Weblog
17h ago
There is a young humpback whale in the harbor at Pillar Point, just north of Half Moon Bay, California right now. Their name is Teresa T and they were first spotted on Thursday afternoon.
I caught this video of the whale at at 8:30am Friday morning.
Earlier today (Saturday afternoon) I went back for some photos.
I caught Teresa hanging out with this pelican:
And being watched by this harbor seal:
Teresa is still cruising around the harbor now, on Saturday evening. We're all hoping they'll head out to the ocean again soon - they appear to be in good health, and the relevant authorities are ..read more
Simon Willison's Weblog
2d ago
json-flatten, now with format documentation
json-flatten is a fun little Python library I put together a few years ago for converting JSON data into a flat key-value format, suitable for inclusion in an HTML form or query string. It lets you take a structure like this one:
{"foo": {"bar": [1, True, None]}
And convert it into key-value pairs like this:
foo.bar.[0]$int=1
foo.bar.[1]$bool=True
foo.bar.[2]$none=None
The flatten(dictionary) function function converts to that format, and unflatten(dictionary) converts back again.
I was considering the library for a project today and realized tha ..read more
Simon Willison's Weblog
2d ago
Docker images using uv's python
Michael Kennedy interviewed uv/Ruff lead Charlie Marsh on his Talk Python podcast, and was inspired to try uv with Talk Python's own infrastructure, a single 8 CPU server running 17 Docker containers (status page here).
The key line they're now using is this:
RUN uv venv --python 3.12.5 /venv
Which downloads the uv selected standalone Python binary for Python 3.12.5 and creates a virtual environment for it at /venv all in one go.
Via @mkennedy
Tags: docker, uv, python, charlie-marsh ..read more
Simon Willison's Weblog
2d ago
Datasette 1.0a16
This latest release focuses mainly on performance, as discussed here in Optimizing Datasette a couple of weeks ago.
It also includes some minor CSS changes that could affect plugins, and hence need to be included before the final 1.0 release. Those are outlined in detail in issues #2415 and #2420.
Tags: projects, datasette ..read more
Simon Willison's Weblog
2d ago
New improved commit messages for scrape-hacker-news-by-domain
My simonw/scrape-hacker-news-by-domain repo has a very specific purpose. Once an hour it scrapes the Hacker News /from?site=simonwillison.net page (and the equivalent for datasette.io) using my shot-scraper tool and stashes the parsed links, scores and comment counts in JSON files in that repo.
It does this mainly so I can subscribe to GitHub's Atom feed of the commit log - visit simonw/scrape-hacker-news-by-domain/commits/main and add .atom to the URL to get that.
NetNewsWire will inform me within about an hour if any of my content ..read more
Simon Willison's Weblog
3d ago
I've been having a bunch of fun taking advantage of CORS-enabled LLM APIs to build client-side JavaScript applications that access LLMs directly. I also span up a new Datasette plugin for advanced permission management.
LLMs from client-side JavaScript
Converting PDFs to HTML and Markdown
Adding some class to Datasette forms
On the blog
Releases
TILs
LLMs from client-side JavaScript
Anthropic recently added CORS support to their Claude APIs. It's a little hard to use - you have to add anthropic-dangerous-direct-browser-access: true to your request headers to enable it - but once you know the ..read more
Simon Willison's Weblog
5d ago
history | tail -n 2000 | llm -s "Write aliases for my zshrc based on my terminal history. Only do this for most common features. Don't use any specific files or directories."
— anjor
Tags: llm, llms, ai, generative-ai ..read more
Simon Willison's Weblog
6d ago
Python Developers Survey 2023 Results
The seventh annual Python survey is out. Here are the things that caught my eye or found surprising:
25% of survey respondents had been programming in Python for less than a year, and 33% had less than a year of professional experience.
37% of Python developers reported contributing to open-source projects last year - a new question for the survey. This is delightfully high!
6% of users are still using Python 2. The survey notes:
Almost half of Python 2 holdouts are under 21 years old and a third are students. Perhaps courses are still using Python 2?
In ..read more
Simon Willison's Weblog
6d ago
Why I Still Use Python Virtual Environments in Docker
Hynek Schlawack argues for using virtual environments even when running Python applications in a Docker container. This argument was most convincing to me:
I'm responsible for dozens of services, so I appreciate the consistency of knowing that everything I'm deploying is in /app, and if it's a Python application, I know it's a virtual environment, and if I run /app/bin/python, I get the virtual environment's Python with my application ready to be imported and run.
Also:
It’s good to use the same tools and primitives in development and in ..read more
Simon Willison's Weblog
6d ago
Anatomy of a Textual User Interface
Will McGugan used Textual and my LLM Python library to build a delightful TUI for talking to a simulation of Mother, the AI from the Aliens movies:
The entire implementation is just 77 lines of code. It includes PEP 723 inline dependency information:
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "llm",
# "textual",
# ]
# ///
Which means you can run it in a dedicated environment with the correct dependencies installed using uv run like this:
wget 'https://gist.githubusercontent.com/willmcgugan/648a537c9d47dafa59cb8ece281d8c2c ..read more