Poetry: Allow to define package source dir in pyproject.toml

Created on 6 Jun 2018  路  6Comments  路  Source: python-poetry/poetry

Poetry has the convention of the package title being the same as the package dir name. However, this is not always the desired behavior.

Here's an example of a package called foliantcontrib.includes which is in fact exports foliant.preprocessors.includes module. In setup.py, package name and the names of the exported packages are independent: https://github.com/foliant-docs/foliantcontrib.includes/blob/develop/setup.py#L23.

Poetry could have an option src that would point to the source code path within the project path. By the way, this could be an alternative way to support src layout: you'd just set src: src/mypackage.

Most helpful comment

The packages section of the tool.poetry section should address this: https://poetry.eustace.io/docs/pyproject/#packages

All 6 comments

I'll note that the packages I want to switch to Poetry use namespace packing, so this issue is also relevant https://github.com/sdispater/poetry/issues/167

I also need this.

I have a project named coverage-space, but the package is coveragespace.

In my organization, we put all of our code under one namespace abc. We have multiple packages, so the layout is like:

abc-projectA/
   pyproject.toml
   abc/
      projectA/
         __init__.py
abc-projectB/
   pyproject.toml
   abc/
      projectB/
         __init__.py

It would be great if poetry could support namespace packages for this reason. Would it be better to be able to configure the "source" directory in pyproject.toml?

Namespace packages and custom package dir are two different features.

I think it's fairly common for the PyPI name and package name to be different.

https://pypi.org/project/minilog/ is used as import log.

Can this library be developed using Poetry?

The packages section of the tool.poetry section should address this: https://poetry.eustace.io/docs/pyproject/#packages

Was this page helpful?
0 / 5 - 0 ratings