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
extend-select = 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.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

flake8_empty_init_modules-1.0.0-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.0.tar.gz.

File metadata

File hashes

Hashes for flake8_empty_init_modules-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bfd2e43a8cd0803f12ab23c8c3a375317e5a481cd86904d88d263a1b4787c631
MD5 aa053763905690570e5bb7e955697283
BLAKE2b-256 24445799d29dd67a2553e47cd4ba27bad51c68e2f14c425e1fa44c63482786e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flake8_empty_init_modules-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ba8668bc1748d415061e36b398e40397eb86932e0087b987da0f8275ccae97d1
MD5 c940fa4ca9403b37b449259cf1594adc
BLAKE2b-256 f49671a6948433ccc3b9296a4f6a6a7f3ca26aa06fbaadf07da824bd1f194bee

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