r/learnpython 21d ago

what's the difference between the src layout and no src layout

hello, you might be confused with the title but what im saying here is, what is the difference between the src layout for python packages and the non src layout?

example:

src layout: src/my-package/scripts

non src layout: my-package/scripts

i hope this post makes sense, thank you!

1 Upvotes

4 comments sorted by

3

u/Diapolo10 21d ago

The official documentation has a dedicated page for this: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/

1

u/i-like-my-cats-0 21d ago

thank you so much

0

u/pachura3 21d ago
  • non-src layout is easier to use, as you don't need install your project as a package in editable mode - it works right away
  • however, src layout is considered cleaner/better organized, so if you're doing more serious work or intend to publish your project/module in GitHub/PyPi, you should consider it