Poetry: Can't build a distribution that has a different name from the package

Created on 31 Oct 2018  Â·  4Comments  Â·  Source: python-poetry/poetry

  • [X] I am on the latest Poetry version.
  • [X] I have searched the issues of this repo and believe that this is not a duplicate.
  • [X] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I maintain a package that has the name, on PyPI, of "django-lrucache-backend", but the package itself is named "lrucache_backend", and I can't build the package with the correct name. Django packages, in particular, follow this pattern quite often.

Distribution name: django_mypackage
Package name: mypackage

[tool.poetry]
name = "django-lrucache-backend"

When I try to build the package:

$ poetry build -vvv 
Virtualenv django-lrucache-backend-py3.6 already exists.
Using virtualenv: /Users/josh/Library/Caches/pypoetry/virtualenvs/django-lrucache-backend-py3.6
Building django-lrucache-backend (2.0.0)

[ValueError]
No file/folder found for package django-lrucache-backend

Exception trace:
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/_vendor/cleo/application.py in run() at line 94
   status_code = self.do_run(input_, output_)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/application.py in do_run() at line 88
   return super(Application, self).do_run(i, o)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/_vendor/cleo/application.py in do_run() at line 197
   status_code = command.run(input_, output_)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/commands/command.py in run() at line 72
   return super(BaseCommand, self).run(i, o)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/_vendor/cleo/commands/base_command.py in run() at line 146
   status_code = self.execute(input_, output_)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/_vendor/cleo/commands/command.py in execute() at line 107
   return self.handle()
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/commands/build.py in handle() at line 27
   builder.build(fmt)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/masonry/builder.py in build() at line 19
   builder = self._FORMATS[fmt](self._poetry, self._venv, self._io)
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/masonry/builders/builder.py in __init__() at line 35
   includes=self._package.include,
 /Users/josh/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/masonry/utils/module.py in __init__() at line 51
   raise ValueError("No file/folder found for package {}".format(name))

Most helpful comment

You can specify the package(s) using the packages key.

All 4 comments

I think it would be better to make the Python package / module name configurable frompyproject.toml, instead of deriving it implicitly from the setuptools distribution name.

Robot Framework libraries have a similar convention where the names differ. The pip packages are robotframework-name-here and the module names are NameHereLibrary.

You can specify the package(s) using the packages key.

Amazing! Wish I had seen that sooner. Poetry is proving to be the best
python tool I have ever had the pleasure of working with. Now I just need
to find a donation button.

On Thu, Nov 1, 2018, 12:26 Sébastien Eustace <[email protected]
wrote:

Closed #587 https://github.com/sdispater/poetry/issues/587.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/sdispater/poetry/issues/587#event-1941064651, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AD6KchGM5H8qlJtf34oDDnmhrVxiZ011ks5uqy7GgaJpZM4YD7Dq
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikaro picture nikaro  Â·  3Comments

probablykasper picture probablykasper  Â·  3Comments

ulope picture ulope  Â·  3Comments

alexlatchford picture alexlatchford  Â·  3Comments

kierun picture kierun  Â·  3Comments