Skip to main content

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)


## Releasing

This project uses GitHub Actions to automatically publish new releases to PyPI. To create a new release:

1. Update the version number in `setup.py`.
2. Commit your changes and push to GitHub.
3. On GitHub, go to the repository's "Releases" page.
4. Click "Draft a new release".
5. Create a new tag (e.g., v0.1.0), give your release a title, and add release notes.
6. Click "Publish release".

The GitHub Actions workflow will automatically build and publish the new version to PyPI.

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.5.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

pymvvm_design-0.5.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pymvvm_design-0.5.0.tar.gz.

File metadata

  • Download URL: pymvvm_design-0.5.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for pymvvm_design-0.5.0.tar.gz
Algorithm Hash digest
SHA256 5c1c0d9f6d83e85bd56061bb25d9c52f066e954ede1b34eafe0161ba7d56d702
MD5 fe93c4b5ddab1519b34f081d9223d208
BLAKE2b-256 fb4a9356680487aeec66b3ae79434769f48b7ebef4ec37c3c40eb3f322a2e8f2

See more details on using hashes here.

File details

Details for the file pymvvm_design-0.5.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymvvm_design-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 095e94c3b1527e78182e58337ba333ada8d8150bb161deafac1e58f558386efb
MD5 507a8db344b20b2f9f528e40c2a08886
BLAKE2b-256 ef8fd3ebe2e5b9275f1ae8c5ad67c401aa6576a21aad86a99bb096baec89acf7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page