Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

FIT WebView Bridge

Description

FIT WebView Bridge currently provides a native macOS Qt widget (WKWebView) with PySide6 bindings.

Goal:

  • use the OS-native web engine and system codecs (no custom QtWebEngine codec builds)
  • expose a Python-usable widget API for navigation, downloads, JS evaluation, and capture

Current implementation scope:

  • macOS backend only (src/macos, bindings/pyside6/macos)

Roadmap:

  • planned backend expansion to Windows (WebView2) and Linux (WebKitGTK)

Why this project

QtWebEngine (Chromium) does not enable proprietary codecs by default. This module uses native web engines to keep codec compatibility and retain application control through a Qt/PySide API.

Repository layout (current)

fit-webview-bridge/
├─ CMakeLists.txt
├─ src/
│  └─ macos/                # WKWebView backend (Objective-C++)
├─ bindings/pyside6/
│  └─ macos/                # Shiboken typesystem and binding build
├─ fit_webview_bridge/      # Python package entrypoint
├─ examples/macos/          # Demo app
├─ scripts/macos/           # Local bootstrap/build scripts
└─ tests/                   # Pytest suites

API (SystemWebViewWidget)

Methods / invokables

  • url()
  • setUrl(QUrl)
  • back()
  • forward()
  • stop()
  • reload()
  • clearWebsiteData()
  • clearCacheData()
  • setProxy(QString host, int port) -> bool (macOS 14+ WKWebView explicit HTTP CONNECT proxy)
  • clearProxy()
  • hasExplicitProxySupport() -> bool
  • evaluateJavaScript(QString)
  • evaluateJavaScriptWithResult(QString) -> token
  • setDownloadDirectory(QString)
  • downloadDirectory()
  • setUserAgent(QString)
  • userAgent()
  • resetUserAgent()
  • setApplicationNameForUserAgent(QString)
  • captureVisiblePage(QString) -> token

setProxy() uses WKWebsiteDataStore.proxyConfigurations on macOS 14+ and should be called immediately after creating SystemWebViewWidget, before the first setUrl(). clearProxy() only removes the explicit proxy configuration; it does not clear cookies, storage, or cache.

Signals

  • urlChanged(QUrl)
  • navigationDisplayUrlChanged(QUrl)
  • titleChanged(QString)
  • loadProgress(int)
  • loadFinished(bool)
  • canGoBackChanged(bool)
  • canGoForwardChanged(bool)
  • downloadStarted(QString, QString)
  • downloadProgress(qint64, qint64)
  • downloadFinished(DownloadInfo*)
  • downloadFailed(QString, QString)
  • javaScriptResult(QVariant, quint64, QString)
  • captureFinished(quint64, bool, QString, QString)

Prerequisites (macOS)

  • CMake >= 3.24
  • Ninja (generator)
  • Python >= 3.11,<3.14
  • Xcode + Command Line Tools
  • PySide6 / Shiboken6 compatible with your target Python
  • Qt 6.9.x SDK (installed locally, e.g. via aqtinstall)

Build (macOS)

git clone https://github.com/fit-project/fit-webview-bridge.git
cd fit-webview-bridge
cmake -S . -B build -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DBUILD_BINDINGS=ON \
  -DQt6_DIR="$PWD/Qt/6.9.0/macos/lib/cmake/Qt6" \
  -DPython3_EXECUTABLE="$(python3 -c 'import sys; print(sys.executable)')"
cmake --build build

# smoke import
PYTHONPATH="$PWD/build:$PYTHONPATH" python3 -c "import systemwebview; print('systemwebview import OK')"

Local checks (same as CI)

Run these commands before opening a PR, so failures are caught locally first.

What each tool does

  • cmake + ninja: configures and builds the native module and PySide6 binding.
  • pytest: runs automated tests (unit, contract, integration and e2e suites).
  • clang-format: checks code formatting/style consistency for C++/Objective-C++ sources.
  • clang-tidy: performs static analysis for bug-prone patterns and quality issues.
  • CodeQL (optional): performs deeper security/quality static analysis and produces a SARIF report.

1) Bootstrap local toolchain (macOS)

This prepares Python virtualenvs (3.11, 3.12, 3.13) and installs Qt via aqtinstall.

./scripts/macos/bootstrap_macos.sh

2) Build + smoke import (all supported Python versions)

This compiles the module for each configured Python version and validates import of systemwebview.

./scripts/macos/build_smoke_macos.sh

By default, the script performs a clean build per Python version (CLEAN_BUILD=1) to avoid stale CMake cache/toolchain mismatches. To reuse existing build directories:

CLEAN_BUILD=0 ./scripts/macos/build_smoke_macos.sh

Single entrypoint (bootstrap + build/smoke):

./scripts/macos/ci_local_macos.sh

3) Test suite

After a successful build, run:

#Base setup
source .venv311/bin/activate
python -m pip install -U pip
pip install pytest

# unit tests
pytest -m unit -q tests/macos

# contract tests
pytest -m contract -q tests/macos

# integration tests
FIT_WV_RUN_GUI_TESTS=1 pytest -m integration -q tests/macos

# end-to-end smoke tests
FIT_WV_RUN_GUI_TESTS=1 pytest -m e2e -q tests/macos

Note: integration and e2e require a GUI-capable macOS session and are gated by FIT_WV_RUN_GUI_TESTS=1.

4) Native quality and security checks (macOS)

Install native analysis tools (one-time):

brew install llvm
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"

Formatting rules are pinned in the repository via .clang-format.

Run all native checks:

./scripts/macos/check_quality.sh

Note: native quality checks run with BUILD_BINDINGS=OFF to avoid coupling static analysis to Shiboken generation.

If clang-format reports many violations, auto-format first:

./scripts/macos/format_macos.sh

format_macos.sh runs only the formatting stage (clang-format) and skips clang-tidy.

Equivalent one-liner:

FORMAT_FIX=1 SKIP_TIDY=1 ./scripts/macos/check_quality.sh

Use a custom clang-tidy check subset:

CLANG_TIDY_CHECKS='-*,clang-analyzer-*,bugprone-*' ./scripts/macos/check_quality.sh

If your shell exports LLVM paths globally and clang-tidy configure fails due toolchain mismatch, run with a clean include env:

env -u CPATH -u CPLUS_INCLUDE_PATH -u C_INCLUDE_PATH -u OBJC_INCLUDE_PATH \
  ./scripts/macos/check_quality.sh

If clang-tidy cannot find macOS framework headers (for example Cocoa/Cocoa.h), set the SDK root explicitly:

MACOS_SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" ./scripts/macos/check_quality.sh

If build_smoke_macos.sh fails during Shiboken generation with errors like Libc++ only supports Clang 19 and later or missing __builtin_ctzg/__builtin_clzg, you are hitting a mixed toolchain environment (typically Homebrew LLVM headers with AppleClang). Use the default clean run and venv toolchain selection:

CLEAN_BUILD=1 ./scripts/macos/build_smoke_macos.sh

Enable local CodeQL scan (optional):

ENABLE_CODEQL=1 ./scripts/macos/check_quality.sh

By default, the CodeQL build runs with BUILD_BINDINGS=OFF (native backend only) to avoid Shiboken/toolchain coupling. If you explicitly want bindings in the CodeQL build, override:

ENABLE_CODEQL=1 CODEQL_BUILD_BINDINGS=ON ./scripts/macos/check_quality.sh

Note: with Homebrew CodeQL, query packs may be downloaded on first run (--download), so network access is required.

If codeql is not installed/in PATH, the script reports:

CodeQL CLI not found in PATH but ENABLE_CODEQL=1 was requested.

Install CodeQL CLI on macOS (Homebrew):

brew install codeql
codeql version

Examples

PySide6 samples in examples/ demonstrate URL loading, JS injection, and signal handling.

Codec & licensing notes

The project does not redistribute proprietary codecs: it leverages codecs already provided by the OS. End‑user usage must comply with the relevant licenses/formats.

Project status

Active development. Current public scope in this repository is macOS.

Fit Web — Project rationale and options for proprietary codecs

Fit Web is the FIT project's scraper module designed to forensically acquire and preserve web content: https://github.com/fit-project/fit-web.

Like the other modules, Fit Web is based on PySide (Qt for Python). It currently uses QtWebEngine, which is a Chromium wrapper.

The problem

By default, Chromium does not enable proprietary audio/video codecs, notably H.264 and AAC.

Options considered

1) Build QtWebEngine with proprietary codecs

Enable the -webengine-proprietary-codecs option.
Documentation: https://doc.qt.io/qt-6/qtwebengine-overview.html

Drawbacks

  • Must be done for all supported operating systems.
  • The build requires very powerful machines (e.g., difficulties on a MacBook Air M2 with 16 GB RAM).
  • Licensing: distributing H.264 and AAC requires a license.

2) Use QtWebView

QtWebView relies on the OS’s native web APIs; for proprietary‑codec content it uses the system’s codecs.
Pros: no custom builds, no direct license handling.
Cons: the UI layer is QML, geared toward lightweight (often mobile) UIs, so it doesn’t provide full browser control compared to QtWebEngine.

Documentation: https://doc.qt.io/qt-6/qtwebview-index.html

3) Implement a native Qt widget (C/C++) per OS

Develop a Qt widget (usable from PySide6) that embeds the system’s web engine:

  • Windows → Edge WebView2
  • macOS → WKWebView
  • Linux → WebKitGTK (with GStreamer for codecs)

Advantages

  • No redistribution licensing: leverage the codecs already provided by the OS.
  • A common API can be exposed to PySide6.
  • More control than QtWebView, without QML’s limitations.

Disadvantages

  • Medium‑to‑high complexity to implement.
  • Requires C++ and, on macOS, Objective‑C++.
  • Requires custom CMake to include libraries and linking.

Metadata

Release files for fit-webview-bridge 1.0.0rc5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fit-webview-bridge 1.0.0rc5
File Size Uploaded
fit_webview_bridge-1.0.0rc5.tar.gz 39.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for fit-webview-bridge 1.0.0rc5
File Interpreter ABI Platform
fit_webview_bridge-1.0.0rc5-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
fit_webview_bridge-1.0.0rc5-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
fit_webview_bridge-1.0.0rc5-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 331.0 kB

Release files / fit_webview_bridge-1.0.0rc5.tar.gz

Download URL fit_webview_bridge-1.0.0rc5.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
99319a21ba13d9f873ef1c9e71f63aebd3296e7dc3b3856c88cf995604cd5c2e
BLAKE2b-256 checksum
How to use checksums
c759ee53f5c3039e397fcab7f2ebc0f725a768e7de1ea9f98233294d8ffce5f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / fit_webview_bridge-1.0.0rc5-cp313-cp313-macosx_11_0_arm64.whl

Download URL fit_webview_bridge-1.0.0rc5-cp313-cp313-macosx_11_0_arm64.whl
Size 97.1 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c3d5208a6203d03e4d007fc6b37ade1ba32808dc0a0019610d96bd24c85a3a6f
BLAKE2b-256 checksum
How to use checksums
90ac614480f697010340ab6f19f14abd8dbf62f53a797a7f806d0e542ef21046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / fit_webview_bridge-1.0.0rc5-cp312-cp312-macosx_11_0_arm64.whl

Download URL fit_webview_bridge-1.0.0rc5-cp312-cp312-macosx_11_0_arm64.whl
Size 97.1 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
dbcbeabb935b4f8f542c71b86fe050244afb80a1e70813ae6ca616af4ebbdc11
BLAKE2b-256 checksum
How to use checksums
baebf937aae7700f5e803300714e83a3ed64f5e9710172adc37adf1be904152e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / fit_webview_bridge-1.0.0rc5-cp311-cp311-macosx_11_0_arm64.whl

Download URL fit_webview_bridge-1.0.0rc5-cp311-cp311-macosx_11_0_arm64.whl
Size 97.1 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0f98a5187b9e5bee1588ab752824b464556ffed076a50dc0bb10416f71476485
BLAKE2b-256 checksum
How to use checksums
1620847737b11b46c7ffb2b71d3a43f00e86ff98ebf60d0fa9c46072b533e416
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

1.0.0rc5 This release

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page