Skip to main content

Python tool to scan all unused packages in requirements.txt file for your project.

Project description

ScanReq

PyPI - Version PyPI - Python Version

ScanReq - Python tool to scan all unused packages in requirements.txt file for your project.

Background

One popular tool for checking requirements in a Python project is pipdeptree. However, the problem arises when we don't know which packages listed in the requirements.txt file are actually being used in the project or not. It's easy to check if your project is small, but as your project grows larger, it becomes a headache to check one by one.

So, this tool comes in handy for easily identifying which exact packages are actually unused in our project.

Benefits

  1. Save Money: Remove unused dependencies to lower hosting costs.
  2. Speed Up: Faster installation and build times mean quicker development.
  3. Use Resources Wisely: Free up disk and memory space by removing what you don't use.
  4. Easier Maintenance: Keep your project cleaner and simpler for easier management.
  5. Focus Better: Work with only what you need, enhancing productivity.
  6. Update Efficiently: Ensure your dependencies are up-to-date for smoother compatibility.
  7. Stay Safe: Reduce the chance of security vulnerabilities by trimming unnecessary dependencies.
  8. Stay Legal: Avoid licensing issues by managing dependencies more effectively.
  9. Work Together: Simplify collaboration with a consistent set of dependencies.
  10. Code Better: Keep your documentation and codebase cleaner for improved quality.

Installation

pip3 install scanreq

Usage

(env-myproject) ➜  myproject git:(development) ✗ scanreq -r requirements.txt -p .

[i] Please wait! It may take few minutes to complete...
[i] Scanning unused packages:
 1. Module: rcssmin ---> Package: rcssmin
 2. Module: model_utils ---> Package: django-model-utils
 3. Module: pinax_theme_bootstrap ---> Package: pinax-theme-bootstrap
 4. Module: phonenumbers ---> Package: phonenumbers

Cool right? 😎

(env-myproject) ➜  myproject git:(development) ✗ scanreq --help
usage: scan.py [-h] [-r REQUIREMENTS] [-p PATH]

Scan for unused Python packages.

optional arguments:
  -h, --help            show this help message and exit
  -r REQUIREMENTS, --requirements REQUIREMENTS
                        Path to the requirements.txt file to read packages from.
  -p PATH, --path PATH  Project path to scan for unused packages (default: current directory).

Note: Don't forget to cross-check the unused packages after finding them, because sometimes they are used in different cases without being imported in the code. For example: argon2-cffi used in settings.PASSWORD_HASHERS = ["django.contrib.auth.hashers.Argon2PasswordHasher", ...] for Django.

ToDo List

  • Support argument parser (command arguments)
    • Directory to scan
    • Requirement file to scan
    • Option to auto replace the package from requirements.txt file
    • Option to exclude or ignore some packages
  • Support CLI - make it as a command
  • Write some tests
  • Publish to PyPi
  • Support scan the pyproject.toml
  • Support multiple python versions
  • Support multiple devices (Linux, Macbook, and Windows)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scanreq-0.0.6.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scanreq-0.0.6-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file scanreq-0.0.6.tar.gz.

File metadata

  • Download URL: scanreq-0.0.6.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for scanreq-0.0.6.tar.gz
Algorithm Hash digest
SHA256 8c8c1f0f3bb94f9e0d1b8bd6205be03d89b1df35bed3ffecf5a1b7ac56fee296
MD5 f6b60327ae9369c83a2216a1ca193951
BLAKE2b-256 d4e4c1bcaa7e88fad3d0521bb0ff7692c5cda3af55a768a312560fef54b1525e

See more details on using hashes here.

File details

Details for the file scanreq-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: scanreq-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.27.0

File hashes

Hashes for scanreq-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e8cc8fce9857d2ceb4ab46894906b80b609bf7740950225944609a43de4ee9ed
MD5 fba17061c210475d8d3936e5b789a31c
BLAKE2b-256 1f3d17f44ca3791c00e7b5053b70e8a25c28da90ecee329e12f2cd15184570ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page