--- id: pipreqs version: "0.5.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # pipreqs — Pip requirements.txt generator based on imports in project License: permissive · Maintenance: active · Downloads: 991.4K/mo ## What it is and what it does pipreqs is a command-line tool that analyzes Python source files in a project directory and generates a requirements.txt file by detecting all imported packages. Unlike pip freeze, which lists everything installed in your environment, pipreqs reads your actual code to identify only the packages you use, making it useful for documenting dependencies in new projects or cleaning up existing requirement files. The tool walks the abstract syntax tree of your Python files to extract imports, queries PyPI (or a custom server) to find the latest version of each package, and outputs a requirements.txt with pinned versions. It supports optional features like scanning Jupyter notebooks, comparing against existing requirements, cleaning unused entries, and dynamic versioning schemes (e.g., ~= or >=). Runtime dependencies include yarg, docopt, nbconvert, and ipython. Use it for: - Quickly bootstrap a requirements.txt for a new project without manually listing every import. - Audit and clean an existing requirements.txt by comparing it to actual imports in the codebase. - Generate requirements for a project you've inherited without needing to install all dependencies first. - Scan Jupyter notebooks alongside Python files to capture all notebook-based dependencies. - Use a custom PyPI server or proxy in restricted network environments. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Scans Python project source code to detect imported packages and automatically generates a requirements.txt file with pinned versions, without needing a full environment installation. Yes. pipreqs solves a real problem—automating dependency discovery from source code—with low install friction, active maintenance, no security vulnerabilities, and a permissive license. It is most valuable when you need to document or audit dependencies without a full environment setup, or when working with notebooks. ## Install pip install pipreqs uv add pipreqs poetry add pipreqs ## Installing pipreqs Before you install: Low friction install with a pure-Python wheel. Maintenance is active with recent commits and a large repository community (7463 stars). Supports Python 3.8 through 3.12 with no known vulnerabilities. License in practice: Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions—suitable for most development workflows. Quickstart: pip install pipreqs pipreqs /path/to/project # or with output to stdout: pipreqs --print /path/to/project Jupyter notebook scanning (--scan-notebooks) requires nbconvert and ipython; omit that flag or install pipreqs with --no-deps and manually specify yarg==0.1.9 and docopt==0.6.2 if you want a minimal install. Verify before relying: - Whether the package correctly handles all modern import patterns in complex codebases. - Accuracy of version pinning when querying PyPI or custom servers under network constraints. - How well the tool handles edge cases in projects with conditional or dynamic imports. ## Package facts - License: Apache-2.0 (permissive) - Python support: capped_below_current - Install friction: low - Maintenance: active - Downloads: 991.4K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags generate requirements.txt from imports, python dependency scanner, auto-detect project dependencies, requirements file generator, analyze python imports, pip requirements automation, project dependency discovery, dependency-management, requirements-automation, jupyter-support [View on SkillFed](https://skillfed.io/packages/pipreqs) · [View on PyPI](https://pypi.org/project/pipreqs/)