What's the Pythonic analog of Node's <domain>.<kind>.js flat-file naming, given Python's naming rules and import system differ from JS's?
Fix: Follow PEP 8 for naming regardless of file layout: modules and packages get short, all-lowercase, underscore-separated names — this differs from a domain.kind.js-style flat filename, which PEP 8 doesn't use as a pattern. For structuring an installable package, use the src-layout (nest importable code under src/): it forces installing the package before running tests, catching import/packaging mistakes a flat layout would hide. A natural extension consistent with (though not explicitly mandated by) that src-layout emphasis on clear package boundaries is one package per domain (a directory, e.g. users/) containing role-named modules (repository.py, service.py, provider.py) — a direct consequence of Python's package-based import model rather than a rule stated in the packaging guide itself.
pythonnaming-conventionproject-structurepep8
References
- https://peps.python.org/pep-0008/ — Modules should have short, all-lowercase names; underscores can be used if it improves readability. Packages should also be short, all-lowercase, underscores discouraged.
- https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/ — The src layout nests importable code inside src/, forcing installation before testing, which surfaces packaging/import mistakes a flat layout hides.