Registry / testing / flake8-executable

flake8-executable

JSON →
library2.1.3pypypi✓ verified 86d ago

flake8-executable (v2.1.3) is a Flake8 plugin designed to enforce best practices for executable files, checking for correct shebangs and file permissions. It integrates seamlessly with the Flake8 linter, providing automated checks that help maintain code quality and prevent common script execution issues. The library is actively maintained, with releases primarily focused on Python version compatibility and bug fixes.

pip install flake8-executable
INSTALL
IMPORT
SIG · FLAKE8-EXECUTABLE
F
flake8-executable
testingpythonv2.1.3
Install
1.8s avg
Import
11ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.012s · 19.3MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.8s · import 0.008s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

__version__
from flake8_executable import __version__
Users typically do not import flake8-executable directly; it's automatically loaded by Flake8. This import is mainly for programmatic version checking.

After installing `flake8-executable`, run `flake8` as you normally would. The plugin automatically integrates, checking for issues like missing shebangs (`EXE001`), incorrect shebangs (`EXE002`), or missing executable permissions (`EXE003`). The quickstart demonstrates how to install and run `flake8` with the plugin activated.

# 1. Install flake8 and flake8-executable pip install flake8 flake8-executable # 2. Create an example executable script (e.g., 'myscript.sh') # Note: This file should be marked as executable (e.g., chmod +x myscript.sh) # and have a shebang. # Example 'myscript.sh' content: # #!/bin/bash # echo "Hello from a script!" # 3. Run flake8 against your project # It will automatically detect and use flake8-executable. # Example with a specific file: # flake8 myscript.sh # Or to run on your current directory (assuming myscript.sh is there): # flake8 . # Expected output for a correctly configured script (no errors): # (No output) # If 'myscript.sh' had no shebang (EXE001) or wrong permissions (EXE003), # flake8 would report it.
flake8 --version
Debug
Known issues
breakingPython 3.6 support was dropped in v2.1.2. Users on Python 3.6 will need to upgrade their Python version or use an older version of flake8-executable (<2.1.2).
fix
Upgrade to Python 3.7 or newer, or pin `flake8-executable<2.1.2` in your project dependencies.
affects: >=2.1.2
gotchaflake8-executable requires Flake8 to be installed and available in the same environment. It is a plugin, not a standalone tool. Running `flake8` without a working `flake8` installation will result in a 'command not found' or similar error.
fix
Ensure `flake8` is installed via `pip install flake8` in the same virtual environment as `flake8-executable`.
affects: All versions
gotchaFile detection for 'executable' can sometimes be broader than intended. For example, a file with a shebang but without executable permissions might still be flagged (EXE004) if it's not meant to be executable. Configure Flake8's `exclude` or `ignore` options in `pyproject.toml`, `setup.cfg`, or `.flake8` to manage these.
fix
To ignore specific errors, use `ignore = EXE004` in your Flake8 config. To exclude files/directories, use `exclude = my_data_scripts/`.
affects: All versions
Errors
Common errors & fixes
flake8: command not found
The `flake8` command-line tool is not installed or not in your system's PATH.
fix
Install Flake8: `pip install flake8`.
File has no shebang (EXE001)
flake8-executable detected a file that appears to be an executable (e.g., `chmod +x` was applied) but lacks a `#!` shebang line.
fix
Add a shebang line to the top of the file (e.g., `#!/usr/bin/env python3` or `#!/bin/bash`). If the file is not meant to be executable, remove its executable permissions (`chmod -x filename`).
Executable file is missing executable permission (EXE003)
A file with a shebang was detected, implying it should be executable, but it does not have the executable permission bit set.
fix
Grant executable permission to the file: `chmod +x filename`. If the file is not meant to be executable, remove the shebang line.
flake8: error: unrecognized arguments: --check-executable
You are trying to explicitly enable flake8-executable with a command-line argument, but plugins are typically auto-detected and run by `flake8` without special flags.
fix
Remove the `--check-executable` (or similar) argument. Simply run `flake8` and the plugin will automatically apply its checks.
Upgrade
Version history
2.1.3latest on PyPI · released Jan 23, 2023
Audit
Dependencies
flake8requiredThis package is a plugin for Flake8 and requires Flake8 to be installed and run to function.
Agent activity
8 hits · last 30 days
node
8
Resources
flake8-executable — pip install flake8-executable · libregistry