Skip to main content

flake8 plugin that checks for code in `__init__.py` modules

Project description

flake8-empty-init-modules

flake8 plugin that disallows code in __init__.py modules.

installation

python -m pip install flake8-empty-init-modules

checks

EIM001

Disallows all code in any __init__.py module.

EIM002

Allows imports and assignment to __all__ in __init__.py modules, but nothing else.

This check is disabled by default. To use this check instead of EIM001 add the following to your setup.cfg

[flake8]
ignore = EIM001
enable-extensions=EIM002

rationale

Code in __init__.py modules is often unwanted because:

  • it runs at import-time - this can cause surprising import-time side-effects
  • these modules are often empty, so code there is easily missed

The relaxed version of this check allows convenience imports in __init__.py modules without allowing 'real' code to hide out there.

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

flake8_empty_init_modules-1.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

flake8_empty_init_modules-1.0.1-py2.py3-none-any.whl (3.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file flake8_empty_init_modules-1.0.1.tar.gz.

File metadata

File hashes

Hashes for flake8_empty_init_modules-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ede08296359844c09b200acb3f71844e901bfcf57d30f5e128bcaf5182fbf2cc
MD5 d8a7217c523202cca8ed90b97e8d2585
BLAKE2b-256 82d2ab6dd8b4b51f910b17e3b1f1bdd5af2e63e62939415ad3f41c670290812a

See more details on using hashes here.

File details

Details for the file flake8_empty_init_modules-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_empty_init_modules-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4e9a2438e5a0d94e3e4d42ffec9e91d3afcfa66a47a921f1651d219293822d8c
MD5 d74264d113ecc3d88da105e70e919ca1
BLAKE2b-256 3c4ace7de89627047161e7b61555c4c536e12d69ec528a2a14933a8eee7504b1

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