Skip to main content

Masterpiece™

Masterpiece is a Python framework designed for the rapid development of Python applications of any kind.

It emerged from the unification of numerous diverse applications and projects, consolidating their shared functionality into a single, cohesive structure. By standardizing classes across different applications and extracting the common core, Masterpiece provides a robust foundation that can be adapted to any use case.

At its heart, Masterpiece is a tree-based container system for modeling real-world systems, with features needed by all applications, features e.g. serialization, configuration, startup argument parsing, just to name a few.

Key Features

Masterpiece integrates a rich set of features essential for modern application development, including:

  • Seamless plug-in architecture - enabling recursive extension and development of custom modules for any application.

  • Supervisor for monitoring crashes, logging them, and automatically restarting the crashed threads

  • Hierarchical data structures – A flexible tree container for organizing objects.

  • Serialization support – Save and load hierarchical objects efficiently.

  • Factory Method pattern – Dynamically create instances of registered classes.

  • Configuration management – Automated class attribute configuration through various serialiation formats, e.g. JSon.

  • Event and network loops – Support for asynchronous workflows and network-driven applications.

  • General purpose – Designed to be adaptable to various domains and use cases.

  • File system oriented object identification / resolving through 'object paths'

  • Multi-threading, based on the assumption that Python community will get the global lock issue sorted out.

  • MQTT Communication: Enables seamless communication between components using the MQTT protocol, ideal for distributed systems.

  • Time series support using databases e.g. Influx

  • Built-in documentation framework based on Sphinx

Design Concepts and Features

  • Pythonic Purity: Adheres to Python conventions, ensuring idiomatic, readable, and maintainable code.
  • First-Time Excellence: Designed to be reliable, correct, and efficient from the start—while keeping things fun!
  • Completeness: A minimal yet robust zero redundancy API that gives developers total control over all aspects of their applications.
  • Productivity: Highly modular and reusable codebase to achieve maximum functionality with minimal effort. Productivity grows with the size of the project.
  • Proper Abstraction: Provides clean abstractions for essential third-party libraries, shielding application code from underlying framework changes.

Project Status and Current State

Here’s what’s currently available in Masterpiece™:

  • Absolutely Bug-free Status!: Just kidding—there are no known bugs (so far).
  • Wiki: The initial Wiki pages are under construction. Visit the Masterpiece Wiki <https://gitlab.com/juham/masterpiece/-/wikis/home>_.
  • Tutorial: A tutorial <docs/source/tutorial.rst>_ to help you get started with building your masterpieces.
  • Package Infrastructure: The Python package setup is finalized, using pyproject.toml.
  • Classes: Existing classes have been finalized and tested in a production environment.
  • Example Application: A sample application (examples/myapp.py) prints out its instance structure when run. Despite its simplicity, it demonstrates the structure of a typical scalable and fully configurable software.
  • Plugin Projects: Several plugin examples, such as masterpiece_plugin, which adds a "Hello World" greeting to myapp.py, demonstrate minimal yet functional plugin implementations.
  • MQTT: Enables communication between all Masterpiece™ objects.
  • InfluxDB V3 Time Series: Supports writing and reading from time-series databases.
  • Serialization: Built-in support for JSON serialization, with options to extend to other formats via plugins.
  • CI Pipelines: For both frameworks and plugins.
  • ...: And probably more features I’ve forgotten while writing this.

Here's what's NOT ready:

  • GUI: no graphical user interface of any kind. The current projects rely on 3rd party tools, e.g. Grafana for visualization.

Projects

Masterpiece comes in a set of Python projects:

  1. Masterpiece (core framework):

This is the core framework for building plugin-aware, multi-threaded applications. It includes a simple yet fully functional application to help you get started and serves as a plugin-aware reference application that can be scaled up to any size.

  1. Masterpiece Plugin (plugin example):

This is a basic plugin example that demonstrates how to create third-party plugins for applications built using Masterpiece. It’s as simple as saying "Hello, World!", literally.

  1. Masterpiece XML Format plugin::

Plugin that adds XML serialization format support to Masterpiece.

  1. Masterpiece Yaml Format plugin::

Another format plugin. Adds Yaml support to Masterpiece.

  1. Masterpiece Influx::

Support for InfluxDB V3 time series database.

  1. Masterpiece Paho MQTT::

Support for Paho Mosquitto MQTT.

Installing Masterpiece

Step 1: Install Masterpiece and run the example application ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To install the core framework:

.. code-block:: bash

