mirror of
https://github.com/daijro/camoufox.git
synced 2026-11-19 00:07:28 +00:00
The incompatibility is two-dimensional -- it needs both a Playwright >= 1.61
and a browser < beta.30 -- but MIN_VERSION only knows about the browser. To
stay safe a flat floor has to assume the worst Playwright, which means:
* every 0.5.6 user re-downloads the browser, including the majority on
<1.61 who are in no danger;
* installs pinned to an older build lose the pin, and prerelease/alpha users
are moved off their channel, since every alpha sorts below beta.30;
* the library cannot run at all until the matching browser release is
published, making the PyPI-after-release ordering load-bearing.
Key it on the resolved Playwright instead. Measured: 1.60 works on beta.29 and
beta.30; 1.61 and 1.62 fail on beta.29 and pass on beta.30.
playwright <1.61 -> floor alpha.1 -> every install kept
playwright >=1.61 -> floor beta.30 -> below-beta.30 installs upgraded
version unreadable -> floor alpha.1 -> kept; a spurious forced re-download is
worse than leaving a working install
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
"""
|
|
Camoufox version constants.
|
|
"""
|
|
|
|
|
|
class CONSTRAINTS:
|
|
"""
|
|
The minimum and maximum supported versions of the Camoufox browser.
|
|
"""
|
|
|
|
MIN_VERSION = 'alpha.1'
|
|
MAX_VERSION = '1'
|
|
|
|
# The browser floor is conditional on the resolved Playwright, not fixed.
|
|
#
|
|
# Each entry is (playwright_version, required_browser_build): from that
|
|
# Playwright on, the browser must be at least that build. 1.61 began
|
|
# sending viewport isMobile/screenSize in Browser.setDefaultViewport and
|
|
# Page.setViewportSize; beta.30 is the first build whose Protocol.js schema
|
|
# accepts them. Below that pairing every new_context() dies with
|
|
# "Protocol error (Browser.setDefaultViewport)". Measured: 1.60 works on
|
|
# beta.29 and beta.30; 1.61 and 1.62 fail on beta.29 and pass on beta.30.
|
|
#
|
|
# A flat MIN_VERSION cannot express this. It only knows about the browser,
|
|
# so to stay safe it has to assume the worst Playwright and force *every*
|
|
# user to re-download -- including the majority on <1.61, who are in no
|
|
# danger -- and it leaves the library unusable until the matching browser
|
|
# release is published. Keyed on Playwright, only the users who would
|
|
# actually break get moved.
|
|
PLAYWRIGHT_BROWSER_FLOORS = (((1, 61), 'beta.30'),)
|
|
|
|
@staticmethod
|
|
def as_range() -> str:
|
|
"""
|
|
Returns the version range as a string.
|
|
"""
|
|
return f">={CONSTRAINTS.MIN_VERSION}, <{CONSTRAINTS.MAX_VERSION}"
|