HMR means Hot Module Reload / Hot Module Replacement. It is a feature that allows part of your app to be updated at runtime without a full rerun.
- The module whose source file you changed will rerun
- The module / function that depends on the changed module will rerun
- Other modules that are unaffected (like third-party libraries) will not rerun
Thus, in contrast to the traditional way of cold-reloading Python applications (like watchfiles CLI), HMR is just more efficient.
Unlike static-analysis tools like Tach, HMR works by tracking the dependencies between names and modules during runtime through a reactive system.
Tip
The docs site is available, but the documentation is still under construction. However, we have first-class llms.txt and MCP support for AI agents.
If you are running your entry file with python foo.py bar baz ..., you can just replace it with hmr foo.py bar baz ....
You can also run modules with hmr -m <module>, just like python -m <module>.
Try it with uvx or pipx. If you are using a virtual environment, it is recommended to install hmr in the virtual environment instead of globally.