dpgaspar commented on issue #9077: [SIP-35] Proposal for Improving Superset’s 
Python Code Organization
URL: 
https://github.com/apache/incubator-superset/issues/9077#issuecomment-586899389
 
 
   Adding my two cents here:
   
   Regarding blueprints: I'm inclined on delegating the actual registering to 
each module manager. We can still say that they occur within `app.py` but the 
specifics are encapsulated on the module manager itself.
   
   This way:
   - We would reduce the centralized complexity of `app.py`
   - Handle module specifics at the module level
   
   For example:
   ```
   - superset/
       - datasets/
           - manager.py (implements `register_views`)
           - commands/
             - CRUD (create.py, update.py, delete.py ...)
             - Custom (export.py, ...)
           - api.py
           - schemas.py
           - dao.py
       - dashboards/
         ...
       - charts/
       - databases/
       - commands/
          - base.py
            ....
       - api/
           - base.py
   ....
   ```
   
   So `app.py` would call each module's `manager.register_views()` with 
additional pre and post hooks. This kind of pattern can open up the app for 
external extensions, since additional modules can be independently installed 
(pip) and loaded in order using config, for example:
   
   ```
   ADDONS = [
       middleware1.Middleware1Manager,
       middleware2.Middleware2Manager,
       ...
   ]
   ```
   ```
   Just a thought, could db_engine_specs follow a similar pattern?
   
   The blueprints are handled by FAB's `BaseApi` or it's child `ModelRestApi` 
that creates a blueprint with all routes registered under the same API resource 
namespace, `api/v1/dataset/*`, `api/v1/databases` and OpenAPI spec 
tag/grouping. 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to