Elbenfreund Elbenfreund - 4 months ago 12
Python Question

Is it PEP8 compliant to import CamelCase as lowercase?

According to PEP8 modules should be lowercase. Some popular ones out there (e.g. Gtk) however follow the CamelCase convention.

In order to have a pythonic codebase and mitigate spillage of this policy breach it seems like the following is a clean way to deal with this (please note that this is not specific to


from gi.repository import Gtk as gtk

Linters such as pep8-naming however claim that such practice violates PEP8 and throw an

As I failed to find any direct passage in PEP8 addressing this I was wondering which way to go in order to stay true to the zen of python.


Gtk is a class not a module. Class names should use CapWords convention.

You can read more about that here.