Metadata-Version: 2.1
Name: pywebchannel
Version: 0.1
Summary: 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-URL: Homepage, https://github.com/cihanuyanik/pywebchannel
Project-URL: Issues, https://github.com/cihanuyanik/pywebchannel/issues
Author-email: Cihan Uyanik <cihanuyanik34@gmail.com>
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Requires-Dist: pydantic
Requires-Dist: pyside6
Description-Content-Type: text/markdown

# 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](LICENSE) file for details.

## Credits 🙏

This project was inspired by the following sources:

- [QWebChannel](https://doc.qt.io/qt-5/qwebchannel.html) - a Qt module that enables seamless integration of C++ and
  HTML/JavaScript.
- [PySide6](https://www.qt.io/qt-for-python) - a Python binding of the cross-platform GUI toolkit Qt.
- [Solid](https://www.solidjs.com/) - a declarative JavaScript library for building user interfaces.
- [TypeScript](https://www.typescriptlang.org/) - 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. 😊