Open thomasfrederikhoeck opened 3 years ago
Ah, I see. localhost:1234/my_module
doesn't update until localhost:1234/my_module/file1.html
itself is visited.
I investigated Python bytecode caching via sys.dont_write_bytecode
, and that did nothing.
I imagine the issue is thus: the requested module itself is always reloaded:
https://github.com/pdoc3/pdoc/blob/d8b9dbc2a128099e89a9d7859720dac56d574094/pdoc/__init__.py#L223-L223
but its references (i.e. my_module.file1.my_func
) still come from the existing loaded modules (i.e. sys.modules['my_module.file1']
) which aren't reloaded. A solution would be to also recursively reload all the dependency modules beforehand, but I don't quickly see how to achieve that.
Ideas appreciated.
I submitted a PR to solve this: https://github.com/pdoc3/pdoc/pull/300
Expected Behavior
I expect changes to be reflected when using the web server when I make changes to files, even though I use
__all__
and view the module.Actual Behavior
Changes are not reflected.
Steps to Reproduce
Create folder
my_module
Add two files
from .file1 import my_func
all = ['my_func',]
file1.py
def my_func(x: int): """
file1.py
def my_func(x: int): """