Skip to main content

pyecharts-javascripthon

https://api.travis-ci.org/pyecharts/pyecharts-javascripthon.svg?branch=master https://codecov.io/gh/pyecharts/pyecharts-javascripthon/branch/master/graph/badge.svg

Introduction

pyecharts-javascripthon helps translate Python functions into javascript ones. It uses javascripthon and dukpy to blend Python codes into javascript runtime. It supports python 2.7, 3.4, 3.5 and 3.6. It works on Linux, MacOS and Windows platforms.

Sample python function:

def renderItem(params, api):
    values = [api.value(0), api.value(1)]
    coord = api.coord(values)
    size = api.size([1, 1], values)
    return {
        "type": 'sector',
        "shape": {
            "cx": params['coordSys']['cx'],
            "startAngle": coord[3] - size[1] / 2
            }
        }

Compiled python functions:

function renderItem(params, api) {
    var coord, size, values;
    values = [api.value(0), api.value(1)];
    coord = api.coord(values);
    size = api.size([1, 1], values);
    return {"type": "sector", "shape": {"cx": params["coordSys"]["cx"], "startAngle": (coord[3] - (size[1] / 2))}};
}

From Python 2.7 to Python 3.4

Internet access is required because it uses javascripthon api as a free service. Down the line, community sponsorship will be required to cover the running cost of the service.

Because the service is still under development, the default api key and api host are subjected to change. When it does happen please declare these environment variables to continue:

for unix alike systems:

export SCRIPTHON_API_ENDPOINT=http://new_ip_address_or_domain_name/translate
export SCRIPTION_API_TOKEN=new_api_key

for windows systems:

set SCRIPTHON_API_ENDPOINT=http://new_ip_address_or_domain_name/translate
set SCRIPTION_API_TOKEN=new_api_key

Python 3.5 - 3.6

No internet access is required.

Usage

1. Only Python 3.5+ code can be transcompiled. If you use python 2.7 or 3.4, you are obliged to use generic Python codes so that python 2.7 and 3.4 interpreter do not complain.

  1. For browsers DOM object, please visit pyecharts_javascripthon.dom.

API (Dummy objects)

The following are the dummy objects and functions to help you bypass python interpreter.

DOM objects

window, Document, Date, Math, JSON, console, screen

from pyecharts_javascripthon.dom import window    # for window object
from pyecharts_javascripthon.dom import Document  # for Document object
from pyecharts_javascripthon.dom import Date      # for Date object
from pyecharts_javascripthon.dom import Math      # for Math module
from pyecharts_javascripthon.dom import JSON      # for JSON module
from pyecharts_javascripthon.dom import screen    # for screen object
from pyecharts_javascripthon.dom import console   # for console object

Global functions

from pyecharts_javascripthon.dom import alert    # provide alert dialog to the user

You are welcome to submit PRs to add more objects and functions.

Credits

javascripthon: Alberto Berti

Dukpy: Alessandro Molina and Sviatoslav Sydorenko

Installation

You can install pyecharts-javascripthon via pip:

$ pip install pyecharts-javascripthon

or clone it and install it:

$ git clone https://github.com/pyecharts/pyecharts-javascripthon.git
$ cd pyecharts-javascripthon
$ python setup.py install

Change log

0.0.6 - 12.05.2018

  1. Update its dependency on javascripthon to 0.10.

0.0.5 - 04.2018

  1. First release

Metadata

Release files for pyecharts-javascripthon 0.0.6

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

Source distribution (sdist)

Source distribution for pyecharts-javascripthon 0.0.6
File Size Uploaded Provenance Actions
pyecharts-javascripthon-0.0.6.tar.gz 7.4 kB Without provenance Details for pyecharts-javascripthon-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyecharts-javascripthon 0.0.6
File Interpreter ABI Platform Actions
pyecharts_javascripthon-0.0.6-py2.py3-none-any.whl Python 2, Python 3 none any Details for pyecharts_javascripthon-0.0.6-py2.py3-none-any.whl

Total release size: 16.7 kB

Release files / pyecharts-javascripthon-0.0.6.tar.gz

Download URL pyecharts-javascripthon-0.0.6.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d5559266d7545089843e055cb10d5779308a6e4e05641b8eea9ce2132e3d47fa
BLAKE2b-256 checksum
How to use checksums
f18b7734d7a37cc1c197c686957764f97e897288a1dafdd40a8b6c68345c9c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyecharts_javascripthon-0.0.6-py2.py3-none-any.whl

Download URL pyecharts_javascripthon-0.0.6-py2.py3-none-any.whl
Size 9.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5710fe129137c1b8102ece4090e3c3e06c00ae7290ed108e774cb1663313b347
BLAKE2b-256 checksum
How to use checksums
6f6823644a394341fef4cbcb48a3fa4b2816408a13a1fa3281cf9030b2ac2d67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pyecharts-javascripthon 0.0.6

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.

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