ktmud edited a comment on issue #9077: [SIP-35] Proposal for Improving 
Superset’s Python Code Organization
URL: 
https://github.com/apache/incubator-superset/issues/9077#issuecomment-586536501
 
 
   Chime in my two cents as a passerby.  I really like that different modules 
have their independent folders and we are introducing conventions and 
increasing consistency. I think an intuitive code structure and consistent 
paradigms help a lot for future contributors to understand the code.
   
   Sharing the approach I took in one of my older projects ([a general purpose 
CMS](https://github.com/ktmud/david/tree/master/david
   )).  It's slightly different than what is proposed, but very similar in 
concept.
   
   All my python files are organized [like 
this](https://github.com/ktmud/david/tree/master/david):
   
   ```
   ├── __init__.py
   ├── app.py
   ├── core/   # core data models, user accounts, base data entities etc
   ├── ext/      # 3rd-party/non-essential extensions, s3 uploads, etc
   ├── lib/       # db mixins, cache decorators, utilities
   ├── modules/   # modules as organized in the main menu (URL route)
   │   ├── __init__.py  # import and compose all modules
   │   ├── module_1
   │   │   ├── __init__.py
   │   │   ├── admin.py   # admin views, a separate Blueprint for editing 
objects
   │   │   ├── model.py   # operation on data entities, objects for data access
   │   │   └── view.py     # User facing Blueprint for "module_1", handlers 
parsing parameters
   │   ├── module_2
   │   │   ├── __init__.py
   │   │   ├── admin.py
   │   │   ├── model.py
   │   │   └── view.py
   ```
   
   I find the separation of core/shared functionalities (and the addition of a 
"modules" folder) especially useful because it makes the whole project easier 
to navigate.
   
   Loading modules  and booting the app is as simple as 
[this](https://github.com/ktmud/david/blob/master/david/ext/modules.py). It 
seems we can avoid `boot.py` this way.
   
   Hope this helps.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to