Skip to content

Add an explanation of the standard project structure #8713

@todofixthis

Description

@todofixthis
  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

In the documentation for the packages section in pyproject.toml it says:

If your project structure differs from the standard one supported by poetry, you can specify the packages you want to include in the final distribution.

I was curious about this, and went hunting for documentation explaining what poetry considers as the standard project structure. However, I wasn't able to find anything definitive.

The closest I got was this in the project setup instructions:

This will create the poetry-demo directory with the following content:

poetry-demo
├── pyproject.toml
├── README.md
├── poetry_demo
│   └── __init__.py
└── tests
    └── __init__.py

I think the idea here is that the standard project structure includes pyproject.toml, README.md, tests, and a top-level package whose name matches (or is a snake-case variant of) the value of the name section in pyproject.toml.

It could be helpful to have something in the documentation that explains this explicitly, so that developers can easily understand whether they need to include packages in their project's pyproject.toml file.


In my case, I was trying to solve an issue where poetry build fails with "No file/folder found for package <package_name>".

I'm working on a perma-fork of an OSS lib that I built at a previous job — the project is named phx-class-registry, but the top-level package is named class_registry so that it can be a drop-in replacement for the (abandoned 😭) class-registry project.

When I saw the error "No file/folder found for package phx-class-registry" I was pretty sure that I needed to include a packages section in my pyproject.toml, so I checked the poetry documentation for more information. That's when I came across the reference to the standard project structure, which confused me (though I did eventually get things figured out).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/docsDocumentation issues/improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions