Live module editing and development enhancement supporting hot reloading for Python 3.4+
BSD-3-CLAUSE License
.. image:: https://github.com/CFSworks/limeade/blob/master/.github/readme/logo.png?raw=true :align: center
.. pypi section follows
::
pip install limeade
Live module editing and development enhancement supporting hot reloading for Python 3.4+.
|Travis| |Coverage| |PyPI| |PyPI Downloads|
Equip your app with the ability to call limeade.refresh()
on
command (e.g. via hotkey) and invoke after making edits to your source files!
.. image:: https://github.com/CFSworks/limeade/blob/master/.github/readme/demo.gif?raw=true
limeade.refresh()
; Limeade does the rest!Limeade is still experimental. I would be deeply appreciative if you could use it and find ways in which it breaks!
The API is not yet stable. I will keep limeade.refresh()
working, but
that is the extent of the public API for the time being.
Some things which it cannot (even theoretically) handle are:
__init__
change is handled__init__
function only runs when an instance is first created - as__init__
, it may fail for classes which are already instantiated. AnSome things which it may handle in the future:
The idea of merely reloading modules in Python is not a new one. What sets Limeade apart is that it attempts to update extant classes (and their instances) and functions. Here are some other approaches and how Limeade differs:
importlib.reload(): This simply re-executes the module in the same module
namespace. The definitions of classes and functions are overwritten, but the
classes and functions themselves are not updated. Because the module
namespace is reused, a reload can be detected by first checking if certain
names already exist. Note that Limeade uses the importlib.reload()
call
itself, so the same namespace reuse occurs at the module level.
IPython's autoreload extension: This is a much more similar approach to Limeade from a theoretical standpoint. There are practical differences, however: The autoreload extension contains imports that pull in IPython, while Limeade is intended to function standalone. IPython is intended for interactive use, while Limeade may be useful in hotpatching daemons and other long-running standalone Python programs. Limeade also aspires to integrate well with custom loaders and user logic.
All code licensed under 3-clause BSD.
Logo licensed under CC-BY-SA 4.0 with attribution to Elizabeth Reedy.
.. |Travis| image:: https://img.shields.io/travis/CFSworks/limeade :alt: Travis (.org) .. |Coverage| image:: https://img.shields.io/codecov/c/github/CFSworks/limeade :alt: Codecov .. |PyPI| image:: https://img.shields.io/pypi/v/limeade :alt: PyPI .. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/limeade :alt: PyPI - Downloads