Metadata-Version: 2.4
Name: webview-proc
Version: 0.1.0rc6
Summary: A Python package for running pywebview windows in a separate thread, providing a synchronous API for stable and isolated webview management.
Project-URL: Homepage, https://github.com/10x-concepts/webview-proc
Project-URL: Repository, https://github.com/10x-concepts/webview-proc
Project-URL: Issues, https://github.com/10x-concepts/webview-proc/issues
Project-URL: Documentation, https://github.com/10x-concepts/webview-proc#readme
Author-email: Ilya Pevzner <iap@10xconcepts.com>
License: MIT License
License-File: LICENSE
Keywords: api,gui,pywebview,subprocess,synchronous
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.9
Requires-Dist: pywebview>=6.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.14; extra == 'dev'
Requires-Dist: uv>=0.9; extra == 'dev'
Description-Content-Type: text/markdown

# webview-proc

`webview-proc` is a Python package that simplifies running `pywebview` windows in a separate thread, enhancing stability and performance for desktop applications by isolating webview operations from the main thread. The `WebViewProcess` class provides a synchronous API for creating, managing, and communicating with webview windows, supporting operations like opening, closing, resizing, maximizing, toggling fullscreen, setting titles, handling file dialogs, and evaluating JavaScript. Ideal for hybrid applications combining web technologies with native interfaces, `webview-proc` offers a lightweight and extensible solution for Python developers.

## Features
- Run `pywebview` windows in a separate thread for crash isolation.
- Synchronous `WebViewProcess` class for simple, blocking operations.
- Comprehensive API for window operations: open, close, resize, maximize, fullscreen, set title, file dialogs, and JavaScript evaluation.
- Thread-safe communication for reliable control.
- Cross-platform support (Windows, macOS, Linux) with flexible `pywebview` GUI backends (e.g., Qt, GTK, Cocoa).
- Extensible for other webview engines (e.g., QtWebEngine, CEF).

## Installation
```bash
pip install webview-proc
```

## Basic Usage
```python
from webview_proc import WebViewProcess

# Create a webview process
webview = WebViewProcess(
    url="http://localhost:8000",
    title="My App",
    width=800,
    height=600,
    icon_path="path/to/icon.png",
)

# Start the webview in a separate thread
webview.start()

# Perform window operations
webview.set_title("New Title")
webview.resize(1000, 700)
webview.toggle_fullscreen()

# Open a file dialog
files = webview.pick_file(file_types=["pdf", "png"], multiple=True)

# Close the window
webview.close()

# Wait for the thread to terminate
webview.join()
```

## Why webview-proc?
`webview-proc` addresses the need for stable and isolated webview management in Python applications. By running `pywebview` windows in a separate thread, it prevents crashes from affecting the main application. The synchronous `WebViewProcess` class is ideal for scripts and applications requiring simple, blocking operations, and it integrates seamlessly with web servers (e.g., FastAPI). The package handles platform-specific quirks (e.g., main-thread requirements on macOS), making it suitable for desktop and hybrid web apps.

## Contributing
Contributions are welcome! Check out our [Contributing Guidelines](https://github.com/10x-concepts/webview-proc/blob/main/CONTRIBUTING.md) and [Issue Tracker](https://github.com/10x-concepts/webview-proc/issues) to get started.

## License
MIT License