A simplified MVVM framework for Python
Project description
PyMVVM
Simplified MVVM for Python
PyMVVM is a Python package that simplifies the implementation of the Model-View-ViewModel (MVVM) pattern. It provides a set of base classes and utilities to create robust, maintainable, and testable applications.
Features
- Easy-to-use base classes for Model, ViewModel, and View
- Automatic property binding and change notification
- Support for computed properties
- Command pattern implementation for actions
- Asynchronous command support
- State management in ViewModels
- Dependency injection for data services
- Factory function for quick MVVM setup .
Installation
You can install PyMVVM using pip:
Quick Start
Here's a simple example of how to use PyMVVM:
from PyMVVM import create_mvvm, ViewModel, View, computed_property
class UserViewModel(ViewModel):
@computed_property
def display_name(self):
return f"{self.model.name} ({self.model.age})"
class UserView(View):
def update(self):
print(f"User: {self.view_model.display_name}")
# Create MVVM structure
model, vm, view = create_mvvm(
{'name': 'John', 'age': 30},
view_model_class=UserViewModel,
view_class=UserView
)
# Use the MVVM structure
view.update() # Output: User: John (30)
model.name = "Jane"
view.update() # Output: User: Jane (30)
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
pymvvm_design-0.6.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file pymvvm_design-0.6.0.tar.gz
.
File metadata
- Download URL: pymvvm_design-0.6.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f47cdd5d589418307f957f42e35f83879ebd6b63aa055fc20faed46f10bd87 |
|
MD5 | bb2c1390a77599afb4d06e73f3077841 |
|
BLAKE2b-256 | 43d03dc35edd3ae99b8a38ef2af32d1776ca3b7a9ac1566685a244e9e80a28d1 |
File details
Details for the file pymvvm_design-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: pymvvm_design-0.6.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02ba2316eb198cae9fee64ecdce6b0070fbd8ed5dc8b91d7a7010dbf9bd7e681 |
|
MD5 | 811d79df4d6d83cf1576f367eb0ef77e |
|
BLAKE2b-256 | d8fb6da0f4599e0e887295905d04b1efba80eb34a1ff97c8e2b333d787dbbc66 |