Skip to main content

HTMLViewer

PyPI version shields.io PyPI license

Table viewer for relational databases, without using HandsOnTable.

Actually, any list of JSON-serializable dictionaries can be viewed.

This is the remake of pyhandsontable.

Installation

pip install htmlviewer

Usage

In Jupyter Notebook,

>>> from htmlviewer import PagedViewer
>>> viewer = PagedViewer(LIST_OF_RECORDS, **kwargs)
>>> viewer
'A table is shown on Jupyter Notebook.'
>>> viewer.view(-1)
'The last page is shown.'
>>> viewer.previous()
'The previous page (i-1) is shown.'
>>> viewer.next()
'The next page (i+1) is shown.

Acceptable kwargs are,

{
    'maxColWidth': 200,  # Maximum column width for all columns.
    'minColWidth': '8em',
    'maxRowHeight': 500,  # Maximum row height for all rows.,
    'colWidth': {
        'imageField': 500
    },
    'renderer': {
        'imageField': 'html'  # Set the field to allow HTML.
    }
    'rowHeader': 'id'  # Selecting a custom column to be the first row, aka rowHeader.
}

Embedding images, markdown and HTML.

This can be done in Python side, by converting everything to HTML. Just use any markdown for Python library.

from markdown import markdown
import base64
image_html = f'<img src="{image_url}" width=100 />'
image_html2 = f'<img src="data:image/png;base64,{base64.b64encode(image_bytes).decode()}" />'
markdown_html = markdown(markdown_raw)

Any then,

PagedViewer(LIST_OF_RECORDS, renderers={
    "image_field": "html",
    "html_field": "html",
    "markdown_field": "html"
})

Screenshots

0.png

Related projects

  • pyhandsontable - View a list of JSON-serializable dictionaries or a 2-D array, in HandsOnTable, in Jupyter Notebook.

Metadata

Release files for htmlviewer 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmlviewer 0.1.7
File Size Uploaded
htmlviewer-0.1.7.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for htmlviewer 0.1.7
File Interpreter ABI Platform
htmlviewer-0.1.7-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 31.7 kB

Release files / htmlviewer-0.1.7.tar.gz

Download URL htmlviewer-0.1.7.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
035cba8a64218d568587b6b9a347a1e1b0ab640fc9cb156f68e1a7d02fa40dcf
BLAKE2b-256 checksum
How to use checksums
bcc864a2800e4c7cf5643b80d6ff800ce54452f0a62fa89756dac2a35cde40ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

Release files / htmlviewer-0.1.7-py2.py3-none-any.whl

Download URL htmlviewer-0.1.7-py2.py3-none-any.whl
Size 22.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
89bbc818a14e491527412abbb7a03423a9dde8dbebd22a76e0d7a4b775215901
BLAKE2b-256 checksum
How to use checksums
4c84419d0ad2840ad61825a9ffda79e35fcf00505f8c7552e593394d9ded590b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.11.5 CPython/3.7.0 Darwin/17.7.0

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page