From 4616aa58caaa7cb67082ffca6bb54c24f3794b63 Mon Sep 17 00:00:00 2001 From: Jake Writer Date: Fri, 25 Sep 2026 20:24:26 -0600 Subject: [PATCH] fix(python)!: remove dead public API and make `list all --path` work Breaking changes: - Remove the exceptions UnknownProperty, InvalidDebugPort and MissingDebugPort. Nothing in the package raises them, so code catching them was catching nothing. - Remove the legacy `allow_webgl` keyword of launch_options(). Use `block_webgl=True`. The keyword now reaches Playwright as an unknown launch option and fails there instead of being silently consumed. `camoufox list all --path` accepted the flag and ignored it. It now prints the install path beside each installed build, as `camoufox list --path` already does for the installed tree. Co-Authored-By: Claude Opus 5.5 --- pythonlib/camoufox/__main__.py | 4 +++- pythonlib/camoufox/exceptions.py | 24 ------------------------ pythonlib/camoufox/utils.py | 3 +-- pythonlib/tests/test_cli_list.py | 25 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 pythonlib/tests/test_cli_list.py diff --git a/pythonlib/camoufox/__main__.py b/pythonlib/camoufox/__main__.py index 20a3a0a..de1dd11 100644 --- a/pythonlib/camoufox/__main__.py +++ b/pythonlib/camoufox/__main__.py @@ -680,7 +680,7 @@ def _list_installed(show_paths: bool): rprint(" └── Not configured", fg="yellow") -def _list_all(_show_paths: bool): +def _list_all(show_paths: bool): """ List all available versions from synced repos """ @@ -720,6 +720,8 @@ def _list_all(_show_paths: bool): click.secho(" (installed, active)", fg="green", bold=True, nl=False) else: click.secho(" (installed)", fg="green", nl=False) + if show_paths: + click.secho(f" -> {inst.path}", fg="bright_black", nl=False) click.echo() diff --git a/pythonlib/camoufox/exceptions.py b/pythonlib/camoufox/exceptions.py index 83a7974..292e992 100644 --- a/pythonlib/camoufox/exceptions.py +++ b/pythonlib/camoufox/exceptions.py @@ -38,14 +38,6 @@ class UnsupportedOS(Exception): ... -class UnknownProperty(Exception): - """ - Raised when the property is unknown. - """ - - ... - - class InvalidPropertyType(Exception): """ Raised when the property type is invalid. @@ -62,22 +54,6 @@ class InvalidAddonPath(FileNotFoundError): ... -class InvalidDebugPort(ValueError): - """ - Raised when the debug port is invalid. - """ - - ... - - -class MissingDebugPort(ValueError): - """ - Raised when the debug port is missing. - """ - - ... - - class LocaleError(Exception): """ Raised when the locale is invalid. diff --git a/pythonlib/camoufox/utils.py b/pythonlib/camoufox/utils.py index 3b63857..05a04ab 100644 --- a/pythonlib/camoufox/utils.py +++ b/pythonlib/camoufox/utils.py @@ -1412,8 +1412,7 @@ def launch_options( LeakWarning.warn('disable_coop', i_know_what_im_doing) firefox_user_prefs['browser.tabs.remote.useCrossOriginOpenerPolicy'] = False - # Allow allow_webgl parameter for backwards compatibility - if block_webgl or launch_options.pop('allow_webgl', True) is False: + if block_webgl: firefox_user_prefs['webgl.disabled'] = True LeakWarning.warn('block_webgl', i_know_what_im_doing) else: diff --git a/pythonlib/tests/test_cli_list.py b/pythonlib/tests/test_cli_list.py new file mode 100644 index 0000000..0381663 --- /dev/null +++ b/pythonlib/tests/test_cli_list.py @@ -0,0 +1,25 @@ +"""`camoufox list --path` shows install paths in both listing modes.""" + +from pathlib import Path + +from click.testing import CliRunner + +from camoufox import __main__ as cli +from camoufox.multiversion import InstalledVersion +from camoufox.pkgman import Version + + +def test_list_all_shows_the_path_of_an_installed_build(monkeypatch): + install = Path("/cache/browsers/official/152.0.4-beta.30") + installed = InstalledVersion( + repo_name="official", version=Version(build="beta.30", version="152.0.4"), path=install + ) + cache = {"repos": [{"name": "official", "versions": [{"version": "152.0.4", "build": "beta.30"}]}]} + monkeypatch.setattr(cli, "_ensure_synced", lambda: True) + monkeypatch.setattr(cli, "load_repo_cache", lambda: cache) + monkeypatch.setattr(cli, "list_installed", lambda: [installed]) + + result = CliRunner().invoke(cli.cli, ["list", "all", "--path"]) + + assert result.exit_code == 0, result.output + assert str(install) in result.output