From a25c656e833f45c619203cd57262edc88a218578 Mon Sep 17 00:00:00 2001 From: Ankita-Advitot Date: Mon, 5 Oct 2026 12:59:05 +0530 Subject: [PATCH] Add --pre, --force-reinstall, and --no-cache-dir options to datasette install, refs #2483 --- datasette/cli.py | 23 ++++++++++++++++++++++- docs/changelog.rst | 1 + docs/cli-reference.rst | 4 ++++ tests/test_cli.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/datasette/cli.py b/datasette/cli.py index e83de93a..9d34ad66 100644 --- a/datasette/cli.py +++ b/datasette/cli.py @@ -326,13 +326,34 @@ def package( "--editable", help="Install a project in editable mode from this path", ) -def install(packages, upgrade, requirement, editable): +@click.option( + "--pre", is_flag=True, help="Include pre-release and development versions" +) +@click.option( + "--force-reinstall", + is_flag=True, + help="Reinstall all packages even if they are already up-to-date", +) +@click.option( + "--no-cache-dir", + is_flag=True, + help="Disable the cache", +) +def install( + packages, upgrade, requirement, editable, pre, force_reinstall, no_cache_dir +): """Install plugins and packages from PyPI into the same environment as Datasette""" if not packages and not requirement and not editable: raise click.UsageError("Please specify at least one package to install") args = ["pip", "install"] if upgrade: args += ["--upgrade"] + if pre: + args += ["--pre"] + if force_reinstall: + args += ["--force-reinstall"] + if no_cache_dir: + args += ["--no-cache-dir"] if editable: args += ["--editable", editable] if requirement: diff --git a/docs/changelog.rst b/docs/changelog.rst index 2775cbc5..5ea3335d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,7 @@ To collect telemetry, configure an OpenTelemetry SDK and exporter, then run Data Other features ~~~~~~~~~~~~~~ +- New ``--pre``, ``--force-reinstall``, and ``--no-cache-dir`` options for ``datasette install``. (:issue:`2483`) - New :ref:`DatasetteModal JavaScript API ` for plugins to create dialogs with Datasette's shared styles, keyboard behavior and focus handling. Datasette's built-in dialogs use the same API. (:issue:`2790`, :pr:`2948`) Bug fixes diff --git a/docs/cli-reference.rst b/docs/cli-reference.rst index db903e8e..2a6396d0 100644 --- a/docs/cli-reference.rst +++ b/docs/cli-reference.rst @@ -385,6 +385,10 @@ Would install the `datasette-cluster-map