aminghadersohi commented on code in PR #35163: URL: https://github.com/apache/superset/pull/35163#discussion_r2370061046
########## superset/mcp_service/flask_singleton.py: ########## @@ -0,0 +1,46 @@ +""" +Simple module-level Flask app instance for MCP service. + +Following the Stack Overflow recommendation: +"a simple module with just the instance is enough" +- The module itself acts as the singleton +- No need for complex patterns or metaclasses +- Clean and Pythonic approach +""" + +import logging + +from flask import Flask + +logger = logging.getLogger(__name__) + +logger.info("Creating Flask app instance for MCP service") + +try: + from superset.app import create_app + from superset.mcp_service.mcp_config import get_mcp_config + + # Create the Flask app instance - this is the singleton + app = create_app() Review Comment: Good question, this code is _not_ creating a _second_ Flask app - it's creating the main superset Flask app instance for use within the MCP service. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org