- Home
- Skills
- APIs & Backend
- Python Requirements.txt vs Imports Checker
Works with the AI Agents you already use
Python Requirements.txt vs Imports Checker
Scan a Python project with the AST, compare real imports against requirements.txt, and surface likely missing or stale dependencies without modifying your environment.
Free
Python Requirements.txt vs Imports Checker
Example session with this skill installed
Check this Python project for dependency drift.
Use the current repository and compare the Python imports against:
requirements.txt
Requirements
- recursively scan all .py files using Python AST;
- ignore virtual environments, caches, dist/build folders, and site-packages;
- ignore Python standard-library modules;
- ignore project-local modules and packages;
- detect imports used in source but not declared in requirements.txt;
- detect dependencies declared in requirements.txt but not observed in the scanned Python imports;
- handle common distribution/import mismatches such as Pillow/PIL, PyYAML/yaml, scikit-learn/sklearn, opencv-python/cv2, and python-dotenv/dotenv;
- recognize literal importlib.import_module() and import() calls when possible;
- do not remove, install, or modify dependencies;
- do not claim a declared package is definitely unused when dynamic, plugin, CLI, notebook, or deployment usage could exist;
- generate requirements_imports_report.md and requirements_imports_report.json;
- show likely missing declarations first because they pose the highest runtime risk.
- Read your context and instructions
- Compiled the python requirements txt
Python dependency check complete
Status
FAIL
Python files scanned
86
Declared requirements
24
Observed third-party imports
23
Used/imported but not declared
2
Declared but not observed
3
Matched
21
Used/imported but not declared
pandas
Confidence
HIGH
Observed
src/analytics/report.py:4
Import
import pandas as pd
Risk
The application may fail in a clean deployment if pandas is not installed through another dependency source.
httpx
Confidence
HIGH
Observed
src/api/client.py:7
Import
import httpx
Declared but not observed
numpy
Confidence
MEDIUM
No matching static import was observed.
Review before removal
- dynamic imports
- notebook usage
- plugin loading
- CLI scripts
- deployment tooling
unused-package
Confidence
MEDIUM
No matching static import was observed.
python-dateutil
Confidence
MEDIUM
No matching static import was observed.
Known package/import mappings resolved
Pillow → PIL — MATCHED
PyYAML → yaml — MATCHED
python-dotenv → dotenv — MATCHED
scikit-learn → sklearn — MATCHED
Excluded correctly
json → Python standard library
pathlib → Python standard library
app → local project package
Output
Generated
requirements_imports_report.md
requirements_imports_report.json
No dependencies or project files were modified.
Static import analysis is strong evidence, not proof of full runtime dependency usage. Review dynamic imports, plugins, CLI tooling, notebooks, and environment-specific paths before removing any declared package.
Connects securely to your tools. The creator never sees your data.
About this skill
Find dependency drift before deployment does
Python projects accumulate dependencies over time. Some stay in requirements.txt long after the code stops using them, while other packages are imported in source code but never declared at all.
Python Requirements.txt vs Imports Checker scans the actual project locally and creates a clean dependency discrepancy report.
- Recursively scans Python files using the AST
- Ignores virtual environments, build folders, caches and site-packages
- Excludes Python standard-library modules and local project packages
- Detects imports that appear to be missing from requirements.txt
- Flags declared packages with no observed static import
- Handles common package/import mismatches such as Pillow → PIL, PyYAML → yaml, scikit-learn → sklearn and python-dotenv → dotenv
- Recognizes literal dynamic imports when possible
- Reports ambiguous dependency entries instead of guessing
- Generates Markdown and JSON reports
Why use the Skill instead of pasting files into chat?
The Skill recursively inspects the real local repository, parses Python imports structurally, excludes local and standard-library modules, and applies the same dependency rules every time.
AST Scan → Import Map → Requirements Parse → Dependency Diff → Reviewable Report
Free by design
This free Skill detects dependency drift. Automatic dependency migration, lockfile regeneration, Poetry/Pipenv/uv conversion, compatibility resolution and security remediation remain outside this lightweight checker.
## What it does - **AST-based scanning** recursively analyzes `.py` files to find all top-level and literal dynamic imports. - **Dependency mapping** resolves discrepancies between distribution names and import aliases like Pillow/PIL or PyYAML/yaml. - **Noise reduction** automatically filters out standard library modules, local relative imports, and virtual environment directories. - **Discrepancy classification** flags imports missing from your requirements and declared packages that appear unused. - **Report generation** produces both Markdown and JSON summaries for manual review or CI/CD integration. ## How it works 1. Run the `import_scanner.py` script pointing to your project root and `requirements.txt`. 2. The agent executes an AST scan, excluding `venv`, `node_modules`, and standard library modules. 3. The tool compares findings against the provided requirements file using the internal alias map. 4. Review the generated `requirements_imports_report.md` for prioritized action items. ## Frameworks & tools This skill uses the Python `ast` module for static analysis and targets standard `requirements.txt` files. It includes specific support for common libraries like scikit-learn, OpenCV, and SQLAlchemy. ## Why this beats prompting it yourself Generic prompts often fail to recognize that `scikit-learn` is imported as `sklearn`, leading to false positives. This skill uses a curated mapping file and AST parsing to ensure it doesn't just grep strings, providing a much higher signal-to-noise ratio. ## Use cases - Identify missing dependencies before a fresh deployment or CI build. - Prune unused packages from a legacy monolith to reduce container image size. - Audit a project after a large refactor to sync declarations with source. - Standardize dependency management across multiple microservices. ## Known limitations Static analysis cannot guarantee detection of all dynamic imports, plugins, or CLI-only tools. It does not support Poetry or Conda lockfiles directly.Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.
Does not detect usage in non-python files or complex dynamic imports. Supports requirements.txt only. Static analysis is evidence, not proof of runtime usage.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
1 use
Times used to date
Free to use
No account required to browse
Trust & safety
Security scan
Security scan passed 22 days ago
- Free with an Agensi account
- Software
Python