Simon Willison

Results 1833 comments of Simon Willison

I'm going to try this out on `datasette-publish-vercel` first.

I really like this in `datasette-publish-vercel` - I'm definitely going to bring this to the other publish implementations as well.

`datasette package` is a mostly unmaintained feature at this point - it has a bit of test coverage but I've not made any improvements to it in a few years,...

Some options: - Allow `favicon` path to be set in `metadata.yml` somehow, or via a `--setting` - Teach Datasette to check for `templates/favicon.ico` and fall back to the default `static/favicon.png`...

I think I want this to be a default feature, not a plugin.

Loading it using the existing templating system would be better I think, since that way both custom installations AND plugins could influence the favicon in the same way that they...

The content type thing is a bit weird because usually I'd base that on the file extension, but here the `favicon.ico` file extension doesn't necessarily reflect if the image itself...

Annoyingly it looks like the standard library `mimetypes` module only uses filenames as the clue, it doesn't look at the bytes themselves. I'm using that here: https://github.com/simonw/datasette/blob/9f1eb0d4eac483b953392157bd9fd6cc4df37de7/datasette/utils/asgi.py#L261-L277 https://pypi.org/project/python-magic/ can inspect...

I could use the `imghdr` standard library module, but frustratingly it's marked as deprecated in Python 3.11! https://docs.python.org/3/library/imghdr.html

I could vendor the necessary parts of `imghdr` - it's pretty tiny: https://github.com/python/cpython/blob/3.11/Lib/imghdr.py