Skip to main content

Invoke macOS applications to view files

Project description

Invoke native applications to view files

PyPI Python 3.10 Python 3.11 Build Status

Invoke native applications to view and render data from files.

Features:

  • Uses Dash to render Excel, CSV and TSV files.
  • Render PDF and HTML in the default web browser.

Features on macOS:

  • Default web browser used for HTML, Preview.app used for PDF files.
  • Resize the window and a per display basis.
  • Go to a specified page in Preview.app.
  • Multiple file rendering in browser tabs.

The features on macOS are needed for other operating systems.

Usage

Create a configuration file with the dimensions of each of the screens you work with and where you want Preview.app to be displayed. You can validate these configurations by having the application echo them back at you:

$ rend config

Command Line

Invoke the application to show the file and display it:

$ rend example.pdf

See the configuration file example.

From Python

The package is designed to be easy invoke from Python as well (note the parenthesis needed to make the instance):

from zensols.rend import ApplicationFactory

if (__name__ == '__main__'):
    app = ApplicationFactory().get_instance()
    app('test-resources/sample.pdf')

Pandas DataFrames can be rendered using the browser API (note the lack of parenthesis as it is called as a class method):

from zensols.rend import BrowserManager, ApplicationFactory
import pandas as pd

if (__name__ == '__main__'):
    mng: BrowserManager = ApplicationFactory.get_browser_manager()
    url = 'https://raw.githubusercontent.com/scpike/us-state-county-zip/master/geo-data.csv'
    df = pd.read_csv(url)
    mng.show(df)

Obtaining

The easiest way to install the command line program is via the pip installer:

pip3 install zensols.rend

Binaries are also available on pypi.

Documentation

See the full documentation. The API reference is also available.

Contributing

Currently the more advanced features are only available on macOS. However, the API is written to easily add other operating systems as plugins. If you would like to write one for other operating systems, please contact and/or submit a pull request.

Changelog

An extensive changelog is available here.

Community

Please star this repository and let me know how and where you use this API. Contributions as pull requests, feedback and any input is welcome.

License

MIT License

Copyright (c) 2022 - 2023 Paul Landes

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

zensols.rend-1.1.1-py3-none-any.whl (24.3 kB view hashes)

Uploaded Python 3

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