Find all currently running Datasette instances on your machine and list their ports, databases, versions and plugins.
Install this as a plugin in the same environment as Datasette.
datasette install datasette-portsOr run it directly using uvx:
uvx datasette-portsOr install it as a standalone tool:
uv tool install datasette-ports
datasette-portsIf installed as a Datasette plugin:
datasette portsOr as a standalone command:
datasette-portsThis uses lsof to find all Python processes listening on TCP ports, then probes each one to check if it is a Datasette instance. For each instance found it displays the URL, Datasette version, process ID, attached databases and installed plugins.
Example output:
http://127.0.0.1:8007/ - v1.0a26 - PID: 42373
Directory: /Users/simon/dev/blog
Databases:
simonwillisonblog: /Users/simon/dev/blog/simonwillisonblog.db
Plugins:
datasette-llm
datasette-secrets
http://127.0.0.1:8001/ - v1.0a26 - PID: 42374
Directory: /Users/simon/dev/creatures
Databases:
creatures: /tmp/creatures.db
Plugins:
datasette-extract
datasette-llm
datasette-secrets
http://127.0.0.1:8900/ - v0.65.2 - PID: 12345
Databases:
logs: /Users/simon/Library/Application Support/io.datasette.llm/logs.db
http://0.0.0.0:8014/ - v1.0a26 - PID: 42375
Directory: /Users/simon/dev/datasette
Databases:
content: /Users/simon/dev/datasette/content.db
trees: /Users/simon/dev/datasette/trees.db
_internal
Plugins:
datasette-llm
datasette-visible-internal-db
Database paths come from each instance's /-/databases.json endpoint. Where the process working directory can be determined (via /proc/<pid>/cwd on Linux or lsof on macOS), relative paths are resolved to absolute ones. On platforms where the working directory cannot be determined the Directory: line is omitted and paths are shown as reported by Datasette.
Use --json to get machine-readable output:
datasette ports --json
# or
datasette-ports --json[
{
"url": "http://127.0.0.1:8007/",
"host": "127.0.0.1",
"port": 8007,
"pid": 42373,
"cwd": "/Users/simon/dev/blog",
"version": "1.0a26",
"databases": [
{"name": "simonwillisonblog", "path": "/Users/simon/dev/blog/simonwillisonblog.db"}
],
"plugins": [
"datasette-llm",
"datasette-secrets"
]
},
{
"url": "http://127.0.0.1:8900/",
"host": "127.0.0.1",
"port": 8900,
"pid": 12345,
"cwd": null,
"version": "0.65.2",
"databases": [
{"name": "logs", "path": "/Users/simon/Library/Application Support/io.datasette.llm/logs.db"}
],
"plugins": []
}
]To set up this project locally, first checkout the code. You can confirm it is available like this:
cd datasette-ports
uv run datasette-ports --help
# Or:
uv run datasette ports --helpTo run the tests:
uv run pytest