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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8_empty_init_modules-1.0.0.tar.gz
.
File metadata
- Download URL: flake8_empty_init_modules-1.0.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfd2e43a8cd0803f12ab23c8c3a375317e5a481cd86904d88d263a1b4787c631 |
|
MD5 | aa053763905690570e5bb7e955697283 |
|
BLAKE2b-256 | 24445799d29dd67a2553e47cd4ba27bad51c68e2f14c425e1fa44c63482786e5 |
File details
Details for the file flake8_empty_init_modules-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: flake8_empty_init_modules-1.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba8668bc1748d415061e36b398e40397eb86932e0087b987da0f8275ccae97d1 |
|
MD5 | c940fa4ca9403b37b449259cf1594adc |
|
BLAKE2b-256 | f49671a6948433ccc3b9296a4f6a6a7f3ca26aa06fbaadf07da824bd1f194bee |