• PEP about recommended project folder layout

    From c.buhtz@posteo.jp@21:1/5 to All on Tue Jul 26 07:14:42 2022
    Hello,

    I am not sure if I looked into the correct sources. I was looking in
    "PEP 609 – Python Packaging Authority (PyPA) Governance" [1] and the
    "PyPA specifications" [2].

    My question in short: Is there an official document (e.g. a PEP) about a recommended layout for project folders.

    Looking into the wild and past there are a lot of variations of such
    layouts. I am far away from being a pro but depending on experience in
    my own projects and what I have learned from others (e.g. in blog-posts/tutorials) I recommend to have the "test" folder and the
    package folder side by side on the same level in the project folder (the root).

    my_project
    |- tests
    | └ test_*.py
    |- my_package
    | └ __init__.py
    └-- README.md

    I sometimes add to it the so called "src"-Layout where the package
    folder is one level deeper in an extra "src" folder.

    my_project
    |- tests
    | └ test_*.py
    |- src
    | └- my_package
    | └ __init__.py
    └-- README.md

    I don't want to discuss the pros and cons of all variations. What I need
    is an official document I can use in discussions with other maintainers.
    If there is a PEP/document against my current recommendation I am also
    fine with this. ;)

    Kind
    Christian

    [1] -- <https://peps.python.org/pep-0609/>
    [2] -- <https://packaging.python.org/en/latest/specifications>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c.buhtz@posteo.jp@21:1/5 to c.buhtz@posteo.jp on Sat Jul 30 12:49:05 2022
    Isn't there a PEP?

    On 2022-07-26 07:14 c.buhtz@posteo.jp wrote:
    Hello,

    I am not sure if I looked into the correct sources. I was looking in
    "PEP 609 – Python Packaging Authority (PyPA) Governance" [1] and the
    "PyPA specifications" [2].

    My question in short: Is there an official document (e.g. a PEP)
    about a recommended layout for project folders.

    Looking into the wild and past there are a lot of variations of such layouts. I am far away from being a pro but depending on experience
    in my own projects and what I have learned from others (e.g. in blog-posts/tutorials) I recommend to have the "test" folder and the
    package folder side by side on the same level in the project folder
    (the root).

    my_project
    |- tests
    | └ test_*.py
    |- my_package
    | └ __init__.py
    └-- README.md

    I sometimes add to it the so called "src"-Layout where the package
    folder is one level deeper in an extra "src" folder.

    my_project
    |- tests
    | └ test_*.py
    |- src
    | └- my_package
    | └ __init__.py
    └-- README.md

    I don't want to discuss the pros and cons of all variations. What I
    need is an official document I can use in discussions with other
    maintainers. If there is a PEP/document against my current
    recommendation I am also fine with this. ;)

    Kind
    Christian

    [1] -- <https://peps.python.org/pep-0609/>
    [2] -- <https://packaging.python.org/en/latest/specifications>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Barry@21:1/5 to All on Sat Jul 30 21:34:23 2022
    On 30 Jul 2022, at 13:52, c.buhtz@posteo.jp wrote:

    Isn't there a PEP?

    PEP are for improving python. They are not for telling people how to use python.
    I would be surprised to fine a PEP that addressed this.

    Barry


    On 2022-07-26 07:14 c.buhtz@posteo.jp wrote:
    Hello,

    I am not sure if I looked into the correct sources. I was looking in
    "PEP 609 – Python Packaging Authority (PyPA) Governance" [1] and the
    "PyPA specifications" [2].

    My question in short: Is there an official document (e.g. a PEP)
    about a recommended layout for project folders.

    Looking into the wild and past there are a lot of variations of such
    layouts. I am far away from being a pro but depending on experience
    in my own projects and what I have learned from others (e.g. in
    blog-posts/tutorials) I recommend to have the "test" folder and the
    package folder side by side on the same level in the project folder
    (the root).

    my_project
    |- tests
    | └ test_*.py
    |- my_package
    | └ __init__.py
    └-- README.md

    I sometimes add to it the so called "src"-Layout where the package
    folder is one level deeper in an extra "src" folder.

    my_project
    |- tests
    | └ test_*.py
    |- src
    | └- my_package
    | └ __init__.py
    └-- README.md

    I don't want to discuss the pros and cons of all variations. What I
    need is an official document I can use in discussions with other
    maintainers. If there is a PEP/document against my current
    recommendation I am also fine with this. ;)

    Kind
    Christian

    [1] -- <https://peps.python.org/pep-0609/>
    [2] -- <https://packaging.python.org/en/latest/specifications>

    --
    https://mail.python.org/mailman/listinfo/python-list

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Angelico@21:1/5 to Gerard on Sun Jul 31 21:03:03 2022
    On Sun, 31 Jul 2022 at 20:27, Weatherby,Gerard <gweatherby@uchc.edu> wrote:

    I’m not aware of any standard convention for laying out packages.

    PEP 8 (https://peps.python.org/pep-0008/) specifies conventions for how to write Python, so a standard layout PEP would not be inconsistent.


    PEP 8 species rules for laying out the code of the Python standard
    library. Its adoption by other projects does not constitute the Python developers declaring that it's a convention for how to write all
    Python code.

    A better example would be PEP 257 https://peps.python.org/pep-0257/
    but even that is more for the purpose of tooling. It does at least try
    to describe usage conventions, though.

    Conventions for laying out packages (as opposed to actual requirements
    defined by the packaging system itself) would be better described
    somewhere other than a PEP.

    ChrisA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Weatherby,Gerard@21:1/5 to All on Sun Jul 31 10:16:35 2022
    SeKAmW0gbm90IGF3YXJlIG9mIGFueSBzdGFuZGFyZCBjb252ZW50aW9uIGZvciBsYXlpbmcgb3V0 IHBhY2thZ2VzLg0KDQpQRVAgOCAoaHR0cHM6Ly9wZXBzLnB5dGhvbi5vcmcvcGVwLTAwMDgvKSBz cGVjaWZpZXMgY29udmVudGlvbnMgZm9yIGhvdyB0byB3cml0ZSBQeXRob24sIHNvIGEgc3RhbmRh cmQgbGF5b3V0IFBFUCB3b3VsZCBub3QgYmUgaW5jb25zaXN0ZW50Lg0KDQrigJQNCkdlcmFyZCBX ZWF0aGVyYnkgfCBBcHBsaWNhdGlvbiBBcmNoaXRlY3QgTk1SYm94IHwgTkFOIHwgRGVwYXJ0bWVu dCBvZiBNb2xlY3VsYXIgQmlvbG9neSBhbmQgQmlvcGh5c2ljcw0KIFVDb25uIEhlYWx0aCAyNjMg RmFybWluZ3RvbiBBdmVudWUsIEZhcm1pbmd0b24sIENUIDA2MDMwLTY0MDYgdWNoYy5lZHUNCk9u IEp1bCAzMCwgMjAyMiwgNDozNyBQTSAtMDQwMCwgQmFycnkgPGJhcnJ5QGJhcnJ5cy1lbWFjcy5v cmc+LCB3cm90ZToNCioqKiBBdHRlbnRpb246IFRoaXMgaXMgYW4gZXh0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