Skip to main content

No project description provided

Project description

PyWry Web Viewer

Easily create HTML webviewers in python utilizing the wry library. Unlike many HTML viewers that exist for Python - Pywry allows you to run javacsript. PyWry is also a ~2mb footprint for Mac and Windows - Linux will require a few more libraries which are listed below.

Please note: this library is currently in early alpha and is NOT ready for production use.

Installation


PyWry is available on PyPI and can be installed with pip:

pip install pywry

For development, you can install from source with the following steps:

  • Clone the repository: git clone https://github.com/OpenBB-finance/pywry.git
  • Install rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Create a virtual environment: python -m venv venv
  • Acitvate the environment: source venv/bin/activate (Unix) or venv\Scripts\activate (Windows)
  • Install dependencies: pip install .[dev]
  • Build the pip package: maturin build
  • Install the package: pip install [file path from above] --force-reinstall

Usage

>>> from pywry import PyWry
>>> handler = PyWry()
>>> handler.send_html("<h1>Welcome to plotting in PyWry</h1>")
>>> handler.start()

Arguments

Argument Description Default
html_str The HTML string to display in the webview None
html_path The path to the HTML file to display in the webview None
title The title of the webview PyWry

Platform-specific notes

All platforms use TAO to build the window, and wry re-exports it as an application module. Here is the underlying web engine each platform uses, and some dependencies you might need to install.

Linux

Tao uses gtk-rs and its related libraries for window creation and wry also needs WebKitGTK for WebView. So please make sure the following packages are installed:

Arch Linux / Manjaro

sudo pacman -S webkit2gtk

Debian / Ubuntu

sudo apt install libwebkit2gtk-4.0-dev

Fedora / CentOS / AlmaLinux

sudo dnf install gtk3-devel webkit2gtk3-devel

macOS

WebKit is native to macOS, so no additional dependencies are needed.

Windows

WebView2 provided by Microsoft Edge Chromium is used. So wry supports Windows 7, 8, 10 and 11.

Troubleshooting

Linux

"/lib/x86_64-linux-gnu/libgio-2.0.so.0: undefined symbol: g_module_open_full"

This is a known issue with the gio library. You can fix it by installing the libglib2.0-dev package.

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

pywry-0.4.9.tar.gz (38.4 kB view hashes)

Uploaded Source

Built Distributions

pywry-0.4.9-cp311-none-win_amd64.whl (940.9 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

pywry-0.4.9-cp311-cp311-manylinux_2_28_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

pywry-0.4.9-cp311-cp311-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.3 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

pywry-0.4.9-cp310-none-win_amd64.whl (940.9 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

pywry-0.4.9-cp310-cp310-manylinux_2_28_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

pywry-0.4.9-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.3 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

pywry-0.4.9-cp39-none-win_amd64.whl (941.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

pywry-0.4.9-cp39-cp39-manylinux_2_28_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

pywry-0.4.9-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.3 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

pywry-0.4.9-cp38-none-win_amd64.whl (940.1 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

pywry-0.4.9-cp38-cp38-manylinux_2_28_x86_64.whl (2.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

pywry-0.4.9-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.3 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

Supported by

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