Skip to main content

Find all currently running Datasette instances and list their ports

Project description

datasette-ports

PyPI Changelog Tests License

Find all currently running Datasette instances on your machine and list their ports, databases, versions and plugins.

Installation

Install this as a plugin in the same environment as Datasette.

datasette install datasette-ports

Or run it directly using uvx:

uvx datasette-ports

Or install it as a standalone tool:

uv tool install datasette-ports
datasette-ports

Usage

If installed as a Datasette plugin:

datasette ports

Or as a standalone command:

datasette-ports

This 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, attached databases and installed plugins.

Example output:

http://127.0.0.1:8007/ - v1.0a26
  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
  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
  Databases:
    logs: /Users/simon/Library/Application Support/io.datasette.llm/logs.db
http://0.0.0.0:8014/ - v1.0a26
  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.

JSON output

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": []
  }
]

Development

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 --help

To run the tests:

uv run pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datasette_ports-0.3.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datasette_ports-0.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file datasette_ports-0.3.tar.gz.

File metadata

  • Download URL: datasette_ports-0.3.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datasette_ports-0.3.tar.gz
Algorithm Hash digest
SHA256 05a59fa1a8c4fb0ec6f86d0b4845980bff64baaa3f4835bd3adbe75a94c0a05e
MD5 2d7cf67b55300911c956adcb65097825
BLAKE2b-256 5d47946a11d33cb1afbebfc0e921f6b3bf9d531be486d124beefd8bfd97f3db5

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_ports-0.3.tar.gz:

Publisher: publish.yml on datasette/datasette-ports

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datasette_ports-0.3-py3-none-any.whl.

File metadata

  • Download URL: datasette_ports-0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datasette_ports-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25fd64d8e27b7c921b6b9b4e8ac861cfaf8a914214de73cd4f414fb86ae9cc7e
MD5 6a224e48bbedfa81d2016db855bec9d1
BLAKE2b-256 8125f4e68639834aac7f8f7e2587e4bac5ed3fc9fa4dde35bc5d42074eaabbb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for datasette_ports-0.3-py3-none-any.whl:

Publisher: publish.yml on datasette/datasette-ports

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page