(Nov-08-2019, 02:12 PM)joel_graff Wrote: It's a neat solution, but it, unfortunately, breaks the structure I must maintain.No it dos not beak anything,the tree dos not get touch.
Can lift sub modules or have full path it's all up to you.
What this is about to make it is easier for users of package,you can keep the structure you want on the back-end.
Maybe your package design is not so good if coupling is to tight or names to long.
To use Requests as example.
One main import
import requests
and 90 % of the most used tool(get,post,session,json...ect) is on top level and easy to access. >>> import requests >>> >>> requests.get <function get at 0x0117D660> >>> requests.post <function post at 0x01192300> >>> requests.sessions() <module 'requests.sessions' from .... sessions.py'> >>> requests.status_codes <module 'requests.status_codes' from ... status_codes.py'>Eg if back-end tree structure was
requests/web/tool/post
.It would be annoying to use this import:
requests.web.tool.postWhen
post
and get
should be together,so here could lift post
up.For lesser used tool then have to navigate a little eg utils tool.
>>> import requests >>> >>> requests.utils.guess_json_utf <function guess_json_utf at 0x0116D738> >>> requests.utils.codecs.ascii_decode <built-in function ascii_decode>