lml


Namelml JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/python-lml/lml
SummaryLoad me later. A lazy plugin management system.
upload_time2020-10-21 13:43:46
maintainer
docs_urlNone
authorC.W.
requires_python
licenseNew BSD
keywords python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ================================================================================
lml - Load me later. A lazy plugin management system.
================================================================================

.. image:: https://api.travis-ci.org/python-lml/lml.svg
   :target: http://travis-ci.org/python-lml/lml

.. image:: https://codecov.io/github/python-lml/lml/coverage.png
   :target: https://codecov.io/github/python-lml/lml
.. image:: https://badge.fury.io/py/lml.svg
   :target: https://pypi.org/project/lml

.. image:: https://pepy.tech/badge/lml/month
   :target: https://pepy.tech/project/lml/month

.. image:: https://img.shields.io/github/stars/python-lml/lml.svg?style=social&maxAge=3600&label=Star
    :target: https://github.com/python-lml/lml/stargazers

.. image:: https://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-square
    :target: https://moban.readthedocs.io/en/latest/#at-scale-continous-templating-for-open-source-projects

.. image:: https://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-square
    :target: https://github.com/psf/black

.. image:: https://readthedocs.org/projects/lml/badge/?version=latest
   :target: http://lml.readthedocs.org/en/latest/

**lml** seamlessly finds the lml based plugins from your current python
environment but loads your plugins on demand. It is designed to support
plugins that have external dependencies, especially bulky and/or
memory hungry ones. lml provides the plugin management system only and the
plugin interface is on your shoulder.

