Skip to main content

modern web gui using python

Project description


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>

Project details


Download files

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

Source Distribution

brue-2021.11.15.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

brue-2021.11.15-py3-none-any.whl (108.4 kB view details)

Uploaded Python 3

File details

Details for the file brue-2021.11.15.tar.gz.

File metadata

  • Download URL: brue-2021.11.15.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for brue-2021.11.15.tar.gz
Algorithm Hash digest
SHA256 da007f2d248af456a01d4859547303a85e66f78834038489fd838bcf94ca0a1d
MD5 d1b990a96589214b6f97c729eeab374f
BLAKE2b-256 e868b317b3cd21bfd5c5fc88dcc330495c4598df01330b207291701d28788404

See more details on using hashes here.

File details

Details for the file brue-2021.11.15-py3-none-any.whl.

File metadata

  • Download URL: brue-2021.11.15-py3-none-any.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for brue-2021.11.15-py3-none-any.whl
Algorithm Hash digest
SHA256 b4618c02696aae304369c05df37867a6042d1bfab0c53ec1d1a3262320f6672e
MD5 359be38fb67d008eb28fbc44db2b02c0
BLAKE2b-256 1ec8fd21daded8290240c771a83963b4ed9498dd3c3192e4e5505d802fcd20f4

See more details on using hashes here.

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