Poetry: Poetry build can't find source files

Created on 7 May 2018  ·  6Comments  ·  Source: python-poetry/poetry

I'm trying to poetry build a Python project, but it fails with the message:

  [ValueError]                          
  No file/folder found for package fig

poetry install and poetry update work fine, and I can build using the standard setup.py bdist_wheel. I have trying adding the following to my pyproject.toml but no luck:

[package]
include = ["src/*.py"]

Any pointers as to what I'm doing wrong would be highly appreciated.

Most helpful comment

I was wondering this also. By default it seems like if you call your project example-project it'll make the python package example_project. However, I'd rather the package be named exampleproject.

All 6 comments

Ah, I see, the package directory actually needs to have the same name as the project. Is there a way to specify a different name? Like it can be specified in setup.py, as:

```
package_dir={'': 'src'}

I was wondering this also. By default it seems like if you call your project example-project it'll make the python package example_project. However, I'd rather the package be named exampleproject.

At the moment, poetry looks automatically for the normalised project name as the package or module name.

Regarding a src/ layout, this is supported in the develop branch and will be available in version 0.9.0. Note, however, that poetry will still look for a package/module derived from the project name defined in pyproject.toml 

Just to make sure I understand, so the source layout will have to be something like this?

project/
    src/
        project/
            project.py

Not exactly. Let's say the structure of your project is a package you would need to have something like this:

my-package/
└── src/
    └── my_package/
        └── __init__.py

If your project is a module, it would be:

my-package/
└── src/
    └── my_package.py

Ah I see. Yes that makes sense.

Thanks for the explanation, I'll close this issue then and wait for 0.9.0. :smiley:

Was this page helpful?
0 / 5 - 0 ratings