Skip to main content

Cross-platform PWA launcher using Chromium

Project description

py-pwa-launcher

Launch Progressive Web Apps from Python

A Python library for launching Progressive Web Apps (PWAs) using Chromium-based browsers. Automatically finds or downloads a Chromium browser and launches PWAs in app mode with all necessary flags.

Features

  • 🚀 Launch PWAs with a single function call
  • 🔍 Auto-detect system Chrome/Edge browsers
  • 📥 Auto-download portable Chromium if needed
  • ⚙️ PWA-optimized flags for installation and features
  • 🔒 Custom profiles for isolated PWA data
  • Check PWA support before launching
  • 🧪 Fully tested with comprehensive test suite

Installation

pip install py-pwa-launcher

Quick Start

Launch a PWA

from pwa_launcher import open_pwa

# Launch a PWA - that's it!
open_pwa("https://weatherlite.app")

Check PWA Support

from pwa_launcher import check_pwa_support

# Check if a URL supports PWA
result = check_pwa_support("https://weatherlite.app")

if result.is_pwa_supported:
    print(f"✓ {result.url} is PWA-ready!")
    print(f"  Manifest: {result.manifest_url}")
    print(f"  Service Worker: {result.service_worker_url}")
else:
    print(f"✗ Not a PWA")
    for error in result.errors:
        print(f"  - {error}")

Launch with Custom Options

from pwa_launcher import open_pwa
from pathlib import Path

# Launch with custom profile and flags
process = open_pwa(
    "https://excalidraw.com",
    user_data_dir=Path("./my_pwa_profile"),
    additional_flags=["--start-maximized"]
)

print(f"Launched PWA (PID: {process.pid})")

API Reference

open_pwa(url, **kwargs)

Launch a PWA using Chromium browser.

Parameters:

  • url (str): URL to open as PWA (required)
  • chromium_path (Path, optional): Path to Chromium executable
  • allow_system (bool, default=True): Allow using system Chrome/Edge
  • allow_download (bool, default=True): Allow downloading portable Chromium
  • install_dir (Path, optional): Directory for portable Chromium
  • user_data_dir (Path, optional): Custom browser profile directory
  • additional_flags (List[str], optional): Extra Chromium flags
  • wait (bool, default=False): Wait for browser to exit

Returns: subprocess.Popen - Browser process

Raises:

  • ChromiumNotFoundError: No browser found
  • ValueError: Invalid URL

check_pwa_support(url, timeout=10)

Check if a URL supports PWA features.

Parameters:

  • url (str): URL to check
  • timeout (int): Request timeout in seconds

Returns: PWACheckResult with:

  • is_pwa_supported (bool): Whether PWA is supported
  • has_manifest (bool): Has web manifest
  • manifest_url (str): URL of manifest file
  • manifest_data (dict): Parsed manifest data
  • has_service_worker (bool): Has service worker
  • service_worker_url (str): URL of service worker
  • has_https (bool): Uses HTTPS
  • errors (list): List of error messages
  • warnings (list): List of warnings

get_chromium_install(**options)

Get a single Chromium browser executable path (tries system → portable → download).

Parameters:

  • allow_system (bool, default=True): Search for system Chrome/Edge
  • allow_download (bool, default=True): Allow downloading portable Chrome
  • install_dir (Path, optional): Directory for portable Chrome
  • force_reinstall (bool, default=False): Force download even if exists

Returns: Path - Path to Chromium executable

Raises: ChromiumNotFoundError - No browser found

get_chromium_installs(**options)

Get all available Chromium browser executable paths.

Parameters:

  • allow_system (bool, default=True): Search for system Chrome/Edge
  • allow_download (bool, default=True): Allow downloading portable Chrome
  • install_dir (Path, optional): Directory for portable Chrome

Returns: List[Path] - List of paths to Chromium executables

Examples

See the examples/ directory for more examples:

  • examples/check_pwa.py - Check PWA support

Command Line Usage

Launch a PWA

python -m pwa_launcher.open_pwa https://weatherlite.app

Check PWA Support

python -m pwa_launcher.pwa_support https://weatherlite.app

How It Works

  1. Get Chromium: Finds system Chrome/Edge or downloads portable Chromium
  2. Build Command: Creates command with --app={url} and PWA flags
  3. Launch: Starts browser in app mode with PWA features enabled

PWA Flags Included

  • --app={url}: Launch in app mode (no browser UI)
  • --enable-features=WebAppInstallation: Enable PWA installation
  • --enable-features=DesktopPWAsTabStrip: Enable tab strip in PWAs
  • --enable-features=FileSystemAccessAPI: Enable file system access
  • --enable-features=NotificationTriggers: Enable notifications
  • --no-default-browser-check: Skip default browser check
  • --no-first-run: Skip first run experience

Development

Setup

# Clone the repository
git clone https://github.com/yourusername/py-pwa-launcher.git
cd py-pwa-launcher

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements-dev.txt

Run Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=pwa_launcher

# Run specific test file
pytest tests/test_open_pwa.py -v

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pwa_launcher-0.1.2.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pwa_launcher-0.1.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pwa_launcher-0.1.2.tar.gz.

File metadata

  • Download URL: pwa_launcher-0.1.2.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pwa_launcher-0.1.2.tar.gz
Algorithm Hash digest
SHA256 af540855cb347d3b44fffeabd24fd997f19f4065213e98570fdec51811eb4dd2
MD5 00611c4846fb1f53d3a9c4a0eeb282e6
BLAKE2b-256 9f233b240e0163fcccee6b886e596c4e7e4fcd4630a0f851d3576ad4de1610b7

See more details on using hashes here.

File details

Details for the file pwa_launcher-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pwa_launcher-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for pwa_launcher-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0b778b5deda574aa98aa862aa79083443bf624890e7271ea5dfccc057bbc95ab
MD5 a44c08c468d522ac8ea61521cc1fb5bf
BLAKE2b-256 3a8a48bf1057edcd7643ee10497ef75d23ca16c11404efd855be2e11a6da956b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page