@@ -18,9 +18,9 @@ class AbstractRenderServer(Generic[_App, _Config], abc.ABC):
1818 standalone and as an extension to an existing application.
1919
2020 Standalone usage:
21- :meth:`AbstractServerExtension.run` or :meth:`AbstractServerExtension.daemon `
21+ :meth:`~ AbstractServerExtension.run` or :meth:`~ AbstractServerExtension.run_in_thread `
2222 Register an extension:
23- :meth:`AbstractServerExtension.register`
23+ :meth:`~ AbstractServerExtension.register`
2424 """
2525
2626 def __init__ (
@@ -54,7 +54,7 @@ def run(self, host: str, port: int, *args: Any, **kwargs: Any) -> None:
5454 self ._config , app , host , port , args , kwargs
5555 )
5656
57- def daemon (self , * args : Any , ** kwargs : Any ) -> Thread :
57+ def run_in_thread (self , * args : Any , ** kwargs : Any ) -> Thread :
5858 """Run the standalone application in a seperate thread."""
5959 self ._daemon_thread = thread = Thread (
6060 target = lambda : self .run (* args , ** kwargs ), daemon = True
@@ -67,6 +67,8 @@ def daemon(self, *args: Any, **kwargs: Any) -> Thread:
6767
6868 def register (self : _Self , app : Optional [_App ]) -> _Self :
6969 """Register this as an extension."""
70+ if self ._app is not None :
71+ raise RuntimeError (f"Already registered { self ._app } " )
7072 self ._setup_application (self ._config , app )
7173 self ._setup_application_did_start_event (
7274 self ._config , app , self ._server_did_start
@@ -84,10 +86,12 @@ def wait_until_server_start(self, timeout: float = 3.0) -> None:
8486 @abc .abstractmethod
8587 def stop (self ) -> None :
8688 """Stop a currently running application"""
89+ raise NotImplementedError ()
8790
8891 @abc .abstractmethod
8992 def _create_config (self , config : Optional [_Config ]) -> _Config :
9093 """Return the default configuration options."""
94+ raise NotImplementedError ()
9195
9296 @abc .abstractmethod
9397 def _default_application (self , config : _Config ) -> _App :
0 commit comments