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.

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/yourusername/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.0.tar.gz (18.5 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.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pvue-0.1.0.tar.gz
  • Upload date:
  • Size: 18.5 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.0.tar.gz
Algorithm Hash digest
SHA256 8d3e8650e2ddca04f66aa4b90cba944256326a51d2882053443b00d95bdb4f69
MD5 9f07f59e312b526a21b8caf64091e107
BLAKE2b-256 5076885b9fc71eadd43687a35b753778801ea21bfb70d986035c539097891be4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pvue-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3bdf0c8d3c3a6418c059cd4fde197c947a50e494c28de5d0f0f4316320c90fe
MD5 eeda384043ac5b769c80c7e096057585
BLAKE2b-256 03478522294344e1d57e92a49d37eb187013bfcefd78585141039a8964728635

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