Name | masterpiece-plugin JSON |
Version |
0.0.6
JSON |
| download |
home_page | None |
Summary | A simple demonstration plugin designed to extend `masterpiece` applications |
upload_time | 2024-12-08 07:17:58 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License =========== Copyright (c) 2024, Juha Meskanen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
keywords |
object-oriented
plugin
framework
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
masterpiece_plugin
==================
`masterpiece_plugin` is a simple demonstration plugin designed to extend `masterpiece` applications by adding a
basic "Hello, World!" greeting feature. While this plugin is straightforward in its functionality, it serves as an
excellent starting point for developers looking to implement real plugins for `masterpiece`.
Source code
-----------
.. code-block:: python
from masterpiece.base import Plugin, Composite
class Foo(Plugin):
def __init__(self, name: str = "noname", description: str = "foo") -> None:
super().__init__(name)
self.description = description
# @override
def install(self, app: Composite) -> None:
obj = Foo("Hello World - A Plugin")
app.add(obj)
# @override
def to_dict(self):
"""Convert instance attributes to a dictionary."""
return {
"_class": self.get_class_id(), # the real class
"_version:": 0,
"_foo": {
"description": self.description,
},
}
# @override
def from_dict(self, data):
"""Update instance attributes from a dictionary."""
for key, value in data["_foo"].items():
setattr(self, key, value)
Features
--------
The plugin adds one Foo object named 'Hello World - A Plugin' into the masterpiece application.
The primary purpose of `masterpiece_plugin` is educational. It is intended to demonstrate the fundamental steps
involved in creating and integrating plugins with `masterpiece`. Developers can use this as a reference or template
when building more complex plugins for real-world applications.
Installation
------------
To install:
.. code-block:: python
pip install masterpiece
pip install masterpiece_plugin
Usage
-----
Once installed, the plugin integrates into the 'masterpiece/examples/myapp.py' application:
.. code-block:: python
cd masterpiece/examples
python myapp.py
This will output the following diagram:
.. code-block:: text
home
├─ grid
├─ downstairs
│ └─ kitchen
│ ├─ oven
│ └─ fridge
├─ garage
│ └─ EV charger
└─ Hello World - A Plugin
License
-------
This project is licensed under the MIT License - see the `LICENSE` file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "masterpiece-plugin",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "\"J. Meskanen\" <juham.api@gmail.com>",
"keywords": "object-oriented, plugin, framework",
"author": null,
"author_email": "J Meskanen <juham.api@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/36/fa/537d2d5297268d8b6038d518c631d3e616b25c9c0aefe80396a17b0858d0/masterpiece_plugin-0.0.6.tar.gz",
"platform": null,
"description": "\r\nmasterpiece_plugin\r\n==================\r\n\r\n`masterpiece_plugin` is a simple demonstration plugin designed to extend `masterpiece` applications by adding a\r\nbasic \"Hello, World!\" greeting feature. While this plugin is straightforward in its functionality, it serves as an\r\nexcellent starting point for developers looking to implement real plugins for `masterpiece`.\r\n\r\nSource code\r\n-----------\r\n\r\n.. code-block:: python\r\n\r\n from masterpiece.base import Plugin, Composite\r\n\r\n class Foo(Plugin):\r\n\r\n def __init__(self, name: str = \"noname\", description: str = \"foo\") -> None:\r\n super().__init__(name)\r\n self.description = description\r\n\r\n # @override\r\n def install(self, app: Composite) -> None:\r\n obj = Foo(\"Hello World - A Plugin\")\r\n app.add(obj)\r\n\r\n # @override\r\n def to_dict(self):\r\n \"\"\"Convert instance attributes to a dictionary.\"\"\"\r\n return {\r\n \"_class\": self.get_class_id(), # the real class\r\n \"_version:\": 0,\r\n \"_foo\": {\r\n \"description\": self.description,\r\n },\r\n }\r\n\r\n # @override\r\n def from_dict(self, data):\r\n \"\"\"Update instance attributes from a dictionary.\"\"\"\r\n for key, value in data[\"_foo\"].items():\r\n setattr(self, key, value)\r\n\r\n\r\nFeatures\r\n--------\r\n\r\nThe plugin adds one Foo object named 'Hello World - A Plugin' into the masterpiece application. \r\n\r\nThe primary purpose of `masterpiece_plugin` is educational. It is intended to demonstrate the fundamental steps\r\ninvolved in creating and integrating plugins with `masterpiece`. Developers can use this as a reference or template\r\nwhen building more complex plugins for real-world applications.\r\n\r\nInstallation\r\n------------\r\n\r\nTo install:\r\n\r\n.. code-block:: python\r\n\r\n pip install masterpiece\r\n pip install masterpiece_plugin\r\n\r\n\r\nUsage\r\n-----\r\n\r\nOnce installed, the plugin integrates into the 'masterpiece/examples/myapp.py' application:\r\n\r\n.. code-block:: python\r\n\r\n cd masterpiece/examples\r\n python myapp.py\r\n\r\n\r\nThis will output the following diagram:\r\n\r\n.. code-block:: text\r\n\r\n home\r\n \u251c\u2500 grid\r\n \u251c\u2500 downstairs\r\n \u2502 \u2514\u2500 kitchen\r\n \u2502 \u251c\u2500 oven\r\n \u2502 \u2514\u2500 fridge\r\n \u251c\u2500 garage\r\n \u2502 \u2514\u2500 EV charger\r\n \u2514\u2500 Hello World - A Plugin\r\n\r\n\r\n\r\nLicense\r\n-------\r\n\r\nThis project is licensed under the MIT License - see the `LICENSE` file for details.\r\n",
"bugtrack_url": null,
"license": "MIT License =========== Copyright (c) 2024, Juha Meskanen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ",
"summary": "A simple demonstration plugin designed to extend `masterpiece` applications",
"version": "0.0.6",
"project_urls": {
"Bug Reports": "https://gitlab.com/juham/masterpiece",
"Homepage": "https://gitlab.com/juham/masterpiece_plugin",
"Say Thanks!": "http://meskanen.com",
"Source": "https://gitlab.com/juham/masterpiece_plugin"
},
"split_keywords": [
"object-oriented",
" plugin",
" framework"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bf04d20ded33b2f64ed84178e945e24094470592f1472694098750b94e0f1963",
"md5": "350fa38b30ae029d084bbffec319db54",
"sha256": "c89f407e85676e8794ebcdd4fea4fb0bedd0ebc1c94d96476dc8402b3e4491ea"
},
"downloads": -1,
"filename": "masterpiece_plugin-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "350fa38b30ae029d084bbffec319db54",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5685,
"upload_time": "2024-12-08T07:17:53",
"upload_time_iso_8601": "2024-12-08T07:17:53.952207Z",
"url": "https://files.pythonhosted.org/packages/bf/04/d20ded33b2f64ed84178e945e24094470592f1472694098750b94e0f1963/masterpiece_plugin-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36fa537d2d5297268d8b6038d518c631d3e616b25c9c0aefe80396a17b0858d0",
"md5": "d08c9e84970ff28700bf2985ee67e126",
"sha256": "a3f4fb88cca4575cfd39ac8031e3e74a2bcbe8143a9b272c4262554347beacff"
},
"downloads": -1,
"filename": "masterpiece_plugin-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "d08c9e84970ff28700bf2985ee67e126",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 1373596,
"upload_time": "2024-12-08T07:17:58",
"upload_time_iso_8601": "2024-12-08T07:17:58.908841Z",
"url": "https://files.pythonhosted.org/packages/36/fa/537d2d5297268d8b6038d518c631d3e616b25c9c0aefe80396a17b0858d0/masterpiece_plugin-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-08 07:17:58",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "juham",
"gitlab_project": "masterpiece",
"lcname": "masterpiece-plugin"
}