Open Source Python Tools in 2026: How to Vet Dependencies Before You Install

··13 min read
Open Source Python Tools in 2026: How to Vet Dependencies Before You Install

Last year a small agency we follow got a ransomware note after a developer ran pip install on a package with a name one letter off from a popular library. The package had been live for nine days, pulled a few thousand downloads, and carried a credential stealer that read environment variables on import. Nothing about the attack was clever. It was a typo that a busy person did not stop to check. That story is no longer unusual. Python's package index, PyPI, hosts well over 600,000 projects, and security firms have reported thousands of malicious packages removed from it over the past few years. Typosquatting, dependency confusion, compromised maintainer accounts, and quietly malicious updates to packages that were fine yesterday are all live threats. Meanwhile, the average Python project pulls in dozens of transitive dependencies, most of which nobody on the team has ever read. This article is about how to vet Python dependencies before they touch your machine or your build pipeline. We will cover what open source security vetting actually means in practice, a repeatable checklist you can run in about fifteen minutes per package, a worked example with real numbers, a comparison of the tools that automate parts of the process, and the places where automation still fails you. You will leave with a procedure, not just a sense of unease.

Key Takeaways
  • Treat every new dependency, including transitive ones, as code you are running with full privileges, because installation executes arbitrary code in many cases.
  • Pin exact versions and hashes in a lock file so an upstream change cannot silently reach your builds.
  • Check the package's publisher, release history, and maintainer count before you check its features. Most red flags show up there.
  • Run an automated scanner (pip-audit, Safety, or Snyk) on every build, but do not treat a clean scan as proof of safety.
  • Install into isolated environments and inspect install-time scripts (setup.py, build backends, .pth files) before trusting a package in production.
  • Limit the secrets available to your development and CI environments, since most dependency-based attacks aim to steal credentials.

What does open source Python security vetting actually mean?

Vetting is the process of deciding whether a third-party package is safe to bring into your project, and whether it stays safe over time. It is not a single scan. It has three layers: verifying identity (is this really the package I think it is?), assessing health (is it maintained, and by whom?), and inspecting behavior (what does it do when installed and imported?).

Most teams do only the second layer, usually by checking GitHub stars or the last commit date. That catches abandoned projects but misses the attacks that matter most. Stars are trivially inflated, and a malicious package can be freshly published with a convincing README.

The three layers in plain terms

  • Identity: Confirm the exact package name, the publisher, and that the source repository linked on PyPI really contains the code that was uploaded.
  • Health: Look at maintainers, release cadence, open security issues, and how the project handles vulnerability reports.
  • Behavior: Read install hooks, look for network calls, file system writes outside expected paths, and obfuscated code.

How do you vet a Python package step by step?

The following walkthrough takes about fifteen minutes for a package you have not used before. For packages you already depend on, run it when you upgrade a version, focusing on the diff.

  1. Verify the name. Search PyPI for the package and compare the name character by character against the one in your requirements file. Typosquats often differ by a hyphen, an underscore, a swapped letter, or a plural. If the package appeared in a tutorial or AI-generated snippet, check that the name matches the project's official documentation.
  2. Check the publisher and history. On the PyPI project page, note the first release date, the number of releases, and the maintainer list. A package with a first upload three weeks ago and a single maintainer, presented as a mature library, deserves scrutiny.
  3. Confirm the source repository. Follow the project URL to the linked repository. Check that the repo exists, that its history is consistent with the release history, and that the package name matches the one in pyproject.toml or setup.py.
  4. Look at the release diff. For a new version, download both the old and new sdists or wheels and diff them. Pay attention to newly added files, network-related imports (urllib, requests, socket), base64 or zlib blobs, and changes to build backends or install scripts.
  5. Inspect install-time code. Packages that build from source can run arbitrary code during installation. Read setup.py, any custom cmdclass entries, and the [build-system] table. Wheels are generally safer because they do not execute build code, but a wheel can still ship a .pth file that runs code at every interpreter startup.
  6. Check known vulnerabilities. Run pip-audit against the candidate version. Read the advisory if one exists, and note whether a fixed version is available.
  7. Review the dependency tree. Run pip install --dry-run --report report.json your-package and look at everything it would pull in. Each extra transitive dependency is another party you have implicitly trusted.
  8. Record the decision. Add a one-line note to your dependency file or internal wiki: package, version, date reviewed, reviewer. This makes future audits faster and creates a trail if something goes wrong.

A worked example with real numbers

Say your team's API service uses 14 direct dependencies. Using pipdeptree, you find they expand to 63 packages once transitive dependencies are included. You are about to add a new JSON parsing library that promises a 4x speedup.

Running steps 1 through 3 takes about four minutes. The package has existed for two years, has 3 maintainers, and links to a repository with 180 commits. Step 4 is the one that takes longer. The latest version bump from 2.1.0 to 2.1.1 added 1,400 lines to a file named _compat.py, including a base64 blob and an exec call. That is not proof of malice, but it is the single most important finding of the whole process. You open a ticket, pin the older version, and report the change to the maintainers. In the meantime you avoid a build that would have shipped the change on the next scheduled update.

Multiply this by 63 packages and a team doing this review for every direct and transitive dependency would spend about sixteen hours on the initial audit. That is the real cost, and it is why most teams rely on tooling for the mechanical parts.

Which tools automate dependency vetting?

No tool replaces judgment, but several cover different parts of the workflow. The comparison below reflects what we have seen in practice across small and mid-sized teams. Pricing and feature sets change, so verify against current documentation before committing.

Tool Primary purpose Cost model Transitive dependency coverage Lock file / hash support Best for
pip-audit Known vulnerability scanning (PyPA project) Free, open source Yes Yes, with requirements files Every CI build as a baseline check
Safety Vulnerability database scanning with policy controls Free tier plus paid commercial database Yes Yes Teams wanting policy rules and reporting
Snyk Vulnerability scanning and license checks across languages Free tier, paid per developer Yes Partial Organizations already using Snyk elsewhere
Socket Behavioral analysis of packages (network, install scripts, obfuscation) Free tier plus paid Yes Limited Catching malicious packages that have no CVE yet
Manual review (diff + pipdeptree) Human inspection of changes and tree Staff time Only what you choose to review Yes, if you enforce it High-risk or privileged dependencies

Why the behavioral category matters

Vulnerability scanners only know about problems that someone has already reported and assigned an identifier. A brand-new malicious package has no CVE. Behavioral tools look at what the code does, which is why they catch the cases that matter most for supply chain attacks. The honest tradeoff is false positives: minified code and legitimate native extensions trip many heuristics, so someone still has to triage the alerts.

What a sensible baseline looks like

For most small teams we would recommend three things. First, pip-audit in CI, since it is free and maintained by the Python Packaging Authority. Second, a hash-pinned lock file generated with pip-tools or uv, so that pip install --require-hashes refuses anything that does not match. Third, a short written policy for adding new direct dependencies, which is where the manual review from the walkthrough earns its keep. Add a behavioral scanner once you have that foundation and find you are still anxious.

How do you lock down your install environment?

Vetting reduces the chance of a bad package entering your project. Containment limits the damage when one gets through anyway, and it is the cheapest layer to improve.

Practical containment steps

  • Use isolated environments. Create a virtual environment or container per project. Do not install packages into your system interpreter.
  • Keep secrets out of developer shells. Most credential-stealing packages read environment variables and dotfiles. Use a secrets manager and inject credentials only into the processes that need them.
  • Restrict CI permissions. A build job that installs dependencies rarely needs to push to production. Split the install step from the deploy step and give each only what it requires.
  • Mirror or proxy your index. An internal proxy lets you freeze the set of packages available to builds and log every new version that enters your environment.
  • Delay upgrades intentionally. Many compromised releases are discovered within days. A seven-day cooldown on non-critical upgrades catches a surprising number of them.

Credentials deserve their own attention

Because so many supply chain payloads target credentials, the state of your team's secrets matters as much as the state of your requirements file. If developers share logins or keep long-lived tokens in .env files, a single malicious package can harvest access to everything. Our related guides on password manager practices for small teams and Cover image: Dependency diagram of some Blue Obelisk projects by Original: O'Boyle et al. Vector: Mrmw, licensed under BY 2.0 via Openverse.

Recent Posts

View all →

Most Popular Software

View all →

Browse by Platform

View all →