-vvv option).OS version and name: Linux D01RI1900987 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Poetry version: Poetry version 1.0.0b3
poetry does not seem to correctly handle packages with capital letters
$ poetry new myPackage
/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
Created package myPackage in myPackage
$ ls
myPackage
It correctly contains the capitalized name
$ cat myPackage/pyproject.toml
[tool.poetry]
name = "myPackage"
version = "0.1.0"
description = ""
authors = ["Panos Mavrogiorgos <[email protected]>"]
[tool.poetry.dependencies]
python = "^2.7"
[tool.poetry.dev-dependencies]
pytest = "^4.6"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Nevertheless, the created package is in lowercase...
$ ls myPackage
mypackage tests README.rst pyproject.toml
$ poetry build
/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
Building myPackage (0.1.0)
- Building sdist
- Built myPackage-0.1.0.tar.gz
- Building wheel
- Built myPackage-0.1.0-py2.py3-none-any.whl
But if we rename the package to myPackage then there is an exception.
$ mv mypackage myPackage
$ ls
myPackage tests README.rst pyproject.toml
$ poetry build -vvv
/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads.
"program uses threads.", RuntimeWarning)
Using virtualenv: /home/pmav99/.cache/pypoetry/virtualenvs/mypackage--uDnKC_a-py2.7
Building myPackage (0.1.0)
[ModuleOrPackageNotFound]
No file/folder found for package mypackage
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/pmav99/.poetry/bin/poetry", line 14, in <module>
main()
File "/home/pmav99/.poetry/lib/poetry/console/__init__.py", line 5, in main
return Application().run()
File "/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/clikit/console_application.py", line 139, in run
trace.render(io, simple=isinstance(e, CliKitException))
File "/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/clikit/ui/components/exception_trace.py", line 57, in render
self._render_traceback(io, tb)
File "/home/pmav99/.poetry/lib/poetry/_vendor/py2.7/clikit/ui/components/exception_trace.py", line 67, in _render_traceback
io.write_line("".join(traceback.format_list(frames)))
File "/usr/lib/python2.7/traceback.py", line 39, in format_list
item = ' File "%s", line %d, in %s\n' % (filename,lineno,name)
TypeError: %d format: a number is required, not str
Could this be something similar to #1303 - #1305?
Hello,
poetry is forced to rename package folder to lower case and replaces . and - by _. This convention is defined by PEP8.
It looks a little bit counter intuitive that the name in pyproject.toml stayes the same like the project folder and not the renamed package folder.
I could change this behavior, in that way, that the name value gets also renamed. But I'm not sure if this is intended? @sdispater
I would argue that PEP 8 is a style guide. A widely accepted one, but still, nothing more than a suggestion. There are projects that use capital letters in their letters and this could prevent them from adopting poetry.
That being said, even if there is some reason that poetry can't support mixed cases (filesystems that ignore cases?), the following output is wrong:
$ poetry new myPackage
Created package myPackage in myPackage
More specifically, this part:
Created package myPackage in myPackage
Hello again,
you can use camel case package names. But then you have to define it in the pyproject.toml like this:
packages = [
{include = "myPackage"}
]
See also here.
And yes, the output message is incorrect.
Great, thank you @finswimmer.
Do you think we can close this issue, if my fix about showing the message correct is merged?
I got the same problem in 1.0.0. @finswimmer fix worked for me. The message I got was a stack trace which was less than helpful. Still, the solution works so thank you.
Most helpful comment
Hello again,
you can use camel case package names. But then you have to define it in the
pyproject.tomllike this:See also here.
And yes, the output message is incorrect.