Skip to content

Bulk asynchronous downloader for multiple file hosts

refactor: replace inquirer with questionary

NTFSvolume27bca22368c8
diff --git a/cyberdrop_dl/prompts.py b/cyberdrop_dl/prompts.py
index 96682a5d4..8c21677b6 100644
--- a/cyberdrop_dl/prompts.py
+++ b/cyberdrop_dl/prompts.py
@@ -3,11 +3,9 @@ from __future__ import annotations
import os
import sys
from pathlib import Path
-from typing import TYPE_CHECKING, Any
+from typing import TYPE_CHECKING
-import inquirer
-import inquirer.questions
-from inquirer.themes import BlueComposure
+import questionary
from rich.console import Console
from rich.text import Text
@@ -15,6 +13,18 @@ if TYPE_CHECKING:
from collections.abc import Callable, Iterable
+_PROMP_STYLE = questionary.Style(
+ [
+ ("qmark", "fg:#FF9D00 bold"),
+ ("question", "bold"),
+ ("pointer", "fg:#2196f3 bold"),
+ ("highlighted", "fg:#2196f3 "),
+ ("selected", "fg:#cc5454"),
+ ("disabled", "fg:#858585 italic"),
+ ("answer", "fg:#2196f3 bold"),
+ ]
+)
+
_ERROR = Text("ERROR: ", style="bold red")
_WARNING = Text("WARNING:", style="bold yellow")
@@ -38,8 +48,8 @@ class _ConsoleWrapper:
def line(self, count: int = 1) -> None:
self.console.line(count)
- def input(self, msg: str = "") -> None:
- self.console.input(msg)
+ def input(self, msg: str = "") -> str:
+ return self.console.input(msg)
def clear(self) -> None:
_ = os.system("cls" if os.name == "nt" else "clear") # noqa: S605
@@ -55,26 +65,22 @@ def enter_to_continue() -> None:
console.input("Press <ENTER> to continue")
-def ask(question: inquirer.questions.Question) -> Any:
- answers = inquirer.prompt([question], raise_keyboard_interrupt=True, theme=BlueComposure())
- assert answers
- return next(iter(answers.values()))
-
-
-def ask_choices[T](choices: Iterable[T]) -> T:
- return ask(inquirer.List("main", message="What would you like to do", choices=list(choices)))
+def ask_choices(choices: Iterable[str]) -> str:
+ return questionary.select("What would you like to do", choices=tuple(choices), style=_PROMP_STYLE).unsafe_ask()
-def ask_text(text: str, default: object | None = None) -> str:
- return ask(inquirer.Text("text", message=text, default=default))
+def ask_text(text: str, default: str = "") -> str:
+ return questionary.text(text, default=default, style=_PROMP_STYLE).unsafe_ask()
def ask_confirmation(text: str = "", *, explicit: bool = False) -> bool:
if explicit:
- msg = "Type 'YES' to proceed"
- answer = ask_text(f"{text}. {msg}" if text else msg)
+ msg = "Type 'YES' to proceed: "
+ if text and not text.endswith("?"):
+ text += "?"
+ answer = console.input(f"{text}. {msg}" if text else msg)
return answer.strip().casefold() == "yes"
- return ask(inquirer.Confirm("text", message=text))
+ return questionary.confirm(text, default=False, style=_PROMP_STYLE).unsafe_ask()
def ask_dir(message: str = "Select dir path", default: Path | None = None) -> Path:
@@ -83,7 +89,7 @@ def ask_dir(message: str = "Select dir path", default: Path | None = None) -> Pa
if not path.is_dir():
raise NotADirectoryError(str(path))
- return ask_path(message, default, validate=is_dir)
+ return ask_path(message, default, validate=is_dir, only_dir=True)
def ask_path(
@@ -92,10 +98,13 @@ def ask_path(
*,
validate: Callable[[Path], None] | None = None,
must_exists: bool = True,
+ only_dir: bool = False,
) -> Path:
while True:
try:
- answer = ask_text(message, default=default or Path.home())
+ answer = questionary.path(
+ message, default=str(default or Path.home()), only_directories=only_dir, style=_PROMP_STYLE
+ ).unsafe_ask()
path = Path(answer).expanduser()
if must_exists and not path.exists():
raise FileNotFoundError(answer)
diff --git a/pyproject.toml b/pyproject.toml
index 23ec9c896..07554560a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "cyberdrop-dl-patched"
-version = "10.6.0"
+version = "10.6.1dev0"
authors = [{name = "Jacob B", email = "[email protected]"}]
classifiers = [
"Development Status :: 5 - Production/Stable",
@@ -29,13 +29,13 @@ dependencies = [
"cyclopts==4.23.2",
"idna>=3.18",
"imagesize == 2.0.0",
- "inquirer>=3.4.1",
"m3u8 >=6.0.0",
"propcache >=0.5.2",
"psutil >=7.2.1; sys_platform != 'android'",
"pycryptodome >=3.23.0",
"pydantic == 2.13.4",
"pyyaml >=6.0.3",
+ "questionary>=2.1.1",
"readchar >= 4.2.2",
"rich >=15.0.0",
"rich-rst==2.0.2",
diff --git a/uv.lock b/uv.lock
index 466c7f26c..7972d4c6f 100644
--- a/uv.lock
+++ b/uv.lock
@@ -167,15 +167,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643, upload-time = "2024-05-20T21:33:24.1Z" },
]
-[[package]]
-name = "ansicon"
-version = "1.89.0"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/b6/e2/1c866404ddbd280efedff4a9f15abfe943cb83cde6e895022370f3a61f85/ansicon-1.89.0.tar.gz", hash = "sha256:e4d039def5768a47e4afec8e89e83ec3ae5a26bf00ad851f914d1240b444d2b1", size = 67312, upload-time = "2019-04-29T20:23:57.314Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/75/f9/f1c10e223c7b56a38109a3f2eb4e7fe9a757ea3ed3a166754fb30f65e466/ansicon-1.89.0-py2.py3-none-any.whl", hash = "sha256:f1def52d17f65c2c9682cf8370c03f541f410c1752d6a14029f97318e4b9dfec", size = 63675, upload-time = "2019-04-29T20:23:53.83Z" },
-]
-
[[package]]
name = "apprise"
version = "1.13.0"
@@ -277,19 +268,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/88/c6/92fcd42f1ba33e1184263f25bfabf3d27c383410470f169e4b8163bf9c17/beautifulsoup4-4.15.0-py3-none-any.whl", hash = "sha256:d6f88de62e1d4e38ecb1077eb9724cd0eff29d2a08ca16a401e9b9e93f117cf9", size = 109924, upload-time = "2026-06-07T16:44:21.566Z" },
]
-[[package]]
-name = "blessed"
-version = "1.44.0"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "jinxed" },
- { name = "wcwidth" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/7b/73/445c4ef32565d2f5af49f18c4163a32850c9328774ee0af74ed081d4ba15/blessed-1.44.0.tar.gz", hash = "sha256:d3b5037f0143eb7c80b2000be5bcdf86161af68aed231b91deadbce4e7379785", size = 14031337, upload-time = "2026-05-24T02:06:30.832Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/7e/c3/e8effb323af40a5d8e85ab557da2f0475f12a31f3266f28d91d0bf406963/blessed-1.44.0-py3-none-any.whl", hash = "sha256:e1d2ed93d3d90d0a1494a8b134d188c83fb89ae25590af638b921e8c1c8fa223", size = 130232, upload-time = "2026-05-24T02:06:26.458Z" },
-]
-
[[package]]
name = "brotli"
version = "1.2.0"
@@ -693,7 +671,7 @@ wheels = [
[[package]]
name = "cyberdrop-dl-patched"
-version = "10.6.0"
+version = "10.6.1.dev0"
source = { editable = "." }
dependencies = [
{ name = "aiodns", marker = "sys_platform != 'android' and sys_platform != 'win32'" },
@@ -710,13 +688,13 @@ dependencies = [
{ name = "cyclopts" },
{ name = "idna" },
{ name = "imagesize" },
- { name = "inquirer" },
{ name = "m3u8" },
{ name = "propcache" },
{ name = "psutil", marker = "sys_platform != 'android'" },
{ name = "pycryptodome" },
{ name = "pydantic" },
{ name = "pyyaml" },
+ { name = "questionary" },
{ name = "readchar" },
{ name = "rich" },
{ name = "rich-rst" },
@@ -767,7 +745,6 @@ requires-dist = [
{ name = "cyclopts", specifier = "==4.23.2" },
{ name = "idna", specifier = ">=3.18" },
{ name = "imagesize", specifier = "==2.0.0" },
- { name = "inquirer", specifier = ">=3.4.1" },
{ name = "m3u8", specifier = ">=6.0.0" },
{ name = "propcache", specifier = ">=0.5.2" },
{ name = "psutil", marker = "sys_platform != 'android'", specifier = ">=7.2.1" },
@@ -775,6 +752,7 @@ requires-dist = [
{ name = "pydantic", specifier = "==2.13.4" },
{ name = "pywin32", marker = "sys_platform == 'win32' and extra == 'apprise'", specifier = ">=312" },
{ name = "pyyaml", specifier = ">=6.0.3" },
+ { name = "questionary", specifier = ">=2.1.1" },
{ name = "readchar", specifier = ">=4.2.2" },
{ name = "rich", specifier = ">=15.0.0" },
{ name = "rich-rst", specifier = "==2.0.2" },
@@ -823,19 +801,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/a7/5f/ed01f9a3cdffbd5a008556fc7b2a08ddb1cc6ace7effa7340604b1d16699/docstring_parser-0.18.0-py3-none-any.whl", hash = "sha256:b3fcbed555c47d8479be0796ef7e19c2670d428d72e96da63f3a40122860374b", size = 22484, upload-time = "2026-04-14T04:09:18.638Z" },
]
-[[package]]
-name = "editor"
-version = "1.8.0"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "runs" },
- { name = "xmod" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/ae/5f/fe06c2a13a5282dcef4c7133bb348d4125a9aa69c5fb49037a004599d73a/editor-1.8.0.tar.gz", hash = "sha256:b07e1bbcb8b33f05c2e6ed3ce77ee9756354ada840a18aad7c0536d967fe4c0b", size = 27455, upload-time = "2026-05-09T13:42:59.796Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/55/b8/6648cadf38b61045262bf2a534e526f04eb833275ad1fc77a2026e9f7e3a/editor-1.8.0-py3-none-any.whl", hash = "sha256:7d47ff88ae6c5f6c43d28c30b6f7fd59a24741175a1771ab06c969d946d7dfd0", size = 4012, upload-time = "2026-05-09T13:43:00.847Z" },
-]
-
[[package]]
name = "frozenlist"
version = "1.8.0"
@@ -952,32 +917,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" },
]
-[[package]]
-name = "inquirer"
-version = "3.4.1"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "blessed" },
- { name = "editor" },
- { name = "readchar" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/c1/79/165579fdcd3c2439503732ae76394bf77f5542f3dd18135b60e808e4813c/inquirer-3.4.1.tar.gz", hash = "sha256:60d169fddffe297e2f8ad54ab33698249ccfc3fc377dafb1e5cf01a0efb9cbe5", size = 14069, upload-time = "2025-08-02T18:36:27.901Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/f0/fd/7c404169a3e04a908df0644893a331f253a7f221961f2b6c0cf44430ae5a/inquirer-3.4.1-py3-none-any.whl", hash = "sha256:717bf146d547b595d2495e7285fd55545cff85e5ce01decc7487d2ec6a605412", size = 18152, upload-time = "2025-08-02T18:36:26.753Z" },
-]
-
-[[package]]
-name = "jinxed"
-version = "2.0.4"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "ansicon", marker = "sys_platform == 'win32'" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/3c/5e/2eea62fd64689685b082f29e1dcd0e57a19009c90733318a4bc9ddb54b2c/jinxed-2.0.4.tar.gz", hash = "sha256:a92ac48923433c0a88577bb0479191788813fd5055ef17ff2b04a701a1b83f19", size = 135991, upload-time = "2026-05-23T16:30:58.304Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/a2/b8/fe4e07cffa35c13fb8c7d21062082f27c89663f3009ec7d0c9b6908faa10/jinxed-2.0.4-py2.py3-none-any.whl", hash = "sha256:58ae0a4a2930b51e9de162208c356b382f5e25b3bc0ad73e2013b02a62d84e8b", size = 96427, upload-time = "2026-05-23T16:30:57.229Z" },
-]
-
[[package]]
name = "m3u8"
version = "6.0.0"
@@ -1167,6 +1106,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/37/e1/6fc64bb82e7270f61707e00b6d3154a4592ae0b2d3bd308173aa7aabe0a1/prek-0.4.14-py3-none-win_arm64.whl", hash = "sha256:ff588c02e10c8d05150763607671a22d5585c0ff7036c884d3489c2726eb215c", size = 5729906, upload-time = "2026-08-17T04:27:53.52Z" },
]
+[[package]]
+name = "prompt-toolkit"
+version = "3.0.53"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "wcwidth" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/7d/ea/39b988c938f75cb75d7045b5c69f8bfed47ee2152c8837fb403de29d6fb8/prompt_toolkit-3.0.53.tar.gz", hash = "sha256:9ec8a0ad96d5c56148b3f914aa79c1564c3fde5d2e6b876e7bc327e353cf8fa6", size = 435492, upload-time = "2026-07-26T20:56:14.758Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/54/6f/84908cad2d6aa5144abcf7b42709fe4fdb459bc640ec7ac5786e7693dabc/prompt_toolkit-3.0.53-py3-none-any.whl", hash = "sha256:01c0891d7f9237d5e339f7d3e42cdae80b7534abb1c7c0e3352efba6231492f2", size = 392288, upload-time = "2026-07-26T20:56:12.512Z" },
+]
+
[[package]]
name = "propcache"
version = "0.5.2"
@@ -1586,6 +1537,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341, upload-time = "2025-09-25T21:32:56.828Z" },
]
+[[package]]
+name = "questionary"
+version = "2.1.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "prompt-toolkit" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/f6/45/eafb0bba0f9988f6a2520f9ca2df2c82ddfa8d67c95d6625452e97b204a5/questionary-2.1.1.tar.gz", hash = "sha256:3d7e980292bb0107abaa79c68dd3eee3c561b83a0f89ae482860b181c8bd412d", size = 25845, upload-time = "2025-08-28T19:00:20.851Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/3c/26/1062c7ec1b053db9e499b4d2d5bc231743201b74051c973dadeac80a8f43/questionary-2.1.1-py3-none-any.whl", hash = "sha256:a51af13f345f1cdea62347589fbb6df3b290306ab8930713bfae4d475a7d4a59", size = 36753, upload-time = "2025-08-28T19:00:19.56Z" },
+]
+
[[package]]
name = "readchar"
version = "4.2.2"
@@ -1674,18 +1637,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/69/3e/4132e539aed78c148854d4997a2685b0ed4dc4e87110b59ce528564e184e/ruff-0.16.3-py3-none-win_arm64.whl", hash = "sha256:b8ca152da82c1acc1fa8d5874b15951935f0eef46f10e6954c83859011b6178a", size = 11399302, upload-time = "2026-08-13T15:17:10.908Z" },
]
-[[package]]
-name = "runs"
-version = "1.3.0"
-source = { registry = "https://pypi.org/simple" }
-dependencies = [
- { name = "xmod" },
-]
-sdist = { url = "https://files.pythonhosted.org/packages/f2/ae/095cb626504733e288a81f871f86b10530b787d77c50193c170daaca0df1/runs-1.3.0.tar.gz", hash = "sha256:cca304b631dbefec598c7bfbcfb50d6feace6d3a968734b67fd42d3c728f5a05", size = 4585, upload-time = "2026-02-03T15:59:58.974Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/4f/b6/049c75d399ccf6e25abea0652b85bf7e7e101e0300aa9c1d284ad7061c0b/runs-1.3.0-py3-none-any.whl", hash = "sha256:e71a551cfa8da9ef882cac1d5a108bda78c9edee5b8d87e37c1003da5b6a7bed", size = 6406, upload-time = "2026-02-03T15:59:59.96Z" },
-]
-
[[package]]
name = "send2trash"
version = "2.1.0"
@@ -1797,15 +1748,6 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/32/c2/0812298e84f6f1889ebd7556dcc40ddf0f8ff2103ca47676de8422d34b47/wreq-0.12.1-cp314-cp314t-win_arm64.whl", hash = "sha256:df0b53224246bc5d83593c97dafe31a0ad89605941b1dd53297a3c339477c888", size = 3799784, upload-time = "2026-07-11T15:32:04.091Z" },
]
-[[package]]
-name = "xmod"
-version = "1.10.0"
-source = { registry = "https://pypi.org/simple" }
-sdist = { url = "https://files.pythonhosted.org/packages/7a/3b/5a0d2670bab661164e27a5c27c448ae6204458c97cb94ccf89d0c47715bc/xmod-1.10.0.tar.gz", hash = "sha256:b40b2a54d56684b01eb9627892b0c179918e8ef0bd4d7f3bac7a3fdba11cd6e6", size = 17862, upload-time = "2026-05-09T13:46:46.684Z" }
-wheels = [
- { url = "https://files.pythonhosted.org/packages/cb/e9/c362d47ed2b1928d65d61888c1419fae8ef69417fba2067d2fd3da1d400b/xmod-1.10.0-py3-none-any.whl", hash = "sha256:bebf8493b7ac63097401590a329c9ed20da224de0583a522e7ccb634af122f5a", size = 4661, upload-time = "2026-05-09T13:46:45.776Z" },
-]
-
[[package]]
name = "xxhash"
version = "4.0.1"