Skip to main content

Brython Framework

Project description

Brython-Radiant

A Brython Framework for Web Apps development.

GitHub top language PyPI - License PyPI PyPI - Status PyPI - Python Version GitHub last commit CodeFactor Grade Documentation Status

Radiant is a Brython framework for the quick development of web apps wuth pure Python/Brython syntax which means that there is no need to care about (if you don't want) HTML, CSS, or Javascript. Run over Tornado servers and includes support to Websockets, Python Scripts and MDC.

Instalation

pip install radiant

Usage

# Radiant modules
from radiant.server import RadiantAPI

# Brython modules
from browser import document, html  # This modules are faked after `radiant` inport

# Main class inheriting RadiantAPI
class BareMinimum(RadiantAPI):

    # Constructor 
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
    
        #-----------------------------------------------------------
        # Brython code (finally)
        document.select_one('body') <= html.H1('Hello World')
        #
        # ...all your brython code
        #-----------------------------------------------------------

# Run server
if __name__ == '__main__':
    BareMinimum()
# Radiant modules
from radiant.server import RadiantAPI, RadiantServer  # import RadiantServer for advance options

from browser import document, html

# Main class inheriting RadiantAPI
class BareMinimum(RadiantAPI):

    def __init__(self, *args, **kwargs):
        """"""
        super().__init__(*args, **kwargs)

        #-----------------------------------------------------------
        # Brython code
        document.select_one('body') <= html.H1('Hello World')
        #
        # ...all your brython code
        #-----------------------------------------------------------
        
if __name__ == '__main__':
    # Advance options
    RadiantServer('BareMinimum',
                  host='localhost',
                  port=5000,
                  brython_version='3.9.1',
                  debug_level=0,
                  )

How to works

This is basically a set of scripts that allows the same file run from Python and Brython, when is running under Python a Tornado server is created and configure the local path for serving static files, and a custom HTML template is configured in runtime to import the same script, this time under Brython, is very simple.

Download files

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

Source Distribution

radiant-3.3.2.tar.gz (8.4 MB view hashes)

Uploaded Source

Built Distribution

radiant-3.3.2-py3-none-any.whl (8.5 MB view hashes)

Uploaded Python 3

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