Argparse Python 3.14 enhancements#1331
Merged
Merged
Conversation
The argparse lib in Py314 now can do suggestion of an argument when a typo is given. It only works on choices, but regardless it can be handy to users of Bandit. Besides Python 3.15 plans to enable this by default. The other change is the color being disabled. Color in CLIs defaults to True in Python 3.14. And frankly it doesn't look good. Way too many colors being used. https://docs.python.org/3/library/argparse.html#suggest-on-error Signed-off-by: Eric Brown <eric_wade_brown@yahoo.com>
Member
Author
Member
Author
|
This is the suggest_on_error feature in action. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds Python 3.14 enhancements to the argparse configuration across Bandit's CLI entry points. The changes enable argument suggestions on typos (via suggest_on_error) and disable the default colored output (via color = False) for Python 3.14+, improving the user experience while maintaining compatibility with earlier Python versions.
- Enables
suggest_on_errorfor helpful argument suggestions when users make typos - Disables colored output which defaults to True in Python 3.14 but doesn't look good in Bandit's output
- Applies changes consistently across all three CLI entry points (main, config_generator, and baseline)
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| bandit/cli/main.py | Adds Python 3.14 argparse enhancements to the main Bandit CLI entry point |
| bandit/cli/config_generator.py | Adds Python 3.14 argparse enhancements to the config generator CLI |
| bandit/cli/baseline.py | Adds Python 3.14 argparse enhancements to the baseline CLI |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sigmavirus24
approved these changes
Nov 19, 2025
This was referenced Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The argparse lib in Py314 now can do suggestion of an argument when a typo is given. It only works on choices, but regardless it can be handy to users of Bandit. Besides Python 3.15 plans to enable this by default.
The other change is the color being disabled. Color in CLIs defaults to True in Python 3.14. And frankly it doesn't look good. Way too many colors being used.
https://docs.python.org/3/library/argparse.html#suggest-on-error