question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry and capital letter in package names

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-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

Issue

poetry does not seem to correctly handle packages with capital letters

create a new package

$ 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

Inspect pyproject.

It correctly contains the capitalized name

$ cat myPackage/pyproject.toml
[tool.poetry]
name = "myPackage"
version = "0.1.0"
description = ""
authors = ["Panos Mavrogiorgos <pmav99@gmail.com>"]

[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

Try to build a wheel - everything seems fine:

$  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

Use Capital letters

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?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
finswimmercommented, Nov 19, 2019

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.

4reactions
mdaeroncommented, Jul 27, 2021

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.

I would like to ask about reopening this issue to carefully consider the case for supporting capitalized package names. I am the author of the D47crunch package used by geochemists, and I am trying to switch to poetry. There are two strong reasons I will not change the package name at this point:

  1. Asking users to switch to a new package is going to be a mess;
  2. Semantically, there is a critical difference between d47 and D47 in geochemistry, so in this case the uppercase D is part of the message.

I am a big fan of style guidelines, both for code and for writing in general, but I also believe it’s important to know how/when to deviate from the default style. It would be great if there was a simple way to force preservation of the original capitalization, perhaps with a strongly worded warning pointing to PEP 8. If this is simply not technically possible and/or unacceptable on philosophical grounds, authors of existing capitalized packages will have to do without poetry, which would suck.

Thanks for hearing me out and for the great work you’ve done so far.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CAPITALIZATIONS IN POETRY: TO CAPITALIZE OR NOT TO ...
“Capitalizing the first letter of each beginning word in a line of poetry is traditional, if not contemporary and common. Historically, this is ......
Read more >
WHEN AND HOW to Use Capitalization in Your Poetry
1. Capitalization with Titles. Every first letter of the word is capitalized and you follow the regular format of titling something. Something ...
Read more >
Capital Letters and Abbreviations - University of Sussex
(k) In the title or name of a book, a play, a poem, a film, a magazine, a newspaper or a piece of...
Read more >
How can I avoid capital letter in the authors' names using ...
My problem is that the used style makes the names of the authors capital which I do not want except from the first...
Read more >
7.1. Naming and Capitalization Conventions - Java ... - O'Reilly
The following widely adopted naming conventions apply to packages, ... A type name should begin with a capital letter and be written in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found