brython-pack icon indicating copy to clipboard operation
brython-pack copied to clipboard

Package your Brython/Python package as brython_modules.js

================================================================================ brython-pack - Pack up your python package for Brython.js

.. image:: https://api.travis-ci.org/chfw/brython-pack.svg :target: http://travis-ci.org/chfw/brython-pack

.. image:: https://codecov.io/github/chfw/brython-pack/coverage.png :target: https://codecov.io/github/chfw/brython-pack .. image:: https://badge.fury.io/py/brython-pack.svg :target: https://pypi.org/project/brython-pack

.. image:: https://pepy.tech/badge/brython-pack/month :target: https://pepy.tech/project/brython-pack/month

.. image:: https://img.shields.io/github/stars/chfw/brython-pack.svg?style=social&maxAge=3600&label=Star :target: https://github.com/chfw/brython-pack/stargazers

Introduction

brython-pack packages your Python packages/files into a brython_modules.js. The output is a brython_modules.js_ in your current directory. It is used to pack up pyecharts.js_

.. _brython_modules.js: https://github.com/chfw/pyecharts.js/tree/master/public/js .. _pyecharts.js: https://chfw.github.io/pyecharts.js

Installation

You can install brython-pack via pip:

.. code-block:: bash

$ pip install brython-pack

or clone it and install it:

.. code-block:: bash

$ git clone https://github.com/chfw/brython-pack.git
$ cd brython-pack
$ python setup.py install

Limitation

It cannot collect the package dependency on built-in python modules (the dependencies on brython_stdlib.js) for you. You need to figure it out by yourself and save it in a requirements.txt file. Once you will have the dependency list, the packing step is straight foward.

Usage

::

usage:

   bp brython_stdlib.js requirements.txt your packages and file list

where:

   brython_stdlib.js: should be the accessible path to the lib file.
   requirements.txt: is the hard coded and manually worked out dependencies
                     on brython_stdlib.txt. Not the pip requirements.txt.
   your packages file list: could be given as space separated arguments.

examples:

   bp dependencies/brython_stdlib.js requirements.txt pyecharts editor.py

If you are wondering what the requirements.txt file look like, here is an example requirement.txt <https://github.com/chfw/pyecharts.js/blob/master/bp-requirements.txt>_