250 lines
13 KiB
TOML
250 lines
13 KiB
TOML
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[project]
|
|
name = "invisible_playwright"
|
|
version = "0.61.0"
|
|
description = "Playwright wrapper for a patched Firefox with deterministic stealth profile."
|
|
readme = "README.md"
|
|
requires-python = ">=3.11"
|
|
# ⛔ TWO LICENSES, not one, since src/invisible_playwright/_pw/ is a fork of
|
|
# Playwright's Python client (Apache-2.0). Our own code stays MIT; that
|
|
# directory does not, and redistributing it under an MIT declaration would
|
|
# misstate what the user is receiving.
|
|
#
|
|
# ⛔ THE NODE DRIVER WENT ON 2026-08-28 AND THIS LINE DID NOT MOVE, which is the
|
|
# part worth writing down. `_driver/` was the other Apache-2.0 folder and is
|
|
# gone, together with its LICENSE, NOTICE and ThirdPartyNotices.txt - but `_pw/`
|
|
# is still here, still carries Microsoft's copyright headers, and is still
|
|
# redistributed. Dropping the declaration because "the driver is gone" would
|
|
# have been the wrong deduction, and `tests/test_fork.py` asserts the surviving
|
|
# obligation by name so that nobody makes it later.
|
|
#
|
|
# This is not a theoretical precaution: this same file, a few lines below,
|
|
# already excludes tests/playwright-upstream from the sdist for the identical
|
|
# reason. That time the choice was not to ship; here the choice is to ship, so
|
|
# it must be declared.
|
|
#
|
|
# The file that makes the redistribution lawful is `_pw/LICENSE`, untouched.
|
|
license = "MIT AND Apache-2.0"
|
|
authors = [{ name = "feder-cr", email = "85809106+feder-cr@users.noreply.github.com" }]
|
|
keywords = ["playwright", "firefox", "stealth", "anti-detect", "automation"]
|
|
classifiers = [
|
|
"Development Status :: 4 - Beta",
|
|
"Intended Audience :: Developers",
|
|
"Operating System :: Microsoft :: Windows",
|
|
"Operating System :: POSIX :: Linux",
|
|
"Programming Language :: Python :: 3",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"Programming Language :: Python :: 3.13",
|
|
"Topic :: Software Development :: Testing",
|
|
"Topic :: Internet :: WWW/HTTP :: Browsers",
|
|
"Typing :: Typed",
|
|
]
|
|
dependencies = [
|
|
# Pure config (seed -> fingerprint -> prefs, binary download, proxy, geo) lives
|
|
# in invisible-core since the 2026-07-03 split; it pulls platformdirs/requests/
|
|
# maxminddb/tzdata transitively. The wrapper only adds Playwright.
|
|
#
|
|
# An EXACT specifier, not the bare `invisible-core @ git+...` direct reference
|
|
# this line used to carry. Measured, not assumed: pip is structurally blind to
|
|
# a violated direct reference. A direct reference carries no version specifier,
|
|
# so there is nothing for `pip check` to compare, and it reports "No broken
|
|
# requirements found" (exit 0) on an environment where the wrong core is
|
|
# installed. The same mismatch written as a real version specifier is reported,
|
|
# exit 1. pip also discards the metadata it just built for a moved git tag and
|
|
# leaves direct_url.json recording the OLD commit, so the file meant to be
|
|
# ground truth lies exactly when it matters.
|
|
#
|
|
# Cost, accepted knowingly: the pin literal now moves on every engine release,
|
|
# so a firefox-N bump is a two-repo release instead of a core-only push (it
|
|
# was three until invisible_firefox was deleted on 2026-08-18).
|
|
# invisible-core must be live on the index BEFORE this package is published,
|
|
# or a cold install fails to resolve.
|
|
#
|
|
# This literal is the ONLY place the expected core version is written. The
|
|
# import-time assertion in _pin.py reads it back out of this package's own
|
|
# metadata; nothing in src/ hardcodes a second copy (tests/test_core_pin.py
|
|
# fails if one appears). What stays invisible to install-time machinery is the
|
|
# --no-deps / lockfile residue, and _pin.py is the only layer that sees it.
|
|
"invisible_core==71.85.0",
|
|
# ⛔ playwright is NO LONGER a dependency: since the full fork, the Python
|
|
# client lives in src/invisible_playwright/_pw/ and its server in
|
|
# src/invisible_playwright/_juggler/ (no Node driver). Reintroducing it would not visibly
|
|
# break anything - that is the problem - because the two packages coexist
|
|
# without colliding: one of them would simply never run, and whoever
|
|
# reads the pyproject would believe the opposite.
|
|
#
|
|
# What we do NOT vendor is only the Node runtime (92.3 MB out of 105),
|
|
# which invisible_playwright._node downloads on first use from nodejs.org,
|
|
# verifying its checksum.
|
|
#
|
|
# The version constraint has not disappeared, it has moved: the seal
|
|
# carries the client range the binary was tested against, and
|
|
# _engine.assert_playwright_range() compares it against the VENDORED
|
|
# client's version. Before, it read the installed package's version.
|
|
# Reading another process's environment block is the only way to identify
|
|
# THIS session's browser tree exactly, and it is the identification that
|
|
# makes reaping safe: on a fleet, several sessions start on the same binary
|
|
# within the same second, so any heuristic ("a firefox that appeared after
|
|
# we did") eventually kills a healthy browser belonging to someone else.
|
|
#
|
|
# A hard dependency rather than an optional one, deliberately. The leak it
|
|
# closes appears exactly when teardown did NOT run cleanly - a timeout, an
|
|
# exception, a killed runner - so an optional reaper would be absent on
|
|
# precisely the machines that need it, and absent silently.
|
|
"psutil>=5.9",
|
|
# ⛔ THESE WERE TRANSITIVE DEPENDENCIES OF `playwright`, and removing that
|
|
# made them disappear with it. The client vendored in `_pw/` still imports
|
|
# them - `pyee` for the event emitters, `greenlet` for the sync API - so
|
|
# this package must now declare them itself: whoever vendors something
|
|
# inherits the dependencies of what it vendored.
|
|
#
|
|
# Measured on 2026-08-26, not inferred: wheel 0.7.3 would install and
|
|
# then `import invisible_playwright` would die with `No module named
|
|
# 'pyee'`. It was not visible in CI because the e2e job still runs `pip
|
|
# install playwright` for the sole purpose of `install-deps`, and that
|
|
# command pulled them back in through the service door. It is the same
|
|
# class as issue #14: it installs, and it only breaks for the user.
|
|
#
|
|
# The ranges are the ones playwright 1.61 declared, so as not to invent
|
|
# a constraint different from the one the client was actually tested
|
|
# against.
|
|
"pyee>=13,<14",
|
|
"greenlet>=3.1.1,<4.0.0",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
remote = ["websockets>=13"]
|
|
dev = ["websockets>=13", "aioquic>=1.2", "pytest>=7", "build>=1", "ruff>=0.6", "pytest-timeout>=2", "pytest-xdist>=3", "playwright==1.61.0", "cryptography>=41", "h2>=4,<5"]
|
|
|
|
[tool.pytest.ini_options]
|
|
markers = [
|
|
# ONE VOCABULARY FOR EVERY REPOSITORY THAT SHARES THE CORE. Aligned
|
|
# 2026-07-27 across the three that existed then; invisible_firefox was
|
|
# deleted on 2026-08-18, so today that is this repo and invisible_core.
|
|
# Before the alignment the same word meant different things and selected
|
|
# different sets.
|
|
#
|
|
# `integration` was "multi-module tests, no browser" in invisible_core and
|
|
# invisible_playwright, and "launches the real patched Firefox binary" in
|
|
# invisible_firefox - which is what `e2e` means. So the manager excluded
|
|
# `integration` by default while the other two ran it, and CLAUDE.md's
|
|
# "integration is reserved for explicit release runs" was true in one repo
|
|
# and wrong in the other two, where it names 57 structural tests that must
|
|
# run on every push.
|
|
#
|
|
# invisible_core's addopts said `not slow` while never declaring `slow`,
|
|
# so the exclusion matched nothing and the word meant nothing.
|
|
#
|
|
# The lists are identical on purpose, and
|
|
# invisible_core/tests/test_marker_vocabulary.py fails when they drift.
|
|
# (It compares the parsed lists, so this comment may differ per repo.)
|
|
"unit: pure logic - no I/O, no network, no subprocess, no browser",
|
|
"integration: several modules together, in process - no network, no browser",
|
|
"e2e: needs something outside this process - the network, the real patched binary, or a display",
|
|
"slow: builds a wheel or an sdist - opt-in only",
|
|
"linux_only: requires Linux",
|
|
"wall_clock: its verdict reads a wall-clock duration - the e2e run gives it the machine alone, after the parallel tests",
|
|
]
|
|
# Both exclusions in ONE addopts: declaring the key twice is a TOML error, not
|
|
# a merge, and pytest then sees neither value.
|
|
#
|
|
# `integration` is NOT excluded. It is in-process and fast, it is what covers
|
|
# the release wiring, and it is the selection a push most needs.
|
|
addopts = "-m 'not slow and not e2e' --strict-markers"
|
|
|
|
# ⛔ THE SUITE TESTS *THIS* CHECKOUT, not whatever the shared environment's
|
|
# editable install happens to point at. Without this line the package comes
|
|
# from whichever directory last ran `pip install -e`, and on 2026-08-29 that
|
|
# was a DIFFERENT working copy of this same repository, in C:/tmp, sitting on
|
|
# an older branch with no `_juggler/` package at all: a plain `pytest -q`
|
|
# reported 7 collection errors and ran zero tests, in a tree whose own suite
|
|
# is green.
|
|
#
|
|
# It failed loudly that time, which was luck rather than design - the two
|
|
# trees happened to differ by a whole subpackage. Had they differed by one
|
|
# function's behaviour instead, the suite would have gone green while testing
|
|
# code nobody had written here, which is the false green this project keeps
|
|
# finding in its own instruments.
|
|
#
|
|
# `src` is relative to this file, so each checkout points at itself and two
|
|
# working copies of this repo stop fighting over one interpreter.
|
|
pythonpath = ["src"]
|
|
|
|
# tests/playwright-upstream/ is a vendored Microsoft Playwright test suite
|
|
# used for compatibility verification on demand. It has its own deps
|
|
# (pixelmatch with API not matching our version) and a conftest that fails
|
|
# collection in our env. Run it explicitly with --override-ini for compat
|
|
# audits, not on every push. Also why --strict-markers above is safe: its
|
|
# only_browser / skip_browser / only_platform markers are never collected.
|
|
norecursedirs = ["playwright-upstream"]
|
|
|
|
[project.scripts]
|
|
invisible-playwright = "invisible_playwright.cli:main"
|
|
|
|
[project.urls]
|
|
Homepage = "https://github.com/oss-invisible/playwright"
|
|
Repository = "https://github.com/oss-invisible/playwright"
|
|
Issues = "https://github.com/oss-invisible/playwright/issues"
|
|
Changelog = "https://github.com/oss-invisible/playwright/blob/main/CHANGELOG.md"
|
|
Documentation = "https://github.com/oss-invisible/playwright#readme"
|
|
|
|
# No [tool.hatch.metadata] allow-direct-references opt-in: there is no direct
|
|
# reference left in [project].dependencies, and leaving the switch on is what
|
|
# would let one creep back in silently. Without it hatchling refuses to build a
|
|
# direct reference at all, which turns the decision above into a build-time gate.
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/invisible_playwright"]
|
|
exclude = ["*.bak", "*-bak"]
|
|
|
|
[tool.hatch.build.targets.sdist]
|
|
include = ["src/invisible_playwright", "tests", "README.md", "LICENSE", "pyproject.toml"]
|
|
# tests/playwright-upstream/ is a vendored copy of microsoft/playwright-python,
|
|
# Apache-2.0, ~322 files. Redistributing it inside an sdist whose only declared
|
|
# licence is MIT misstates the licence of what is being distributed, and a PyPI
|
|
# filename can never be re-uploaded once published.
|
|
#
|
|
# The forbidden-name guard used to be excluded here too. It is no longer in this
|
|
# repository at all: it needs a word list that deliberately lives outside every
|
|
# public repo, so as a shipped test it handed every user three red tests they
|
|
# could not make green. It is a workbench gate now, run by the pre-push hook.
|
|
exclude = ["tests/playwright-upstream"]
|
|
|
|
# Which pre-push gates this repository wants. `.githooks/pre-push` is a stub;
|
|
# the policy is invisible_core.hooks, and this block is the only per-repo part
|
|
# of it. Declared rather than defaulted on purpose: the wrong default silently
|
|
# skips a gate, and a skipped gate reads exactly like a passed one.
|
|
#
|
|
# `pin = true`: the invisible-core== specifier below must name the version the
|
|
# core checkout actually builds. No test here can see a stale pin - it only
|
|
# shows up at install time, on someone else's machine.
|
|
[tool.invisible.hooks]
|
|
pytest = true
|
|
pin = true
|
|
release_tags = ["v"]
|
|
|
|
# What this repository declares about ITSELF to the shared language gate
|
|
# (`python -m invisible_core.english`, since invisible-core 30.23.0). The logic
|
|
# lives in the core, once; only the per-repository half is here. It used to be
|
|
# a script copied into this repo and into AIHawk, and the copies drifted:
|
|
# AIHawk's carried these very paths, which exist only here, and this one never
|
|
# gained the `.js/.css/.html` coverage AIHawk's did.
|
|
#
|
|
# Vendored upstream Playwright is excluded as a FOLDER, but our own patches
|
|
# inside it are still read: they are found by the marker. (`injected.js`,
|
|
# extracted from the upstream bundle, moved to invisible-core with the Juggler
|
|
# client in 0.30.0, and its exclusion with it.) `test_fork.py` carries Italian ON
|
|
# PURPOSE - its known-bad fixture reproduces a JavaScript comment whose defect
|
|
# IS the trailing apostrophe of an Italian word; translate it and the mutation
|
|
# stops reproducing the bug. Named file by file, never by folder: an
|
|
# exclusion that names nothing is refused by the gate.
|
|
[tool.invisible.english]
|
|
excluded = [
|
|
"tests/test_fork.py",
|
|
]
|
|
marker = "MODIFIED by invisible_playwright"
|