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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

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