Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
c457ab7
initial push
BSd3v Sep 9, 2025
4ebc657
work to modularize the dash eco-system and decouple from Flask
BSd3v Sep 9, 2025
9dff791
fix favicon
BSd3v Sep 9, 2025
c319b18
removing changelog entry
BSd3v Sep 9, 2025
7de2a41
fixing issue with debug true for FastAPI
BSd3v Sep 9, 2025
2cd769e
fixing `catchall` for path routes
BSd3v Sep 9, 2025
686f32f
fixing pages for use with `fastapi`
BSd3v Sep 9, 2025
660e257
fixing issue with flask pages
BSd3v Sep 10, 2025
581f8a5
Merge pull request #3 from BSd3v/modularize-dash-server
BSd3v Sep 10, 2025
9eb9dd0
Merge branch 'dev' into bring-your-own-server
BSd3v Sep 10, 2025
0fa5c99
fixing for lint
BSd3v Sep 11, 2025
1088331
fixing issue with failing test due to `endpoint` name
BSd3v Sep 11, 2025
4920e33
fixing `run` command to trigger `devtools` properly
BSd3v Sep 11, 2025
9ffba5a
fixing issue with lint and debug ui
BSd3v Sep 11, 2025
908aacd
fixing issue with `_app` when using dispatch, need to keep in context
BSd3v Sep 11, 2025
9491c7f
fixing issue with catchall
BSd3v Sep 11, 2025
39ad7bd
fixing issue with args and cancelling callbacks
BSd3v Sep 11, 2025
7bf69a7
fixing issues with pages metadata and flaky tests
BSd3v Sep 11, 2025
10681dc
fixing issues with relativate paths
BSd3v Sep 11, 2025
4944d6d
∙ - initial quart factory
Sep 11, 2025
3b0f47e
Quart factory ready
Sep 12, 2025
1112f77
fixing for lint
BSd3v Sep 12, 2025
8c52bbb
fixing issue with apps overwriting other paths
BSd3v Sep 12, 2025
aabeeb7
removing print
BSd3v Sep 12, 2025
5659cd7
cleanup
Sep 12, 2025
b05e376
reverting `render_index` -> `index` and making catch for outside of a…
BSd3v Sep 12, 2025
ed0dc3b
∙ - initial quart factory
Sep 11, 2025
141527c
Quart factory ready
Sep 12, 2025
3e38d41
fixing `prune_errors` test
BSd3v Sep 12, 2025
381fb0c
adjustments for flask api_endpoint declared in callback defs
BSd3v Sep 12, 2025
a27927a
updated QuartRequestAdapter & QuartFactory to latest changes
Sep 12, 2025
fbc3935
checkout
Sep 12, 2025
1824e11
Removed redundant Response return
Sep 12, 2025
b14f6d2
fix for fastapi `api_endpoint` registering
BSd3v Sep 12, 2025
fbefbc9
Merge pull request #4 from chgiesse/quart-factory
BSd3v Sep 12, 2025
5ef796b
shifting from `server_factory` to `backend`
BSd3v Sep 12, 2025
a4ca566
adding missing files
BSd3v Sep 12, 2025
708773f
fixing issue with server not declared
BSd3v Sep 12, 2025
b7bceba
Update dash/dash.py
BSd3v Sep 12, 2025
9873079
Update dash/dash.py
BSd3v Sep 12, 2025
9f4d291
Update dash/backend/quart.py
BSd3v Sep 12, 2025
da86e86
Update dash/dash.py
BSd3v Sep 12, 2025
4c60740
Update dash/dash.py
BSd3v Sep 12, 2025
84cb5e5
update for caller_name
BSd3v Sep 12, 2025
29cf823
Update dash/dash.py
BSd3v Sep 12, 2025
5d0f4dc
Update dash/dash.py
BSd3v Sep 12, 2025
86f4528
adjustments for matching types
BSd3v Sep 12, 2025
2a88385
Update dash/backend/registry.py
BSd3v Sep 12, 2025
df76ed6
Merge branch 'factory-backend' of github.com:BSd3v/dash into factory-…
BSd3v Sep 12, 2025
bc51c0d
Update dash/backend/registry.py
BSd3v Sep 12, 2025
1b4d0d3
fixing another type check
BSd3v Sep 12, 2025
f867f98
fixing for lint
BSd3v Sep 13, 2025
0ed81ce
fixing failing test
BSd3v Sep 13, 2025
6bd342a
fixing issue with fastapi and component suites
BSd3v Sep 13, 2025
b1c9953
adjustments to fix issues with caller_name and init the app a couple …
BSd3v Sep 13, 2025
bd40b56
adjustments for failing tests
BSd3v Sep 13, 2025
4e50430
format dash
BSd3v Sep 13, 2025
0d32e65
removing `FlaskDashServer` from import and using `get_backend('flask'…
BSd3v Sep 14, 2025
1b3f61e
reverting change to callable(title) process
BSd3v Sep 14, 2025
c6805b5
fixing for lint
BSd3v Sep 14, 2025
8c78089
adding custom error handling per backend, tests and adjustments to th…
BSd3v Sep 16, 2025
5211f6f
adjusments for formatting
BSd3v Sep 16, 2025
6a34208
adjustment to retest backend
BSd3v Sep 16, 2025
1a2b531
adding missing reqs association
BSd3v Sep 16, 2025
465e45e
fixing minor linting issues
BSd3v Sep 16, 2025
c43a583
Add global Request Adapter (#6)
chgiesse Sep 17, 2025
c4795ed
fixes for failing tests
BSd3v Sep 17, 2025
567d0f8
fixing formatting
BSd3v Sep 17, 2025
a855c6d
fixing issues
BSd3v Sep 17, 2025
79afb0b
fixing async validation
BSd3v Sep 17, 2025
77e22a3
adjustments for request_adapter
BSd3v Sep 17, 2025
f7331d3
adding test for custom dash server
BSd3v Sep 17, 2025
8b58cf4
fixing issue with `request_adapter`
BSd3v Sep 17, 2025
b7d4af2
adjusting error handling for fastapi
BSd3v Sep 17, 2025
4cf4686
adjustments for handling issues with `debug` for `fastapi`
BSd3v Sep 17, 2025
dfe0ac7
fixing for lint
BSd3v Sep 17, 2025
cd02cc5
adjustment for delayed config
BSd3v Sep 18, 2025
16b3c9e
fix typing error
BSd3v Sep 18, 2025
493d150
fixes for pages
BSd3v Sep 22, 2025
26f01b2
Merge branch 'dev' into bring-your-own-server
BSd3v Oct 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing formatting
  • Loading branch information
BSd3v committed Sep 17, 2025
commit 567d0f8d592e4281047794100c80a3728aa6b128
9 changes: 4 additions & 5 deletions dash/backends/_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_current_request() -> Request:
class CurrentRequestMiddleware:
def __init__(self, app: ASGIApp) -> None: # type: ignore[name-defined]
self.app = app
print('loaded CurrentRequestMiddleware')
print("loaded CurrentRequestMiddleware")

async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None: # type: ignore[name-defined]
# non-http/ws scopes pass through (lifespan etc.)
Expand Down Expand Up @@ -84,7 +84,6 @@ def load_config():


class FastAPIDashServer(BaseDashServer):

def __init__(self, server: FastAPI):
self.config = {}
self.server_type = "fastapi"
Expand Down Expand Up @@ -415,7 +414,6 @@ async def serve(request: Request, package_name: str, fingerprinted_path: str):

# pylint: disable=unused-argument
def dispatch(self, dash_app: Dash):

async def _dispatch(request: Request):
# pylint: disable=protected-access
body = await request.json()
Expand Down Expand Up @@ -470,7 +468,9 @@ async def timing_middleware(request: Request, call_next):
headers.append("Server-Timing", value)
return response

def register_callback_api_routes(self, callback_api_paths: Dict[str, Callable[..., Any]]):
def register_callback_api_routes(
self, callback_api_paths: Dict[str, Callable[..., Any]]
):
"""
Register callback API endpoints on the FastAPI app.
Each key in callback_api_paths is a route, each value is a handler (sync or async).
Expand Down Expand Up @@ -504,7 +504,6 @@ async def view_func(request: Request, body: dict = Body(...)):


class FastAPIRequestAdapter(RequestAdapter):

def __init__(self):
self._request: Request = get_current_request()
super().__init__()
Expand Down
13 changes: 9 additions & 4 deletions dash/backends/_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class FlaskDashServer(BaseDashServer):

def __init__(self, server: Flask) -> None:
self.server: Flask = server
self.server_type = "flask"
Expand Down Expand Up @@ -209,7 +208,9 @@ def _dispatch():
func = dash_app._prepare_callback(cb_ctx, body)
args = dash_app._inputs_to_vals(cb_ctx.inputs_list + cb_ctx.states_list)
ctx = copy_context()
partial_func = dash_app._execute_callback(func, args, cb_ctx.outputs_list, cb_ctx)
partial_func = dash_app._execute_callback(
func, args, cb_ctx.outputs_list, cb_ctx
)
response_data = ctx.run(partial_func)
if asyncio.iscoroutine(response_data):
raise Exception(
Expand All @@ -227,7 +228,9 @@ async def _dispatch_async():
func = dash_app._prepare_callback(cb_ctx, body)
args = dash_app._inputs_to_vals(cb_ctx.inputs_list + cb_ctx.states_list)
ctx = copy_context()
partial_func = dash_app._execute_callback(func, args, cb_ctx.outputs_list, cb_ctx)
partial_func = dash_app._execute_callback(
func, args, cb_ctx.outputs_list, cb_ctx
)
response_data = ctx.run(partial_func)
if asyncio.iscoroutine(response_data):
response_data = await response_data
Expand Down Expand Up @@ -269,7 +272,9 @@ def _after_request(response: Response): # type: ignore[name-defined]
self.before_request(_before_request)
self.after_request(_after_request)

def register_callback_api_routes(self, callback_api_paths: Dict[str, Callable[..., Any]]):
def register_callback_api_routes(
self, callback_api_paths: Dict[str, Callable[..., Any]]
):
"""
Register callback API endpoints on the Flask app.
Each key in callback_api_paths is a route, each value is a handler (sync or async).
Expand Down
13 changes: 6 additions & 7 deletions dash/backends/_quart.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@


class QuartDashServer(BaseDashServer):

def __init__(self, server: Quart) -> None:
self.server_type = "quart"
self.server: Quart = server
Expand All @@ -41,7 +40,9 @@ def __call__(self, *args: Any, **kwargs: Any): # type: ignore[name-defined]
return self.server(*args, **kwargs)

@staticmethod
def create_app(name: str = "__main__", config: _t.Optional[_t.Dict[str, _t.Any]] = None):
def create_app(
name: str = "__main__", config: _t.Optional[_t.Dict[str, _t.Any]] = None
):
if Quart is None:
raise RuntimeError(
"Quart is not installed. Install with 'pip install quart' to use the quart backend."
Expand Down Expand Up @@ -225,7 +226,6 @@ async def _invalid_resource(err):
return err.args[0], 404

def _html_response_wrapper(self, view_func: _t.Callable[..., _t.Any] | str):

async def wrapped(*_args, **_kwargs):
html_val = view_func() if callable(view_func) else view_func
if inspect.iscoroutine(html_val): # handle async function returning html
Expand All @@ -247,15 +247,13 @@ def add_url_rule(
)

def setup_index(self, dash_app: Dash): # type: ignore[name-defined]

async def index(*args, **kwargs):
return Response(dash_app.index(*args, **kwargs), content_type="text/html") # type: ignore[arg-type]

# pylint: disable=protected-access
dash_app._add_url("", index, methods=["GET"])

def setup_catchall(self, dash_app: Dash):

async def catchall(
path: str, *args, **kwargs
): # noqa: ARG001 - path is unused but kept for route signature, pylint: disable=unused-argument
Expand Down Expand Up @@ -331,7 +329,6 @@ async def serve(package_name, fingerprinted_path):

# pylint: disable=unused-argument
def dispatch(self, dash_app: Dash): # type: ignore[name-defined] Quart always async

async def _dispatch():
adapter = QuartRequestAdapter()
body = await adapter.get_json()
Expand All @@ -351,7 +348,9 @@ async def _dispatch():

return _dispatch

def register_callback_api_routes(self, callback_api_paths: _t.Dict[str, _t.Callable[..., _t.Any]]):
def register_callback_api_routes(
self, callback_api_paths: _t.Dict[str, _t.Callable[..., _t.Any]]
):
"""
Register callback API endpoints on the Quart app.
Each key in callback_api_paths is a route, each value is a handler (sync or async).
Expand Down
Loading