lml - Load me later. A lazy plugin management system.
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 [1] 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.
[1] | 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.
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:
$ pip install lml
or clone it and install it:
$ 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:
lml is available on these distributions:
License
New BSD
Commit History @6ab98279-90a3-4875-bcf2-3e325ed6b5c8/upstream
- :news_paper: add robot chef v2 and its plugin back as submodule chfw 3 years ago
- :fire: remove robot chef v2 and its plugin chfw 3 years ago
- :fire: add robotchef and its plugins back as submodules chfw 3 years ago
- :fire: remove robotchef and its plugins chfw 3 years ago
- :hammer: add robot chef all in one with lml back as submodule chfw 3 years ago
- :fire: remove robotchef_allinone_lml chfw 3 years ago
- :fire: remove spelling chfw 3 years ago
- :hammer: add robot chef all in one back as submodule chfw 3 years ago
- :fire: remove robotchef_allinone chfw 3 years ago
- Merge branch 'dev' of https://github.com/python-lml/lml into dev chfw 3 years ago
- :fire: do the tests elsewhere chfw 3 years ago
- Merge pull request #22 from python-lml/pytest jaska (commit: GitHub) 3 years ago
- :green_heart: update tests chfw 3 years ago
- :fire: remove nose chfw 3 years ago
- :green_heart: update broken unit tests chfw 3 years ago
- :green_heart: add __init__.py so pytest see lml. https://stackoverflow.com/questions/49028611/pytest-cannot-find-module chfw 3 years ago
- :green_heart: remove python 3.5, 2.7 and pypy test targets chfw 3 years ago
- :green_heart: include pytest-cov chfw 3 years ago
- :bug: update coverage module chfw 3 years ago
- :fire: remove nose from requirements.txt chfw 3 years ago
- :hammer: convert all nosetests to pytest chfw 3 years ago
- Merge pull request #21 from python-lml/green-heart jaska (commit: GitHub) 3 years ago
- :green_heart: fix the typo chfw 3 years ago
- :green_heart: update test script to ignore setup.py and fix long running bug in regrex chfw 3 years ago
- :green_heart: update example test script chfw 3 years ago
- :green_heart: update example test script chfw 3 years ago
- :green_heart: update unit tests chfw 3 years ago
- :handshake: synchronize with pypi-mobans chfw 3 years ago
- Merge pull request #19 from mcepl/remove_nose jaska (commit: GitHub) 3 years ago
- Replace nose with pytest. Matěj Cepl 3 years ago