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>
On 30 Jul 2022, at 13:52, c.buhtz@posteo.jp wrote:
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>
--
https://mail.python.org/mailman/listinfo/python-list
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.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (3 / 13) |
Uptime: | 71:47:55 |
Calls: | 6,657 |
Calls today: | 3 |
Files: | 12,203 |
Messages: | 5,332,233 |
Posted today: | 1 |