5

PEP8 advises that module and package names have all-lowercase names. The majority of packages on PyPI seem to follow this rule. Yet there are some packages of clearly very capable and PEP8-aware developers that have capitalized their package name.

Examples:

  • Sphinx and Pygments by Georg Brandl
  • Django by Simon Willison, Jacob-Kaplan Moss, ...
  • Fabric by Jeff Forcier

Why did these developers capitalize their package names?

Community
  • 1
  • 1
Bentley4
  • 10,678
  • 25
  • 83
  • 134
  • `PEP 8` is for the Python standard library. Other projects are welcome to use it, but it is not a universal guideline. – Ethan Furman Mar 25 '21 at 12:51

3 Answers3

8

In all the example cases you give the packages do follow the PEP-8 naming convention:

  • Sphinx's top-level package is called sphinx
  • Pygments' top-level package is called pygments
  • Django's top-level package is called django
  • Fabric's top-level package is called fabric

What you see using capitals is the distribution package, not the python package in the PEP-8 sense. Naturally, these projects have chosen to capitalize their project names and the distribution package reflects that project name.

Python distribution packages do not need to be named the same as the python package that they contain. This is by design; you can put multiple packages into a distribution, for example, and thus the contents should not dictate the distribution name.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
1

Because the most insightful paragraph in the whole of PEP8 is the one about how "A Foolish Consistency is the Hobgoblin of Little Minds":

A style guide is about consistency.
Consistency with this style guide is important.
Consistency within a project is more important. 
Consistency within one module or function is most important.
gvalkov
  • 3,977
  • 30
  • 31
  • 3
    Yes, as long as there is a reason to break that consistency that is more important than the benefit of having that consistency for the community. I am asking what those reasons were to capitalize their project. If they for no reason whatsoever chose to capitalize their packages while being aware of that PEP8 advice that is just 'foolish'. (Only a minor annoyance though) – Bentley4 Sep 09 '12 at 10:30
  • There is no inconsistency here though. The names are not package names but *distribution* names. The distributed packages follow the PEP-8 naming conventions just fine. – Martijn Pieters Sep 09 '12 at 11:09
0

The short answer: nobody cares

The longer answer:

  • if you're having a namespace package like x.y.z then name should be lower-case only

  • if you're having a package representing like a "brand" like "Django" then it is for me also appropriate to name that package "Django" as part of the metadata. Keep in mind that the package name must not represent the actually package
    structure inside the package.