Skip to main content

brue

write in python, transpile to js, run in browser





Install

using pip(stable)

pip3 install brue

using git(dev)

pip3 install https://github.com/eseunghwan/brue.git



Cli

create project with cli

brue-cli --init [dest]

// example
brue-cli --init ./test2
[output]
extracting files...
brue project initialized in [dest]

run with server

brue-cli --serve [port]

// example
brue-cli --serve 8080
[output]
Serving HTTP on 0.0.0.0 port 8080 (http://0.0.0.0:8080/) ...

build project file to standalone .html and .js

brue-cli --build [dest]

// example
brue-cli --build ./build
[output]
copying public files...
copying asset files...
compiling component files...
...
Compiled file [dest]



Component define

component python file

from brue import brueElement
from brue.decorators import defineElement

@defineElement("app-elm")# register element as [name]
class App(brueElement):
    def __init__(self):
        super().__init__()# must be called

    def created(self):# evalute when component created(initialized)
        print("created")

    def mounted(self):# evalute when componet rendered in html
        print("mounted")

    def render(self):# define render template as html-string
        return """
        <div>
            <div>
                <router-link url="/">Welcome</router-link>
                <router-link url="/counter">Counter</router-link>
                <router-link url="/datagrid">DataGrid</router-link>
            </div>
            <router-view />
        </div>
        """

repeat(for)

...
state = {
    "columns": [ "A", "B", "C", "D" ]
}
...
{repeat(self.state.columns, lambda c: f"<th>{c}</th>")}
...

[expected output]
<th>A</th>
<th>B</th>
<th>C</th>
<th>D</th>

Release files for brue 2021.11.15

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

Source distribution (sdist)

Source distribution for brue 2021.11.15
File Size Uploaded
brue-2021.11.15.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brue 2021.11.15
File Interpreter ABI Platform
brue-2021.11.15-py3-none-any.whl Python 3 none any Details

Total release size: 113.5 kB

Release files / brue-2021.11.15.tar.gz

Download URL brue-2021.11.15.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
da007f2d248af456a01d4859547303a85e66f78834038489fd838bcf94ca0a1d
BLAKE2b-256 checksum
How to use checksums
e868b317b3cd21bfd5c5fc88dcc330495c4598df01330b207291701d28788404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Release files / brue-2021.11.15-py3-none-any.whl

Download URL brue-2021.11.15-py3-none-any.whl
Size 108.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4618c02696aae304369c05df37867a6042d1bfab0c53ec1d1a3262320f6672e
BLAKE2b-256 checksum
How to use checksums
1ec8fd21daded8290240c771a83963b4ed9498dd3c3192e4e5505d802fcd20f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Release history Release notifications | RSS feed

This release

2021.11.15 This release

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