Hacker News new | past | comments | ask | show | jobs | submit login
For Python packages, file structure != API (benhoyt.com)
32 points by benhoyt on June 30, 2023 | hide | past | favorite | 4 comments



You can also make a single file Python package that achieves the same API.

https://www.stefaanlippens.net/single-python-module-packagin... has info on how to do this (not my page, but seems clear)


Funny 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?


You 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).


Super, that's what I was hoping for, thank you




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: