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.4.tar.gz (76.1 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.4-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pywebchannel-0.4.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for pywebchannel-0.4.tar.gz
Algorithm Hash digest
SHA256 e787413359b3fd81e84eb048149358dc23d417fa8572e5f1f1f4a9da98f4a036
MD5 f25e273411f99b70325f1ef07a5b8334
BLAKE2b-256 84193f2ed99f4a1acb5e5cfb9711dfbe88d2348c8dc40a723840315884da166d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pywebchannel-0.4-py3-none-any.whl
  • Upload date:
  • Size: 29.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 56610b760ddb0489f032a4e835cba712a2c1228a20245d321b5119935920f080
MD5 2c22195f3c03f464bfe11a4b5c929b6e
BLAKE2b-256 514fc99d06215b624f6efb1fb934b0695c9b75038539b25c57477eec2f01d1a4

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