You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Puppeteer/Playwright cache_dir: drop env-var fallback, go passthrough when install_root=None
``cache_dir`` is now a tiny computed helper that returns
``<install_root>/cache`` when ``install_root`` is pinned and ``None``
otherwise — no env-var fallback. This flips the ``install_root=None``
mode to pure passthrough:
- The caller's ambient ``PUPPETEER_CACHE_DIR`` /
``PLAYWRIGHT_BROWSERS_PATH`` passes through to every subprocess
unchanged (abxpkg exports nothing of its own).
- ``load()`` trusts whatever ``puppeteer-browsers list`` /
playwright-core ``executablePath()`` reports — no scoping applied.
- ``uninstall()`` is a no-op when ``install_root=None``: we refuse to
rmtree the user's cache because we don't own it. Users who want
managed uninstall should set ``install_root``; users who stay in
ambient mode manage their own cache via the CLI or their own tooling.
- ``install()`` only passes ``--path=`` / sets
``PLAYWRIGHT_BROWSERS_PATH`` when we own the root; otherwise the
CLIs install into their own default.
Every existing call site already guarded on ``self.cache_dir is not
None``, so dropping the env-var branch changes no managed-mode
behaviour — it just stops abxpkg from claiming ownership of a cache
dir the user controls.
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1078,7 +1078,7 @@ cache_dir = <install_root>/cache # computed; None when install_root is unset
1078
1078
```
1079
1079
1080
1080
- Install root: set `install_root` for the root dir and `bin_dir` for symlinked executables. Leave it unset for ambient/global mode, where cache ownership stays with the host and `INSTALLER_BINARY` must already be resolvable from the ambient provider set.
1081
-
- Cache dir / `PUPPETEER_CACHE_DIR`: `cache_dir` is a computed property. When `install_root` is pinned it's always `<install_root>/cache`. When `install_root` is unset it reads the ambient `$PUPPETEER_CACHE_DIR`env var so ``load()`` / ``uninstall()`` / scope checks target the same directory the user configured externally (``None`` when the env var is also unset — puppeteer-browsers then falls back to `~/.cache/puppeteer`). The resolved `cache_dir` is exported as `PUPPETEER_CACHE_DIR` to every subprocess the provider runs.
1081
+
- Cache dir: `cache_dir` is a computed helper property. When `install_root` is pinned it's `<install_root>/cache` and abxpkg owns it — exported as `PUPPETEER_CACHE_DIR`to every subprocess, used for `--path=` on `puppeteer-browsers install` / `list`, and rmtree'd per-browser on `uninstall()`. When `install_root` is unset, `cache_dir` is `None`: the provider is in pure passthrough mode. The caller's ambient `$PUPPETEER_CACHE_DIR` (or the CLI's `~/.cache/puppeteer` default) flows through to subprocesses unchanged, `load()` trusts whatever path `puppeteer-browsers list` reports, and `uninstall()` is a no-op — we don't touch the user's own cache.
1082
1082
- Auto-switching: bootstraps `@puppeteer/browsers` through `NpmProvider` and then uses that CLI for browser installs.
1083
1083
-`dry_run`: shared behavior.
1084
1084
- Security: `min_release_age` is unsupported for browser installs and is ignored with a warning if explicitly requested. `postinstall_scripts=False` is supported for the underlying npm bootstrap path, and `ABXPKG_POSTINSTALL_SCRIPTS` hydrates the provider default here.
- Install root: set `install_root` to pin the abxpkg-managed root dir (where `bin_dir` symlinks and the nested npm prefix live). Leave it unset to let playwright use its own OS-default browsers path (`~/.cache/ms-playwright` on Linux etc.) — in that case abxpkg maintains no symlink dir or npm prefix at all, the `playwright` npm CLI bootstraps against the host's npm default, and `load()` returns the resolved `executablePath()` directly. `bin_dir` overrides the symlink directory when `install_root` is pinned.
1105
-
- Cache dir / `PLAYWRIGHT_BROWSERS_PATH`: `cache_dir` is a computed property. When `install_root` is pinned it's always `<install_root>/cache`. When `install_root` is unset it reads the ambient `$PLAYWRIGHT_BROWSERS_PATH` env var so ``load()`` / ``uninstall()`` / scope checks target the same directory the user configured externally (``None`` when the env var is also unset — playwright then falls back to `~/.cache/ms-playwright` on Linux). The resolved `cache_dir` is exported as `PLAYWRIGHT_BROWSERS_PATH` to every subprocess (including the `env KEY=VAL -- ...` wrapper used when we go through sudo). `uninstall()`deletes matching `<browser>-*/` dirs from the resolved `cache_dir` — and when neither `install_root` nor `$PLAYWRIGHT_BROWSERS_PATH` is set, it touches nothing, leaving playwright's OS-default cache alone.
1105
+
- Cache dir: `cache_dir` is a computed helper property. When `install_root` is pinned it's `<install_root>/cache` and abxpkg owns it — exported as `PLAYWRIGHT_BROWSERS_PATH`to every subprocess (including the `env KEY=VAL -- ...` wrapper used when we go through sudo), used to scope `executablePath()` hits on `load()`, and walked for per-browser rmtree on `uninstall()`. When `install_root` is unset, `cache_dir` is `None`: the provider is in pure passthrough mode. The caller's ambient `$PLAYWRIGHT_BROWSERS_PATH` (or playwright's `~/.cache/ms-playwright`default on Linux) flows through to subprocesses unchanged, `load()` trusts whatever path `executablePath()` reports, and `uninstall()`is a no-op — we don't touch the user's own cache.
1106
1106
- Auto-switching: bootstraps the `playwright` npm package through `NpmProvider`, then runs `playwright install --with-deps <install_args>` against it. Resolves each installed browser's real executable via the `playwright-core` Node.js API (`chromium.executablePath()` etc.) and writes a symlink into `bin_dir` when one is configured.
1107
1107
-`dry_run`: shared behavior — the install handler short-circuits to a placeholder without touching the host.
1108
1108
- Privilege handling: `--with-deps` installs system packages and requires root on Linux. ``euid`` defaults to ``0``, which routes every ``exec()`` call through the base ``BinProvider.exec`` sudo-first-then-fallback path — it tries ``sudo -n -- playwright install --with-deps ...`` first on non-root hosts, falls back to running the command directly if sudo fails or isn't available, and merges both stderr outputs into the final error if both attempts fail.
0 commit comments