Skip to content
Researched developer tool comparisonsPrices dated · vendor sources linked · no star ratings
Search

Stage 04 · Run · Researched comparison

Best Python Security Linters in 2026

Bandit is the first pick for most teams. It is a free, open-source tool from the PyCQA project that scans Python source for common security issues, and it fits cleanly into any CI pipeline. Semgrep is the stronger choice when you need custom rules or multi-language coverage. Ruff is the fastest option if you already use it for linting and want security rules in the same run. pip-audit covers a different job: known vulnerabilities in your dependencies.

By
Published 27 Nov 2026 · 7 tools compared

We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.

Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.

Key takeaways

  • Bandit is free and open source, and it focuses on Python source code patterns rather than dependencies.
  • Semgrep Community Edition is free and runs locally or in CI, with a paid Semgrep AppSec Platform above it.
  • Ruff includes flake8-bandit rules (the S rule set), so you can get Bandit-style checks without a second tool.
  • pip-audit, Safety, CodeQL and Snyk Code add dependency scanning or deeper analysis, and each has different licence and pricing terms.

Who each pick is for

  • Python teams that want a free, focused source scannerBandit
  • Teams that want custom rules and multi-language scanningSemgrep
  • Teams already using Ruff who want security rules in the same runRuff
  • Checking installed Python dependencies against known vulnerability databasespip-audit
  • Dependency scanning with an optional commercial dashboardSafety
  • Deep semantic analysis, free for public repositoriesCodeQL
  • Teams that want a commercial platform with IDE and pull request integrationSnyk Code

Comparison

The 7 tools at a glance
ToolBest forStandout featureListed starting priceFree plan or trial
1BanditPython teams that want a free, focused source scannerPurpose-built for Python security patternsFree (open source)Free plan
2SemgrepTeams that want custom rules and multi-language scanningLarge public rule registryFree (open source)Free plan
3RuffTeams already using Ruff who want security rules in the same runVery fastFree (open source)Free plan
4pip-auditChecking installed Python dependencies against known vulnerability databasesAudits installed environments and requirements filesFree (open source)Free plan
5SafetyDependency scanning with an optional commercial dashboardCLI checks requirements and environmentsSee vendor pricing pageFree plan
6CodeQLDeep semantic analysis, free for public repositoriesSemantic code analysis with a real query languageFree for public repositoriesFree plan
7Snyk CodeTeams that want a commercial platform with IDE and pull request integrationIDE plugins and pull request checksSee vendor pricing pageFree trial (limited free tier)

How we picked

We picked tools that genuinely perform Python security static analysis or dependency vulnerability scanning, and that are currently maintained. Criteria were fit for the job, supported platforms, licence and pricing model, and the main limits documented by each project. We also noted whether a tool runs locally, which matters when source code is sensitive. Sources are vendor websites, official documentation and project repositories. Prices and free-tier limits change, so confirm them on the vendor site before you commit.

The tools, one by one

01

Bandit

Best for python teams that want a free, focused source scanner

Visit github.com
Bandit homepage
Bandit homepage, captured Nov 2026

What it is and where it fits

Bandit reads Python source and flags patterns such as hardcoded passwords, use of `eval`, weak hashing, insecure `subprocess` calls and unsafe deserialization. It ships as a pip package and runs from the command line, so it works on any OS with Python. You can tune it with a config file, skip specific checks, and set severity thresholds so a CI job fails only on medium or high findings.

The project is maintained under the PyCQA organisation and is free under an open-source licence. It has no paid tier and no hosted dashboard, so results live in your terminal or CI logs. It does not scan dependencies or third-party packages. Teams that need cross-file data-flow analysis or custom organisational rules should pair it with Semgrep or move to a commercial platform.

Standout: Purpose-built for Python security patterns

Pricing pointer

Free (open source), as listed by the vendor (Bandit website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Purpose-built for Python security patterns
  • simple CLI and config file
  • plugin system for custom checks

Drawbacks

  • Source-only, so it does not check dependencies
  • rule set is narrower than general-purpose SAST tools

Skip it if this limit matters to you: source-only, so it does not check dependencies.

Verdict. A sensible pick for python teams that want a free, focused source scanner.

Alternatives in this guide: Semgrep, Ruff, pip-audit

02

Semgrep

Best for teams that want custom rules and multi-language scanning

Visit semgrep.dev
Semgrep homepage
Semgrep homepage, captured Nov 2026

What it is and where it fits

Semgrep is a pattern-based static analysis engine. Its Python rules cover injection, insecure deserialization, hardcoded secrets and framework-specific issues. Rules are written in YAML and are easy to read and adapt, which makes it practical to encode your own team conventions. It runs as a CLI on Linux, macOS and Windows, and the Community Edition is free under an open-source licence.

The paid Semgrep AppSec Platform adds a hosted dashboard, pull request comments, policy management and deeper analysis. Pricing for that tier is not fixed in public documentation, so check the vendor pricing page. Semgrep is a good fit when you want one engine across several languages or need rules tailored to your codebase. If you only want default Python checks and nothing custom, Bandit or Ruff may be simpler.

Standout: Large public rule registry

Pricing pointer

Free (open source), as listed by the vendor (Semgrep website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Large public rule registry
  • rules are readable YAML
  • runs locally, in CI or as a hosted service

Drawbacks

  • Community Edition lacks some platform features
  • advanced cross-file analysis sits in paid tiers

Skip it if this limit matters to you: community Edition lacks some platform features.

Verdict. A sensible pick for teams that want custom rules and multi-language scanning.

Alternatives in this guide: Bandit, Ruff, pip-audit

03

Ruff

Best for teams already using Ruff who want security rules in the same run

Visit github.com
Ruff homepage
Ruff homepage, captured Nov 2026

What it is and where it fits

Ruff is a Python linter and formatter written in Rust. It reimplements a large set of flake8 plugins, including flake8-bandit, exposed as the `S` rule set. Enabling those rules gives you Bandit-style checks for hardcoded passwords, `eval`, weak crypto and similar patterns, run at the same time as your style and import checks.

Ruff is free and open source, distributed as a standalone binary for Linux, macOS and Windows, and also installable via pip. Because it replaces several tools in one pass, it is a practical choice for teams that want fewer CI steps. The trade-off is depth: the security rules mirror flake8-bandit rather than adding new analysis, and Ruff does not scan dependencies. For custom rules or data-flow analysis, pair it with Semgrep.

Standout: Very fast

Pricing pointer

Free (open source), as listed by the vendor (Ruff website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Very fast
  • one tool for style, bugs and Bandit-style security rules
  • single binary with no Python dependency

Drawbacks

  • Security coverage is limited to the ported flake8-bandit rules
  • not a substitute for dependency scanning

Skip it if this limit matters to you: security coverage is limited to the ported flake8-bandit rules.

Verdict. A sensible pick for teams already using Ruff who want security rules in the same run.

Alternatives in this guide: Bandit, Semgrep, pip-audit

04

pip-audit

Best for checking installed Python dependencies against known vulnerability databases

Visit github.com
pip-audit homepage
pip-audit homepage, captured Nov 2026

What it is and where it fits

pip-audit is maintained by the Python Packaging Authority. It takes an environment, a requirements file or a lock file and checks each package against known advisories from the Python Packaging Advisory Database and OSV. It can also suggest fixed versions and, with the right flags, apply them.

It runs on any platform with Python and is free under an open-source licence. It is the natural complement to a source scanner: Bandit or Ruff finds problems in your code, and pip-audit finds problems in what you install. It does not detect insecure code patterns, so it is not a replacement for a linter. Run it in CI on every dependency change, and note that results depend on the freshness of the upstream advisory data.

Standout: Audits installed environments and requirements files

Pricing pointer

Free (open source), as listed by the vendor (pip-audit website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Audits installed environments and requirements files
  • uses the PyPI advisory database and OSV
  • can output fixes

Drawbacks

  • Dependency-focused only
  • it does not read your source code

Skip it if this limit matters to you: dependency-focused only.

Verdict. A sensible pick for checking installed Python dependencies against known vulnerability databases.

Alternatives in this guide: Bandit, Semgrep, Ruff

05

Safety

Best for dependency scanning with an optional commercial dashboard

Visit github.com
Safety homepage
Safety homepage, captured Nov 2026

What it is and where it fits

Safety scans Python dependencies for known vulnerabilities. The open-source CLI reads requirements files or an installed environment and reports advisories. The commercial Safety platform adds a hosted dashboard, organisation policies, reporting and integrations for teams that need audit trails.

The CLI is free to use under an open-source licence, and the paid platform is priced separately. Because the free and paid feature split and the price points have changed over time, check the vendor pricing page before you plan a rollout. Safety overlaps with pip-audit; the choice usually comes down to whether you want a hosted dashboard and support contract. For a pure command-line check with no account, pip-audit is the lighter option.

Standout: CLI checks requirements and environments

Pricing pointer

See vendor pricing page, as listed by the vendor (Safety website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • CLI checks requirements and environments
  • paid platform adds policy and reporting
  • CI-friendly output

Drawbacks

  • Free tier is limited compared with the paid platform
  • pricing tiers change, so confirm on the vendor site

Skip it if this limit matters to you: free tier is limited compared with the paid platform.

Verdict. A sensible pick for dependency scanning with an optional commercial dashboard.

Alternatives in this guide: Bandit, Semgrep, Ruff

06

CodeQL

Best for deep semantic analysis, free for public repositories

Visit github.com
CodeQL homepage
CodeQL homepage, captured Nov 2026

What it is and where it fits

CodeQL treats code as data and runs queries against a database built from your repository. Its Python queries cover injection, path traversal, unsafe deserialization, weak cryptography and more. Because it reasons about data flow rather than matching text patterns, it can find issues that line-based linters miss, at the cost of longer run times.

The CodeQL engine and query packs are open source. Running CodeQL on public repositories through GitHub code scanning is free. For private repositories, code scanning requires a GitHub plan that includes it, so confirm the current terms on GitHub's pricing page. Setup involves a workflow or CLI step to build the database. It suits teams already on GitHub who want deeper analysis; small projects may find Bandit or Ruff enough.

Standout: Semantic code analysis with a real query language

Pricing pointer

Free for public repositories, as listed by the vendor (CodeQL website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Semantic code analysis with a real query language
  • deep Python coverage
  • integrates with GitHub code scanning

Drawbacks

  • Private-repository use requires a GitHub plan that includes code scanning
  • setup is heavier than a CLI linter

Skip it if this limit matters to you: private-repository use requires a GitHub plan that includes code scanning.

Verdict. A sensible pick for deep semantic analysis, free for public repositories.

Alternatives in this guide: Bandit, Semgrep, Ruff

07

Snyk Code

Best for teams that want a commercial platform with IDE and pull request integration

Visit snyk.io
Snyk Code homepage
Snyk Code homepage, captured Nov 2026

What it is and where it fits

Snyk Code is a commercial static analysis product that scans source code, including Python, for security issues. It integrates with IDEs, repositories and CI, and reports code and open-source dependency findings in one place. That combined view is useful for teams that do not want separate tools for source and packages.

The free tier has limits on the number of tests per month and on some features, and paid plans are quoted per developer or by usage. Because those numbers change, check the vendor pricing page rather than relying on secondhand figures. Snyk Code is a reasonable fit for organisations that want a supported platform with dashboards and support. Teams that only need local checks can stay with free tools.

Standout: IDE plugins and pull request checks

Pricing pointer

See vendor pricing page, as listed by the vendor (Snyk Code website). Confirm the current plan price before you buy.

Free trial (limited free tier). Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • IDE plugins and pull request checks
  • combines code and dependency findings
  • broad language support

Drawbacks

  • Commercial product with usage limits on the free tier
  • full pricing needs a quote or the vendor page

Skip it if this limit matters to you: commercial product with usage limits on the free tier.

Verdict. A sensible pick for teams that want a commercial platform with IDE and pull request integration.

Alternatives in this guide: Bandit, Semgrep, Ruff

Who should use what

A solo developer on a small project should start with Ruff if it is already in use, or Bandit if not, and add pip-audit for dependencies. A team with a mixed-language codebase and custom policy needs will get more from Semgrep, using the free Community Edition and moving to the paid platform only when dashboards and policy management are required. An organisation on GitHub with private repositories and a need for deep analysis should evaluate CodeQL and confirm plan requirements first. A company that wants a supported commercial platform with IDE and pull request integration should look at Snyk Code or the paid Semgrep and Safety tiers.

Questions to settle before you buy

What to check before you buy

  • Confirm the tool scans the Python versions and frameworks your project actually uses.
  • Check whether it covers source code, dependencies, or both, and fill the gap with a second tool if needed.
  • Verify the licence and whether CI use, private repositories or commercial projects change the terms.
  • Decide whether findings must stay local; prefer tools that run offline if source code is sensitive.
  • Test the exit codes and severity thresholds so CI fails on the right findings and not on noise.

FAQ

Do I need both a code scanner and a dependency scanner?

Yes, in most cases. A code scanner such as Bandit, Semgrep or Ruff finds insecure patterns in your own source. A dependency scanner such as pip-audit or Safety finds known vulnerabilities in packages you install. They cover different risks, and running both is common practice.

Is Bandit enough on its own?

Bandit is a solid baseline for Python source code, but it does not check dependencies and its rules are pattern-based. Teams with higher requirements often add pip-audit for packages and Semgrep or CodeQL for deeper analysis. For small projects, Bandit alone is a reasonable start.

Can I run these tools without sending code to a third party?

Bandit, Ruff, pip-audit, Semgrep Community Edition and CodeQL can all run locally or in your own CI. Hosted platforms such as Snyk Code and the paid Semgrep and Safety tiers process code on vendor infrastructure, so review their data handling terms first. Never paste secrets or production credentials into third-party web pages.

Does Ruff replace Bandit?

Ruff implements the flake8-bandit rules, so it covers many of the same checks in a faster run. It does not cover everything Bandit does, and it does not scan dependencies. If you already use Ruff, enabling the S rules is a low-cost start; keep Bandit if you need its full plugin set.

Are the free tiers really free for commercial work?

It depends on the tool. Bandit, Ruff, pip-audit and Semgrep Community Edition are open source and free to use, including commercially, under their licences. CodeQL is free for public repositories, while private use depends on your GitHub plan. Snyk Code and the paid Semgrep and Safety tiers have their own terms, so check the vendor pages.

Sources we checked

Method: how we score · editorial policy.

  1. Bandit (official site)
  2. Semgrep (official site)
  3. Ruff (official site)
  4. pip-audit (official site)
  5. Safety (official site)
  6. CodeQL (official site)
  7. Snyk Code (official site)

Change log. First published 27 Nov 2026.