Skip to content

fix: guard browser path against unsupported Python (3.14+) - #11

Open
enieuwy wants to merge 1 commit into
Rimagination:mainfrom
enieuwy:fix/python314-guard
Open

fix: guard browser path against unsupported Python (3.14+)#11
enieuwy wants to merge 1 commit into
Rimagination:mainfrom
enieuwy:fix/python314-guard

Conversation

@enieuwy

@enieuwy enieuwy commented Jun 29, 2026

Copy link
Copy Markdown

Closes #9.

On Python 3.14, every CloakBrowser/Playwright launch fails with Sync API inside the asyncio loop, breaking all institutional/browser fetches (OA + arXiv HTTP fetches are unaffected). This turns that cryptic crash into a clear, actionable message and prevents new installs from landing on 3.14.

Changes

  • requires-python = ">=3.10,<3.14" — new installs fail fast with a clear pip error until Playwright supports 3.14.
  • prepare_cloakbrowser_runtime() logs a clear one-time warning on Python >= 3.14 (browser workflows need 3.10-3.13; OA/arXiv still work). It only warns — never raises at import — so existing 3.14 environments degrade gracefully with an explanation instead of a baffling traceback.
  • New browser_python_warning() helper + unit test.

Testing

  • tests/test_python_guard.py: supported versions (3.10-3.13) -> no warning; 3.14/3.15/4.0 -> clear message naming the version.
  • Confirmed live: recreating the venv on 3.12 fixes the original crash; the warning fires for 3.14 and is silent on 3.12.

Based on main.

On Python 3.14 every CloakBrowser/Playwright launch dies with the cryptic
'Sync API inside the asyncio loop', breaking all institutional fetches
(issue Rimagination#9). Two guards:

- requires-python capped to '>=3.10,<3.14' so new installs fail fast with a
  clear pip message until Playwright supports 3.14.
- prepare_cloakbrowser_runtime() now logs a clear, actionable warning on
  Python >= 3.14 (browser needs 3.10-3.13; OA/arXiv still work), so an
  existing 3.14 env explains the failure instead of crashing cryptically.

Adds a unit test for the version check. No effect on supported Pythons.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser path crashes on Python 3.14 (Playwright Sync API inside the asyncio loop)

1 participant