Skip to main content

A Python framework that integrates Vue 3 frontend with Python backend using WebSocket

Project description

Pvue - Python + Vue 3 Framework

Pvue is a modern framework that combines Vue 3 frontend with Python WebSocket backend, allowing developers to create desktop applications with ease. It provides a seamless integration between Python business logic and Vue 3 UI, supporting both web and desktop deployment.

License: MIT PyPI version GitHub stars

中文版本 (Chinese Version)

Features

  • Vue 3 + Python WebSocket: Modern frontend with responsive design and real-time communication
  • Multiple Deployment Modes: Web server, Eel desktop app, and PyWebView desktop app
  • Plugin System: Extensible architecture for adding new features
  • Easy Packaging: Support for PyInstaller to create standalone EXE files
  • Responsive Design: Modern UI that works on different screen sizes
  • Scientific Calculator: Built-in example with standard and scientific modes
  • Notepad Application: Example of a simple text editor

Installation

Prerequisites

  • Python 3.7+
  • pip (Python package manager)

Install from PyPI

pip install pvue

Install from Source

# Clone the repository
git clone https://github.com/qeill/pvue.git
cd pvue

# Install dependencies
pip install -r requirements.txt

# Install the package in development mode
pip install -e .

Quick Start

Create a Simple Pvue Application

from pvue.main import PvueApp

# Initialize Pvue app
app = PvueApp()

# Define a Python function that can be called from Vue
def hello(name):
    return f"Hello, {name}!"

# Register the function
app.register_function(hello)

# Start the app
app.run()

Access the Application

After running the script, open your browser and navigate to:

http://localhost:8000

Usage

Web Mode

from pvue.main import PvueApp

app = PvueApp()
app.run(mode='web')  # Default mode

Eel Desktop Mode

from pvue.eel import PvueEelApp

app = PvueEelApp()
app.run()

PyWebView Desktop Mode

from pvue.webview import PvueWebViewApp

app = PvueWebViewApp()
app.run()

Examples

Scientific Calculator

The project includes a fully functional scientific calculator with both standard and scientific modes:

cd test
python scientific_calculator.py

Todo App with Eel

cd examples/eel-todo
python main.py

Todo App with PyWebView

cd examples/webview-todo
python main.py

Project Structure

pvue/
├── backend/           # Python WebSocket server
│   ├── __init__.py
│   └── server.py
├── frontend/          # Vue 3 frontend
│   ├── src/
│   │   ├── components/
│   │   ├── plugins/
│   │   ├── App.vue
│   │   ├── main.js
│   │   └── style.css
│   ├── index.html
│   └── package.json
├── pvue/              # Main package code
│   ├── __init__.py
│   ├── main.py
│   ├── eel.py
│   ├── webview.py
│   └── static/        # Compiled frontend files
├── examples/          # Example applications
│   ├── eel-todo/
│   └── webview-todo/
├── test/              # Test applications
│   └── scientific_calculator.py
├── setup.py           # Package setup
└── README.md          # This file

Architecture

Frontend

  • Vue 3: Modern reactive framework with Composition API
  • WebSocket: Real-time communication with Python backend
  • Plugin System: Extensible architecture for adding features
  • Responsive Design: CSS Grid and Flexbox for layout

Backend

  • Python 3: Business logic implementation
  • WebSocket Server: Using websockets library for real-time communication
  • Multiple Modes: Web server, Eel, and PyWebView integration
  • Function Registration: Easy registration of Python functions to be called from Vue

Plugin Development

Pvue includes a plugin system that allows you to extend the framework functionality. Refer to the PLUGIN_DEVELOPMENT.md for more information.

Packaging Applications

Create a Standalone EXE with PyInstaller

pyinstaller --onefile --windowed your_app.py

For more detailed packaging instructions, refer to the PACKAGING_GUIDE.md.

Configuration

Server Configuration

app = PvueApp(
    host='localhost',
    port=8000,
    static_dir='path/to/static/files'
)

Frontend Configuration

Modify the Vue app in frontend/src/App.vue to customize the UI and functionality.

Development

Build the Frontend

cd frontend
npm install
npm run build

Run Development Server

cd frontend
npm run dev

Run Tests

# Run backend tests
python -m pytest

# Run frontend tests
cd frontend
npm test

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Acknowledgments

  • Vue 3 for the modern frontend framework
  • Python for the powerful backend language
  • Eel and PyWebView for desktop integration
  • websockets library for real-time communication

Support

If you have any questions or issues, please open an issue on GitHub or contact the maintainers.


Happy Coding! 🚀

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

pvue-0.1.3.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

pvue-0.1.3-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file pvue-0.1.3.tar.gz.

File metadata

  • Download URL: pvue-0.1.3.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pvue-0.1.3.tar.gz
Algorithm Hash digest
SHA256 97a460f40fb62ba2d92134fad90235fdf2320a91ad8d810a960ad007dc2e5ae7
MD5 476f682d9bac85d3956d61fde5567b6d
BLAKE2b-256 43f150cbfed0fac4a630ec01aaa51d0ae61ab93a2a2aafe5a79f1ecc7ca49e4e

See more details on using hashes here.

File details

Details for the file pvue-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pvue-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for pvue-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 130f542113e2446262671c11cd9a36f7e32b7e33f8d2ff5194b9e386990e66af
MD5 6054c70c8cb2026f665a9c95ac770905
BLAKE2b-256 24f442f03f246120f34e80f2b5a07dcc7a09d1034e196f7c876536aee54d354c

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