{"id":20733482,"url":"https://github.com/un-gcpds/radiant-framework","last_synced_at":"2025-07-15T16:06:21.608Z","repository":{"id":108795292,"uuid":"325404229","full_name":"UN-GCPDS/radiant-framework","owner":"UN-GCPDS","description":"A Brython/PyScript Framework for Web Apps development.","archived":false,"fork":false,"pushed_at":"2023-01-18T14:40:03.000Z","size":75643,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T22:55:42.292Z","etag":null,"topics":["brython","pyscript","python","tornado"],"latest_commit_sha":null,"homepage":"https://radiant-framework.readthedocs.io/en/latest/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UN-GCPDS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-29T22:58:37.000Z","updated_at":"2022-12-08T12:41:46.000Z","dependencies_parsed_at":"2023-06-05T05:30:24.637Z","dependency_job_id":null,"html_url":"https://github.com/UN-GCPDS/radiant-framework","commit_stats":null,"previous_names":["un-gcpds/brython-radiant"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/UN-GCPDS/radiant-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UN-GCPDS%2Fradiant-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UN-GCPDS%2Fradiant-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UN-GCPDS%2Fradiant-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UN-GCPDS%2Fradiant-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UN-GCPDS","download_url":"https://codeload.github.com/UN-GCPDS/radiant-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UN-GCPDS%2Fradiant-framework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265444547,"owners_count":23766431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["brython","pyscript","python","tornado"],"created_at":"2024-11-17T05:25:40.434Z","updated_at":"2025-07-15T16:06:21.580Z","avatar_url":"https://github.com/UN-GCPDS.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Radiant Framework\n\nA Brython/PyScript Framework for Web Apps development.\n\n![GitHub top language](https://img.shields.io/github/languages/top/un-gcpds/brython-radiant?)\n![PyPI - License](https://img.shields.io/pypi/l/radiant?)\n![PyPI](https://img.shields.io/pypi/v/radiant?)\n![PyPI - Status](https://img.shields.io/pypi/status/radiant?)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/radiant?)\n![GitHub last commit](https://img.shields.io/github/last-commit/un-gcpds/brython-radiant?)\n![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/UN-GCPDS/brython-radiant?)\n[![Documentation Status](https://readthedocs.org/projects/radiant/badge/?version=latest)](https://radiant-framework.readthedocs.io/en/latest/?badge=latest)\n\nRadiant is a [Brython](https://brython.info/) and [PyScript](https://pyscript.net/) framework for the quick development of web apps using _Python_ syntax, so there is no need to care about (if you don’t want) HTML, CSS, or JavaScript. This is basically a set of scripts that allows the same file run from _Python_ and _Brython_/_PyScript_, when is running under _Python_ a [Tornado](https://www.tornadoweb.org/) server is created and configure the local path for serving static files, at the same time a custom HTML template is configured at runtime to import the same script, this time under _Brython_/_PyScript_.\n\n## Instalation\n\n\n```python\npip install radiant\n```\n\n## Brython: bare minimum\n\n\n```python\n#!bryhton\n\nfrom radiant.server import RadiantAPI\nfrom browser import document, html\n\n\nclass BareMinimum(RadiantAPI):\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\"\"\"\n        super().__init__(*args, **kwargs)\n        document.select_one('body') \u003c= html.H1('Radiant-Framework')\n\n\nif __name__ == '__main__':\n    BareMinimum()\n```\n\n## PyScript: bare minimum\n\nThis example use a ```requirements.txt``` file to install dependencies.\n\n\n```python\n#requirements.txt\n\nnumpy\nmatplotlib\n```\n\n\n```python\n#!pyscript\n\nimport numpy as np\nfrom matplotlib import pyplot as plt\nfrom radiant.server import RadiantAPI\nimport js\n\n\nclass BareMinimum(RadiantAPI):\n\n    def __init__(self):\n        print('Radiant-Framework')\n        self.plot()\n\n    def plot(self):\n        \"\"\"\"\"\"\n        fig = plt.figure()\n        ax = fig.add_subplot(111)\n        x = np.linspace(0, 10, 1000)\n        y = np.sin(x)\n        ax.plot(x, y)\n        js.document.body.prepend(self.fig2img(fig))\n\n\nif __name__ == '__main__':\n    BareMinimum()\n```\n\n## Brython + PyScript\n\n\n```python\n#!brython\n\nfrom radiant.server import RadiantAPI, pyscript\nfrom browser import document, html\n\n\nclass BareMinimum(RadiantAPI):\n\n    def __init__(self, *args, **kwargs):\n        \"\"\"\"\"\"\n        super().__init__(*args, **kwargs)\n        document.select_one('body') \u003c= html.H1('Radiant-Framework')\n\n        document.select_one('body') \u003c= html.DIV(id='mpl')\n        self.plot_sin(f=5)  # will render on #mpl every time\n\n        document.select_one('body') \u003c= self.plot_sinc(f=1)  \n\n        \n    # will render on #mpl every time\n    @pyscript(output='mpl')\n    def plot_sin(self, f=10):\n        \"\"\"\"\"\"\n        import numpy as np\n        from matplotlib import pyplot as plt\n\n        fig = plt.figure()\n        ax = fig.add_subplot(111)\n        x = np.linspace(0, 1, 1000)\n        y = np.sin(2 * np.pi * f * x)\n        ax.plot(x, y)\n\n        return fig\n\n    \n    # will return the image object\n    @pyscript()\n    def plot_sinc(self, f):\n        \"\"\"\"\"\"\n        import numpy as np\n        from matplotlib import pyplot as plt\n\n        fig = plt.figure()\n        ax = fig.add_subplot(111)\n        x = np.linspace(0, 10, 1000)\n        y = np.sin(2 * np.pi * f * x)\n        ax.plot(x, y, color='C1')\n\n        return fig\n\n\nif __name__ == '__main__':\n    BareMinimum()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun-gcpds%2Fradiant-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fun-gcpds%2Fradiant-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fun-gcpds%2Fradiant-framework/lists"}