3 ms·
For Python packages, file structure != API
- seanthemon 3y agoFunny enough, i'm a new pythonista and I have found this SO frustrating, this solves a lot of problems for me. But i'm wondering, could this be an anti-pattern for large code bases?
- ayhanfuat 3y agoYou probably wouldn't want to expose everything at the top level but something similar is possible in submodules as well (i.e. your file structure might be 5 levels deep but you expose only through the second level via those submodules' __init__.py files).
- seanthemon 3y agoSuper, that's what I was hoping for, thank you
- michalc 3y agoYou can also make a single file Python package that achieves the same API. https://www.stefaanlippens.net/single-python-module-packaging-hatch.html https://www.stefaanlippens.net/single-python-module-packagin... has info on how to do this (not my page, but seems clear)