Skip to main content

Plugin for PyLint that checks if we import only modules or packages. Direct imports of classes, functions and constants are forbidden

Project description

How it works?

It marks importing anything but modules/packages as invalid with a message only-importing-modules-is-allowed. This adheres to Google’s Python style guide.

An example:

from functools import partial  # invalid
import functools  # valid
from some_module.some_subomdule import SomeClass  # invalid
from some_module import some_subomdule  # valid

Why?

To not force people to manual check if something we imported is a module or not.

How to use it?

After installing a package just run pylint, appending pylint_google_style_guide_imports_enforcing to your –load-plugins option.

An example:

pylint my_cool_project --load-plugins=pylint_google_style_guide_imports_enforcing

or append it to your pylintrc file:

[MASTER]
load-plugins=pylint_google_style_guide_imports_enforcing

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

File details

Details for the file pylint_google_style_guide_imports_enforcing-1.0.3.tar.gz.

File metadata

File hashes

Hashes for pylint_google_style_guide_imports_enforcing-1.0.3.tar.gz
Algorithm Hash digest
SHA256 2722db3b7e43f3dd202c1174135d72693045b3a075894cf7cd2f91083e497b59
MD5 cefec56e5c566b40fbcda0daf339515c
BLAKE2b-256 4eb08a59b2c9eaa9df32550971a3412b6dfd382bb494a96ab3e0140308057ab4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page