This repository generates auto typescript files for QWebChannel python local backend. It enables you to build a stunning UI for your python project with web technologies.
Project description
TypescriptGenerator 🚀
TypescriptGenerator is a tool that automatically generates TypeScript files for QWebChannel Python local backend. It allows you to create a stunning UI for your Python project using web technologies such as HTML, CSS, and JavaScript.
With TypescriptGenerator, you can:
- Write your backend logic in Python and use Qt (PySide6) for communication.
- Use QWebChannel to communicate with the web frontend and expose your Python objects and methods.
- Write your frontend UI in any web framework of your choice, such as vanilla JS, React, Solid, Vue, etc.
- Enjoy the benefits of TypeScript, such as type safety, code completion, and error detection.
- Save time and effort by automatically generating TypeScript interfaces from your Python code.
This repository contains two projects: a backend and a frontend.
Backend 🐍
The backend is a regular Python project powered by Qt (PySide6). It uses QWebChannel to communicate with the web frontend.
TypeScript Generator ⚙️
The TypeScript Generator is a library and a file watcher that translates Python code to TypeScript interfaces. This enables safe and easy communication between your Python backend and your desired frontend (vanilla JS, React, Solid, Vue, etc.).
To use the TypeScript Generator, run the ts_generator.py script and specify the folders that contain the Python files
you would like watch for auto-instant conversion.
Frontend 💻
The frontend is a web application that interacts with the backend. It uses QWebChannel to send and receive data from the
Python code. Note that The QWebChannel API (written in api/qwebchannel/index.js)has been updated to support
async/await syntax.
The frontend is built with Solid, a declarative JavaScript library for creating user interfaces. The controllers and
models are automatically generated by the ts_generator.py script located in the backend project.
How to Run 🏃♂️
To run the project, follow these steps:
- Clone the repository:
git clone https://github.com/cihanuyanik/TypescriptGenerator.git - Install the dependencies for backend:
pip install -r requirements.txt - Install the dependencies for frontend:
npm install - Run the backend:
python main.py - Run the frontend:
npm start - Open your browser and go to
http://localhost:3000 - You can watch your terminal for python backend and browser console for information
How to Contribute 🙌
If you want to contribute to this project, you are more than welcome. Here are some ways you can help:
- Report any bugs or issues you find.
- Suggest new features or improvements.
- Submit pull requests with your code changes.
- Share your feedback or suggestions.
License 📄
This project is licensed under the MIT License. See the LICENSE file for details.
Credits 🙏
This project was inspired by the following sources:
- QWebChannel - a Qt module that enables seamless integration of C++ and HTML/JavaScript.
- PySide6 - a Python binding of the cross-platform GUI toolkit Qt.
- Solid - a declarative JavaScript library for building user interfaces.
- TypeScript - a superset of JavaScript that adds optional types.
Thank you for your interest in TypescriptGenerator. I hope you enjoy using it as much as I enjoyed creating it. 😊
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pywebchannel-0.3.tar.gz.
File metadata
- Download URL: pywebchannel-0.3.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ace98b01426c3ffbfaab38bf8883b81b16d3a6c3a7f0385bd314ac867a5ec15
|
|
| MD5 |
495ee5fec92f9f5dbec29c940a2769ae
|
|
| BLAKE2b-256 |
441ed808e81bded8693b0d2ca60d96ef17abca9b626604a2f18bafbb0cce81ec
|
File details
Details for the file pywebchannel-0.3-py3-none-any.whl.
File metadata
- Download URL: pywebchannel-0.3-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c7349fbc9a7d92d1373d59bb4e576f745830fff31719a5995704efb976add9a
|
|
| MD5 |
1d1e6170434cf970085590a5d91cfae8
|
|
| BLAKE2b-256 |
c9fdafd112775c6bace7b0b5647c9d9174eed37b0e871cd28f1fbb57ba21dc2a
|