pip install masterpiece

Then, navigate to the example folder and run the application:

.. code-block:: bash

python examples/myapp.py

The application will print out its instance hierarchy. This is a simple example application to demonstrate the basic structure of any multi-threaded, plugin-based, scalable MasterPiece applications.

Example output:

.. code-block:: text

home
    ├─ grid
    ├─ downstairs
    │   └─ kitchen
    │       ├─ oven
    │       └─ fridge
    └─ garage
        └─ EV charger

Step 2: Install the desired Masterpiece Plugins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

To extend the application with the say masterpiece_plugin:

.. code-block:: bash

pip install masterpiece_plugin

Run the application again:

.. code-block:: bash

python examples/myapp.py

You'll now see a new object in the instance hierarchy, along with a friendly "Hello, World!" object.

Example output:

.. code-block:: text

home
    ├─ grid
    ├─ downstairs
    │   └─ kitchen
    │       ├─ oven
    │       └─ fridge
    ├─ garage
    │   └─ EV charger
    └─ Hello World - A Plugin

Step 3: Configurating ^^^^^^^^^^^^^^^^^^^^^^^^^

The application also demonstrates the usage of startup arguments. Run the application again:

.. code-block:: text

examples/myapp.py --init --solar 10 --color red

and new 'Solar plant 10 kW' object appears in the tree.

  • The --init argument tells the application to save its current configuration to a configuration files.
  • The --solar argument creates an instance of a solar power plant with a specified peak power of 10 kW.
  • The --color argument can be used for setting the color for the tree diagram.

The above class properties (and many more) can also be defined in the class configuration files. By default, the configuration files are created in the ~/.myapp/config folder, as determined by the application identifier and --config [anyname].

For example, --config temp will use the configuration files stored in the ~/.myapp/temp/ folder.

What's next

Congratulations! You've successfully installed Masterpiece, extended it with a plugin, and explored its configuration system. But what is all this for?

That part is up to your imagination. Here's what you can explore next:

  • Write Plugins: Develop your own plugins to extend Masterpiece with domain-specific functionality. Use the masterpiece_plugin as a starting point for inspiration.

  • Leverage Configurations: Take advantage of configuration files to fine-tune your application's behavior without changing the code. Experiment with the --config argument to manage multiple configurations for different scenarios.

  • Design a Custom Application: Build a unique application that fits your needs by combining existing plugins, creating new objects in the instance hierarchy, and integrating external services or data sources.

  • Contribute to the Community: Share your plugins or improvements with the Masterpiece community.

Masterpiece provides the building blocks. Where you go from here is entirely up to you. Happy coding!

Contributing

Please check out the Masterpiece Issue Board <https://gitlab.com/juham/masterpiece/-/boards>_ for tracking progress and tasks.

Developer Documentation

For full documentation and usage details, see the full documentation at Documentation Index <docs/build/html/index.html>_ (The docs may look rough; I’m still unraveling Sphinx's mysteries).

Special Thanks

Big thanks to the generous support of Mahi.fi for helping bring this framework to life.

Metadata

Release files for masterpiece 0.1.55

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for masterpiece 0.1.55
File Size Uploaded
masterpiece-0.1.55.tar.gz 503.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for masterpiece 0.1.55
File Interpreter ABI Platform
masterpiece-0.1.55-py3-none-any.whl Python 3 none any Details

Total release size: 540.9 kB

Release files / masterpiece-0.1.55.tar.gz

Download URL masterpiece-0.1.55.tar.gz
Size 503.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4799ba99a06d69388d12f59eacc22255005dc53a7a72a4eef64f4fa0dab10d20
BLAKE2b-256 checksum
How to use checksums
8503f4db427289c10320fd8a99ceeadae17052ff34884e784cf69dd0e13c3595
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / masterpiece-0.1.55-py3-none-any.whl

Download URL masterpiece-0.1.55-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a8dd0ec60193b2238c97c9f07fdc75bdd3493ace32dc4b9d874856082fbc20c
BLAKE2b-256 checksum
How to use checksums
d49edee7c54d51f3a8f06ba99bebad2ceb118debf29ce1522eefa50d6aa24f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.1.55 This release

2 release files

0.1.54

2 release files

0.1.53

2 release files

0.1.51

2 release files

0.1.50

2 release files

0.1.49

2 release files

0.1.48

2 release files

0.1.47

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.44

2 release files

0.1.43

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.33

2 release files

0.1.32

2 release files

0.1.31

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page