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?

Python · verified Jul 5, 2026

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