Skip to main content

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:

  1. Clone the repository: git clone https://github.com/cihanuyanik/TypescriptGenerator.git
  2. Install the dependencies for backend: pip install -r requirements.txt
  3. Install the dependencies for frontend: npm install
  4. Run the backend: python main.py
  5. Run the frontend: npm start
  6. Open your browser and go to http://localhost:3000
  7. 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


Download files

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

Source Distribution

pywebchannel-0.2.tar.gz (21.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywebchannel-0.2-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file pywebchannel-0.2.tar.gz.

File metadata

  • Download URL: pywebchannel-0.2.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

Hashes for pywebchannel-0.2.tar.gz
Algorithm Hash digest
SHA256 5c02df3c29774bc71ca881e457aa1b1800d515210f4d75505fed28b730939762
MD5 23f7a83309cea7046f38da03f422cdea
BLAKE2b-256 922456d63bb0592a95be6519d50e48a901ba1c2a44835284c9a6d1c66c218121

See more details on using hashes here.

File details

Details for the file pywebchannel-0.2-py3-none-any.whl.

File metadata

  • Download URL: pywebchannel-0.2-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

Hashes for pywebchannel-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30c9f8602c99375606f8170913421efc14d35ee3d79afa40619b75cb896dbc12
MD5 6963b71c4712a89405d1dd610934b18e
BLAKE2b-256 ace88d4bd222dfd6d41233e91aed5ad61e7fbf4bd6d12a97a40aad9ccb830751

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page