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
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.1.tar.gz
.
File metadata
- Download URL: flake8_empty_init_modules-1.0.1.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 | ede08296359844c09b200acb3f71844e901bfcf57d30f5e128bcaf5182fbf2cc |
|
MD5 | d8a7217c523202cca8ed90b97e8d2585 |
|
BLAKE2b-256 | 82d2ab6dd8b4b51f910b17e3b1f1bdd5af2e63e62939415ad3f41c670290812a |
File details
Details for the file flake8_empty_init_modules-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: flake8_empty_init_modules-1.0.1-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 | 4e9a2438e5a0d94e3e4d42ffec9e91d3afcfa66a47a921f1651d219293822d8c |
|
MD5 | d74264d113ecc3d88da105e70e919ca1 |
|
BLAKE2b-256 | 3c4ace7de89627047161e7b61555c4c536e12d69ec528a2a14933a8eee7504b1 |