**lml** enabled applications helps your customers [#f1]_ in two ways:

#. Your customers could cherry-pick the plugins from pypi per python environment.
   They could remove a plugin using `pip uninstall` command.
#. Only the plugins used at runtime gets loaded into computer memory.

When you would use **lml** to refactor your existing code, it aims to flatten the
complexity and to shrink the size of your bulky python library by
distributing the similar functionalities across its plugins. However, you as
the developer need to do the code refactoring by yourself and lml would lend you a hand.

.. [#f1] the end developers who uses your library and packages achieve their
         objectives.


Quick start
================================================================================

The following code tries to get you started quickly with **non-lazy** loading.

.. code-block:: python

    from lml.plugin import PluginInfo, PluginManager


    @PluginInfo("cuisine", tags=["Portable Battery"])
    class Boost(object):
        def make(self, food=None, **keywords):
            print("I can cook %s for robots" % food)


    class CuisineManager(PluginManager):
        def __init__(self):
            PluginManager.__init__(self, "cuisine")

        def get_a_plugin(self, food_name=None, **keywords):
            return PluginManager.get_a_plugin(self, key=food_name, **keywords)


    if __name__ == '__main__':
        manager = CuisineManager()
        chef = manager.get_a_plugin("Portable Battery")
        chef.make()


At a glance, above code simply replaces the Factory pattern should you write
them without lml. What's not obvious is, that once you got hands-on with it,
you can start work on how to do **lazy** loading.


Installation
================================================================================


You can install lml via pip:

.. code-block:: bash

    $ pip install lml


or clone it and install it:

.. code-block:: bash

    $ git clone https://github.com/python-lml/lml.git
    $ cd lml
    $ python setup.py install

lml enabled project
================================================================================

Beyond the documentation above, here is a list of projects using lml:

#. `pyexcel <https://github.com/pyexcel/pyexcel>`_
#. `pyecharts <https://github.com/pyecharts/pyecharts>`_
#. `moban <https://github.com/moremoban/moban>`_

lml is available on these distributions:

#. `ARCH linux <https://aur.archlinux.org/packages/python-lml/>`_
#. `Conda forge <https://anaconda.org/conda-forge/lml>`_
#. `OpenSuse <https://build.opensuse.org/package/show/devel:languages:python/python-lml>`_


License
================================================================================

New BSD

Change log
================================================================================

0.1.0 - 21/10/2020
--------------------------------------------------------------------------------

**Updated**

#. non class object can be a plugin too
#. `#20 <https://github.com/python-lml/lml/issues/20>`_: When a plugin was not
   installed, it now calls raise_exception method

0.0.9 - 7/1/2019
--------------------------------------------------------------------------------

**Updated**

#. `#11 <https://github.com/python-lml/lml/issues/11>`_: more test contents for
   OpenSuse package validation

0.0.8 - 4/1/2019
--------------------------------------------------------------------------------

**Updated**

#. `#9 <https://github.com/python-lml/lml/issues/9>`_: include tests, docs for
   OpenSuse package validation

0.0.7 - 17/11/2018
--------------------------------------------------------------------------------

**Fixed**

#. `#8 <https://github.com/python-lml/lml/issues/8>`_: get_primary_key will fail
   when a module is loaded later
#. deprecated old style plugin scanner: scan_plugins

0.0.6 - 07/11/2018
--------------------------------------------------------------------------------

**Fixed**

#. Revert the version 0.0.5 changes. Raise Import error and log the exception

0.0.5 - 06/11/2018
--------------------------------------------------------------------------------

**Fixed**

#. `#6 <https://github.com/python-lml/lml/issues/6>`_: Catch and Ignore
   ModuleNotFoundError

0.0.4 - 07.08.2018
--------------------------------------------------------------------------------

**Added**

#. `#4 <https://github.com/python-lml/lml/issues/4>`_: to find plugin names with
   different naming patterns

0.0.3 - 12/06/2018
--------------------------------------------------------------------------------

**Added**

#. `dict` can be a pluggable type in addition to `function`, `class`
#. get primary tag of your tag, helping you find out which category of plugins
   your tag points to

0.0.2 - 23/10/2017
--------------------------------------------------------------------------------

**Updated**

#. `pyexcel#103 <https://github.com/pyexcel/pyexcel/issues/103>`_: include
   LICENSE in tar ball

0.0.1 - 30/05/2017
--------------------------------------------------------------------------------

**Added**

#. First release




            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/python-lml/lml",
    "name": "lml",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python",
    "author": "C.W.",
    "author_email": "wangc_2011@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c5/5a/006d93401d382f82584711c848826ac24bce9d79eb19d25da9cf1d783815/lml-0.1.0.tar.gz",
    "platform": "",
    "description": "================================================================================\nlml - Load me later. A lazy plugin management system.\n================================================================================\n\n.. image:: https://api.travis-ci.org/python-lml/lml.svg\n   :target: http://travis-ci.org/python-lml/lml\n\n.. image:: https://codecov.io/github/python-lml/lml/coverage.png\n   :target: https://codecov.io/github/python-lml/lml\n.. image:: https://badge.fury.io/py/lml.svg\n   :target: https://pypi.org/project/lml\n\n.. image:: https://pepy.tech/badge/lml/month\n   :target: https://pepy.tech/project/lml/month\n\n.. image:: https://img.shields.io/github/stars/python-lml/lml.svg?style=social&maxAge=3600&label=Star\n    :target: https://github.com/python-lml/lml/stargazers\n\n.. image:: https://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-square\n    :target: https://moban.readthedocs.io/en/latest/#at-scale-continous-templating-for-open-source-projects\n\n.. image:: https://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-square\n    :target: https://github.com/psf/black\n\n.. image:: https://readthedocs.org/projects/lml/badge/?version=latest\n   :target: http://lml.readthedocs.org/en/latest/\n\n**lml** seamlessly finds the lml based plugins from your current python\nenvironment but loads your plugins on demand. It is designed to support\nplugins that have external dependencies, especially bulky and/or\nmemory hungry ones. lml provides the plugin management system only and the\nplugin interface is on your shoulder.\n\n**lml** enabled applications helps your customers [#f1]_ in two ways:\n\n#. Your customers could cherry-pick the plugins from pypi per python environment.\n   They could remove a plugin using `pip uninstall` command.\n#. Only the plugins used at runtime gets loaded into computer memory.\n\nWhen you would use **lml** to refactor your existing code, it aims to flatten the\ncomplexity and to shrink the size of your bulky python library by\ndistributing the similar functionalities across its plugins. However, you as\nthe developer need to do the code refactoring by yourself and lml would lend you a hand.\n\n.. [#f1] the end developers who uses your library and packages achieve their\n         objectives.\n\n\nQuick start\n================================================================================\n\nThe following code tries to get you started quickly with **non-lazy** loading.\n\n.. code-block:: python\n\n    from lml.plugin import PluginInfo, PluginManager\n\n\n    @PluginInfo(\"cuisine\", tags=[\"Portable Battery\"])\n    class Boost(object):\n        def make(self, food=None, **keywords):\n            print(\"I can cook %s for robots\" % food)\n\n\n    class CuisineManager(PluginManager):\n        def __init__(self):\n            PluginManager.__init__(self, \"cuisine\")\n\n        def get_a_plugin(self, food_name=None, **keywords):\n            return PluginManager.get_a_plugin(self, key=food_name, **keywords)\n\n\n    if __name__ == '__main__':\n        manager = CuisineManager()\n        chef = manager.get_a_plugin(\"Portable Battery\")\n        chef.make()\n\n\nAt a glance, above code simply replaces the Factory pattern should you write\nthem without lml. What's not obvious is, that once you got hands-on with it,\nyou can start work on how to do **lazy** loading.\n\n\nInstallation\n================================================================================\n\n\nYou can install lml via pip:\n\n.. code-block:: bash\n\n    $ pip install lml\n\n\nor clone it and install it:\n\n.. code-block:: bash\n\n    $ git clone https://github.com/python-lml/lml.git\n    $ cd lml\n    $ python setup.py install\n\nlml enabled project\n================================================================================\n\nBeyond the documentation above, here is a list of projects using lml:\n\n#. `pyexcel <https://github.com/pyexcel/pyexcel>`_\n#. `pyecharts <https://github.com/pyecharts/pyecharts>`_\n#. `moban <https://github.com/moremoban/moban>`_\n\nlml is available on these distributions:\n\n#. `ARCH linux <https://aur.archlinux.org/packages/python-lml/>`_\n#. `Conda forge <https://anaconda.org/conda-forge/lml>`_\n#. `OpenSuse <https://build.opensuse.org/package/show/devel:languages:python/python-lml>`_\n\n\nLicense\n================================================================================\n\nNew BSD\n\nChange log\n================================================================================\n\n0.1.0 - 21/10/2020\n--------------------------------------------------------------------------------\n\n**Updated**\n\n#. non class object can be a plugin too\n#. `#20 <https://github.com/python-lml/lml/issues/20>`_: When a plugin was not\n   installed, it now calls raise_exception method\n\n0.0.9 - 7/1/2019\n--------------------------------------------------------------------------------\n\n**Updated**\n\n#. `#11 <https://github.com/python-lml/lml/issues/11>`_: more test contents for\n   OpenSuse package validation\n\n0.0.8 - 4/1/2019\n--------------------------------------------------------------------------------\n\n**Updated**\n\n#. `#9 <https://github.com/python-lml/lml/issues/9>`_: include tests, docs for\n   OpenSuse package validation\n\n0.0.7 - 17/11/2018\n--------------------------------------------------------------------------------\n\n**Fixed**\n\n#. `#8 <https://github.com/python-lml/lml/issues/8>`_: get_primary_key will fail\n   when a module is loaded later\n#. deprecated old style plugin scanner: scan_plugins\n\n0.0.6 - 07/11/2018\n--------------------------------------------------------------------------------\n\n**Fixed**\n\n#. Revert the version 0.0.5 changes. Raise Import error and log the exception\n\n0.0.5 - 06/11/2018\n--------------------------------------------------------------------------------\n\n**Fixed**\n\n#. `#6 <https://github.com/python-lml/lml/issues/6>`_: Catch and Ignore\n   ModuleNotFoundError\n\n0.0.4 - 07.08.2018\n--------------------------------------------------------------------------------\n\n**Added**\n\n#. `#4 <https://github.com/python-lml/lml/issues/4>`_: to find plugin names with\n   different naming patterns\n\n0.0.3 - 12/06/2018\n--------------------------------------------------------------------------------\n\n**Added**\n\n#. `dict` can be a pluggable type in addition to `function`, `class`\n#. get primary tag of your tag, helping you find out which category of plugins\n   your tag points to\n\n0.0.2 - 23/10/2017\n--------------------------------------------------------------------------------\n\n**Updated**\n\n#. `pyexcel#103 <https://github.com/pyexcel/pyexcel/issues/103>`_: include\n   LICENSE in tar ball\n\n0.0.1 - 30/05/2017\n--------------------------------------------------------------------------------\n\n**Added**\n\n#. First release\n\n\n\n",
    "bugtrack_url": null,
    "license": "New BSD",
    "summary": "Load me later. A lazy plugin management system.",
    "version": "0.1.0",
    "split_keywords": [
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "0065d8daef21aee7c19db8a1dad27ba0",
                "sha256": "ec06e850019942a485639c8c2a26bdb99eae24505bee7492b649df98a0bed101"
            },
            "downloads": -1,
            "filename": "lml-0.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0065d8daef21aee7c19db8a1dad27ba0",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 10869,
            "upload_time": "2020-10-21T13:43:44",
            "upload_time_iso_8601": "2020-10-21T13:43:44.992587Z",
            "url": "https://files.pythonhosted.org/packages/10/76/b0967eae4af4b7ea22e8b8ece6f7655fb6a3f4f49428f41910f53a552e1e/lml-0.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "df74fb9e2298f416d3364d382912a7d3",
                "sha256": "57a085a29bb7991d70d41c6c3144c560a8e35b4c1030ffb36d85fa058773bcc5"
            },
            "downloads": -1,
            "filename": "lml-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "df74fb9e2298f416d3364d382912a7d3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 42010,
            "upload_time": "2020-10-21T13:43:46",
            "upload_time_iso_8601": "2020-10-21T13:43:46.621749Z",
            "url": "https://files.pythonhosted.org/packages/c5/5a/006d93401d382f82584711c848826ac24bce9d79eb19d25da9cf1d783815/lml-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-10-21 13:43:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "python-lml",
    "github_project": "lml",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "lml"
}
        
Elapsed time: 0.01811s