py-pwa-launcher
Launch Progressive Web Apps from Python
A Python library for launching Progressive Web Apps (PWAs) using Chromium-based browsers. Automatically detects installed Chromium browsers and launches PWAs in app mode with all necessary flags.
PyPi Stats:
Features
- 🚀 Launch PWAs with a single function call
- 🔍 Auto-detect system Chromium-based browsers (Chrome, Edge, Brave, Vivaldi, Opera, Arc)
- ⚙️ PWA-optimized flags for installation and features
- 🔒 Custom profiles for isolated PWA data
- ✅ Check PWA support before launching
- 🧪 Fully tested with comprehensive test suite
- 🌍 Cross-platform support (Windows, macOS, Linux)
Installation
pip install pwa-launcher
Requirements: You need a Chromium-based browser installed on your system:
- Google Chrome
- Microsoft Edge
- Brave
- Vivaldi
- Opera
- Arc (macOS)
- Chromium
The library will automatically detect any of these browsers.
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})")
Keep Process Alive
By default, each PWA runs in an isolated profile to keep the process alive:
from pwa_launcher import open_pwa
# Auto-generates isolated profile - process stays alive!
process = open_pwa("https://example.com")
print(f"PID: {process.pid}") # Process won't exit immediately
# To disable auto-profile (may cause process to exit if Chrome is already running):
process = open_pwa("https://example.com", auto_profile=False)
Why this matters: When Chrome reuses an existing profile, it hands off to an already-running Chrome instance and the new process exits immediately. With auto_profile=True (default), each PWA gets its own isolated profile, keeping the process running.
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 (auto-detected if None)user_data_dir(Path, optional): Custom browser profile directoryadditional_flags(List[str], optional): Extra Chromium flagswait(bool, default=False): Wait for browser to exitauto_profile(bool, default=False): Auto-generate isolated profile (keeps process alive)
Returns: subprocess.Popen - Browser process
Raises:
ChromiumNotFoundError: No browser foundValueError: Invalid URL
Note: When auto_profile=True, each PWA gets its own isolated profile based on the URL hostname. This prevents Chrome from handing off to an existing instance and keeps your process alive.
check_pwa_support(url, timeout=10)
Check if a URL supports PWA features.
Parameters:
url(str): URL to checktimeout(int): Request timeout in seconds
Returns: PWACheckResult with:
is_pwa_supported(bool): Whether PWA is supportedhas_manifest(bool): Has web manifestmanifest_url(str): URL of manifest filemanifest_data(dict): Parsed manifest datahas_service_worker(bool): Has service workerservice_worker_url(str): URL of service workerhas_https(bool): Uses HTTPSerrors(list): List of error messageswarnings(list): List of warnings
get_chromium_install()
Get a Chromium browser executable path from system-installed browsers.
Returns: Path - Path to Chromium executable
Raises: ChromiumNotFoundError - No browser found
get_chromium_installs()
Get all available Chromium browser executable paths from system.
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
- Detect Browser: Searches for installed Chromium-based browsers on your system
- Build Command: Creates command with
--app={url}and PWA flags - 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--disable-infobars: Remove automation banners- Linux only:
--no-sandbox,--disable-gpu,--disable-dev-shm-usage
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.
Metadata
Release files for pwa-launcher 1.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pwa_launcher-1.2.3.tar.gz | 17.9 kB | Without provenance | Details for pwa_launcher-1.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pwa_launcher-1.2.3-py3-none-any.whl | Python 3 | none | any | Details for pwa_launcher-1.2.3-py3-none-any.whl |
Total release size: 32.3 kB
Release files / pwa_launcher-1.2.3.tar.gz
| Download URL | pwa_launcher-1.2.3.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e79df40bbf7868218047d60d03f89a7ba958cfe5ff8b24c63842696c8e6a3019
|
|
BLAKE2b-256 checksum How to use checksums |
4661ba60605e1b87629d038c709c091524fb01f4d57e2b9ce3390352f45eb46d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / pwa_launcher-1.2.3-py3-none-any.whl
| Download URL | pwa_launcher-1.2.3-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b308dd94e810b00d37133eeb1ad4c7aa0bd35befcb49f397ae46c770485c8a51
|
|
BLAKE2b-256 checksum How to use checksums |
8a319bf0542fa54765309013479f99399324f3597fb742267eecf310bc1a5bf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for pwa-launcher 1.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.