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-executableVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade to Python 3.7 or newer, or pin `flake8-executable<2.1.2` in your project dependencies.
Ensure `flake8` is installed via `pip install flake8` in the same virtual environment as `flake8-executable`.
To ignore specific errors, use `ignore = EXE004` in your Flake8 config. To exclude files/directories, use `exclude = my_data_scripts/`.
Install Flake8: `pip install flake8`.
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`).
Grant executable permission to the file: `chmod +x filename`. If the file is not meant to be executable, remove the shebang line.
Remove the `--check-executable` (or similar) argument. Simply run `flake8` and the plugin will automatically apply its checks.