Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poetry build can't find source files #92

Closed
berislavlopac opened this issue May 7, 2018 · 9 comments
Closed

Poetry build can't find source files #92

berislavlopac opened this issue May 7, 2018 · 9 comments

Comments

@berislavlopac
Copy link

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.

@berislavlopac
Copy link
Author

berislavlopac commented May 7, 2018

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'}

@monkeez
Copy link
Contributor

monkeez commented May 7, 2018

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.

@sdispater
Copy link
Member

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 

@berislavlopac
Copy link
Author

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

project/
    src/
        project/
            project.py

@sdispater
Copy link
Member

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

@berislavlopac
Copy link
Author

Ah I see. Yes that makes sense.

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

l0b0 added a commit to linz/geostore that referenced this issue Oct 28, 2021
Poetry requires the source directory to have the same name as the project
name, as per <python-poetry/poetry#92>.
l0b0 added a commit to linz/geostore that referenced this issue Oct 28, 2021
Poetry requires the source directory to have the same name as the project
name, as per <python-poetry/poetry#92>.
l0b0 added a commit to linz/geostore that referenced this issue Oct 28, 2021
Poetry requires the source directory to have the same name as the project
name, as per <python-poetry/poetry#92>.
kodiakhq bot pushed a commit to linz/geostore that referenced this issue Oct 31, 2021
Poetry requires the source directory to have the same name as the project
name, as per <python-poetry/poetry#92>.

Co-authored-by: Mitchell Paff <[email protected]>
dimbleby pushed a commit to dimbleby/poetry that referenced this issue Apr 21, 2022
@baggiponte
Copy link

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

Just to make sure: this implies we don't have to specify anything about the project being in src in the pyproject.toml - because poetry will already know to look for your package inside src, am I right?

@iuriguilherme
Copy link

Just to make sure: this implies we don't have to specify anything about the project being in src in the pyproject.toml - because poetry will already know to look for your package inside src, am I right?

No, this assumption is incorrect. you need to add to the pyproject.toml the following:

[tool.poetry]
packages = [{include = "my_package", from = "src"}]

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants