Skip to main content

Realdep

Stop AI coding agents from installing packages that don't exist, or shouldn't. Realdep checks every package an agent tries to install (or add to a manifest) against the real registry before it happens, and blocks hallucinated names, typosquats and freshly registered slopsquats, telling the agent the name it probably meant.

CI Python License PyPI Dependencies


The problem: slopsquatting

Language models regularly invent package names that sound right but don't exist: huggingface-cli-tools, react-codeshift, flask-jwt-simple-auth. Attackers watch for those names, register them on PyPI or npm, and fill them with malware. The next agent that hallucinates the same name runs pip install <name> and executes the attacker's code with your permissions. This is called slopsquatting.

Classic typosquats (reqeusts, expresss) and import-name confusion (pip install sklearn, which should be scikit-learn) hit agents the same way, because agents type fast and never double-check.

What Realdep does

Before an install runs, Realdep:

  1. Parses the command or manifest change: pip, uv, poetry, pipenv, pdm, pipx, uvx, npm, npx, yarn, pnpm, bun, cargo, go, gem; requirement files passed with -r; and edits to requirements.txt, pyproject.toml, package.json, Cargo.toml, go.mod and Gemfile.
  2. Skips the thousands of packages everyone uses (bundled popularity lists, no network needed).
  3. Asks the real registry about everything else: does it exist, when was it first published, how many releases, how many downloads, does it run install scripts?
  4. Decides:
Verdict When
Block The name does not exist (hallucinated) · it is one or two characters from a popular package and not heavily used itself (typosquat) · first published in the last 7 days · new, 1-2 releases and almost no downloads (the slopsquatting profile) · on your deny list
Warn Import name instead of package name (sklearn, cv2, yaml, bs4…) · published in the last 30 days · very little use · install scripts · deprecated · placeholder version · git/URL/path installs · custom index or --extra-index-url (dependency confusion)
Allow Everything else
  1. Tells the agent how to fix it. A block comes with the reason and the likely intended name, so the agent corrects itself instead of retrying:
$ realdep check -- pip install fastapi reqeusts sklearn
BLOCK pypi     reqeusts
        'reqeusts' does not exist on PyPI; it may be a hallucinated name. Did you mean 'requests'?
        suggestion: requests
WARN  pypi     sklearn
        'sklearn' is an import name; the package that provides it is 'scikit-learn'
        suggestion: scikit-learn
ok    pypi     fastapi
        widely used (top 63 on PyPI)
$ realdep pkg npm react-codeshift expresss
BLOCK npm      react-codeshift
        matches the slopsquatting profile: first published 321 day(s) ago, 1 release(s), 15 downloads last week
BLOCK npm      expresss
        name is one or two characters away from the popular package 'express' (possible typosquat)
        only release is a placeholder version (0.0.0)
        suggestion: express

Install

pip install realdep

Python 3.11+. Zero runtime dependencies (standard library only), because a supply-chain guard should not widen your supply chain.

Use it

Agents that support command hooks before tool use can run Realdep on every shell command and file edit:

realdep hook --print-config
{"hooks": {"PreToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command": "realdep hook", "timeout": 30}]}]}}

Merge that into your agent's hooks settings. Blocked installs exit with code 2 and a reason the agent reads, and warnings appear as a system message. Unrelated commands pass in milliseconds with no network. See docs/hooks.md.

Check by hand

realdep check -- npm i some-package            # exit 3 if anything is blocked
realdep pkg pypi requests reqeusts             # check names directly
realdep check --strict -- pip install x        # exit 3 on warnings too

CI

realdep scan requirements.txt package.json pyproject.toml   # exit 3 on any block

Catch hallucinated dependencies that slipped into a pull request. See docs/ci.md.

Coverage

Ecosystem Commands Manifests Registry checks
Python pip, pip3, python -m pip, uv (pip/add/tool), uvx, poetry, pipenv, pdm, rye, pipx requirements*.txt/.in, pyproject.toml (PEP 621, Poetry, dependency groups) PyPI JSON API, pypistats
JavaScript npm (install/exec), npx, yarn, pnpm, bun, bunx package.json npm registry, npm downloads API
Rust cargo add/install Cargo.toml crates.io
Go go get/install go.mod Go module proxy
Ruby gem install Gemfile RubyGems

How it compares

Package auditors (npm audit, Socket, pip-audit) Other slopsquatting CLIs Realdep
Runs before the agent installs no (after, or in CI) yes yes
Ecosystems one or several usually one 5
Install commands and manifest edits manifests commands both
Tells the agent the intended name no rarely yes
Import-name confusion (sklearn, cv2) no no yes
Works offline for popular packages n/a no yes
Runtime dependencies many some 0

Use Realdep alongside dependency auditing: it stops bad names from getting in, and auditors find vulnerabilities in the good ones.

Documentation

Getting started · Decision rules · Agent hooks · CI · Configuration · Threat model · FAQ

Limitations

  • An old, popular, legitimate-looking package that turns malicious is a different problem; use a vulnerability and malware scanner for that.
  • Decisions use public registry metadata and heuristics. Tune thresholds and keep allow/deny lists in .realdep.json.
  • Private registries and custom indexes are flagged, not verified.
  • If the registry is unreachable, Realdep warns and allows by default (fail_closed changes that).

Reporting problems

Found a bug, or Realdep got a result wrong? Open an issue and include the output of:

realdep doctor

It prints versions, platform and configuration health with paths, your user name and secrets removed, so it is safe to paste. Report security vulnerabilities privately instead; see SECURITY.md.

Security

Report vulnerabilities privately: see SECURITY.md.

License

Apache License 2.0. Copyright 2026 Prayash Bikram Shah. Bundled popularity data is credited in NOTICE.

Metadata

Release files for realdep 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for realdep 0.1.2
File Size Uploaded Provenance Actions
realdep-0.1.2.tar.gz 110.3 kB With provenance Details for realdep-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for realdep 0.1.2
File Interpreter ABI Platform Actions
realdep-0.1.2-py3-none-any.whl Python 3 none any Details for realdep-0.1.2-py3-none-any.whl

Total release size: 213.8 kB

Release files / realdep-0.1.2.tar.gz

Download URL realdep-0.1.2.tar.gz
Size 110.3 kB
Tags Source
SHA-256 checksum
How to use checksums
55ec17c012a64c398a48a2746276925f1e0f0677103aef35be7bf7cf58afc85d
BLAKE2b-256 checksum
How to use checksums
6a1b5b2d7932a8a9393b5f067b51e41c221c9bc6514e6c78130957ac3a505657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / realdep-0.1.2-py3-none-any.whl

Download URL realdep-0.1.2-py3-none-any.whl
Size 103.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
368d211a1f574d6ba08d14554ee4919699d8b09f9184fac724acecbffcc50bd4
BLAKE2b-256 checksum
How to use checksums
58806186fd19d496f32af89df65f5c56eef9b1689b44e935613d34928c2fae4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for realdep 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for realdep-0.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page