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.7.0.tar.gz
(3.8 kB
view details)
Built Distribution
File details
Details for the file pymvvm_design-0.7.0.tar.gz
.
File metadata
- Download URL: pymvvm_design-0.7.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 | d385a0f160561d6a1bce65fb21c1b9021f3b93b56a5ad3a7bf2f7b4488d3aac3 |
|
MD5 | ace11264bc85ad7296bc58554b09dd96 |
|
BLAKE2b-256 | f8b1acd1f7f3de131163f83e858a53c7d8a682468c2ec11e2d11f7cf59321dae |
File details
Details for the file pymvvm_design-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: pymvvm_design-0.7.0-py3-none-any.whl
- Upload date:
- Size: 4.4 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 | 15705c857647d43e8b8774b4b2685215b3fedd3f3474bcb37289fd9eebe531dd |
|
MD5 | de3bbedb016e50038377df8fb3882d32 |
|
BLAKE2b-256 | d89cc87241cd3489f2071071e33bad883585ea045825a3d528b82105bab1e724 |