Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ToUI is a Python framework for creating user interfaces (web apps and desktop apps) from HTML code easily. It allows you to call your Python functions from HTML. No JavaScript knowledge is required, but some knowledge of HTML is usually required.
Follow the link below to preview a live app created using ToUI:
https://toui-92bd1594dbed.herokuapp.com/
To download this template and customize to create your own web app, go to this section.
Run this command:
pip install toui
To install only the required dependencies, run these commands:
pip install --no-deps toui
toui --minimal-reqs
Import the required classes:
from toui import Website, Page
Create a Website
object:
app = Website(name=__name__, assets_folder="path/to/assets_folder", secret_key="some secret key")
Create a Page
and add it to the website:
main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)
Run the app:
if __name__ == "__main__":
app.run()
The complete code:
from toui import Website, Page
app = Website(name=__name__, assets_folder="path/to/assets_folder",
secret_key="some secret key")
main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)
if __name__ == "__main__":
app.run()
Creating a desktop app is similar to creating a website. Only replace Website
class with
DesktopApp
:
from toui import DesktopApp, Page
app = DesktopApp(name="MyApp", assets_folder="path/to/assets_folder")
main_page = Page(html_file="path/to/html", url="/")
app.add_pages(main_page)
if __name__ == "__main__":
app.run()
To start with a basic template for a ToUI project. Run the command:
toui init
You can find the same template here.
To start with a full template that includes a Home page, an About page, Contact page, a simple Calculator page, a Sign-in page (including Google sign-in), a simple Dashboard, and more, run the following command:
toui init --full
You can also find the full template here. Additionally, you can find a live preview of the template in this link: https://toui-92bd1594dbed.herokuapp.com/
Check this example and other examples to learn how to make the website / desktop app responsive.
You can deploy the web app the same way you deploy a Flask
app (How to deploy Flask app).
The only difference is that you need to access the Flask
object first:
app = Website(__name__)
flask_app = app.flask_app
Then you need to deploy the flask_app
and not the app
.
ToUI welcomes contribution, small or big. For anyone who wants to contribute please check the contribution page.
Copyrights (c) 2023 Mubarak Almehairbi. This package is licensed under the MIT license.
You can find the documentation in this link: ToUI docs.
FAQs
Creates user interfaces (websites and desktop apps) from HTML easily
We found that toui demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.