Skip to main content

A smart tool to analyze, generate, and check Python project requirements.

Project description

Req-Scanner: The Smart Requirements Tool 🐍Req-Scanner is a powerful command-line tool designed to bring sanity to your Python project's dependencies. It analyzes your project's imports, compares them against your requirements.txt file, and helps you create a clean, minimal, and accurate list of dependencies.Stop guessing which packages are really needed. Let req-scanner do the work for you. Key Features🎯 Accurate Import Detection: Uses Python's ast module to safely and accurately find all imported packages.🔍 Smart Dependency Analysis: Distinguishes between primary packages (directly imported) and their transitive dependencies. ✅ Comprehensive check command: Validates your requirements.txt against 4 crucial rules to ensure consistency. ✨ Clean generate command: Creates a perfect requirements.txt file from your project, optionally including all necessary dependencies. 🤖 CI/CD Friendly: Exits with a non-zero status code on errors, making it perfect for use in automated workflows.InstallationInstall req-scanner directly from PyPI:pip install req-scanner Usagereq-scanner is simple to use and has two main commands: check and generate.check: Verify Your RequirementsThe check command is your best friend for maintaining a healthy requirements.txt. It verifies your project against 4 strict rules.# Run the check against the default requirements.txt req-scanner check /path/to/your/project

Specify a different requirements file

req-scanner check . --file dev-requirements.txt

Ignore certain directories or files

req-scanner check . --ignore venv build "*.pyc" The check command will report:❌ Error (Rule 2): Primary packages imported in your code but missing from the file.❌ Error (Rule 3): Primary packages that are missing their own dependencies in the file.❌ Error (Rule 4): Packages listed in the file that aren't installed in your environment.⚠️ Warning (Rule 1): Packages in the file that are never imported and are not dependencies.generate: Create a Perfect Requirements FileUse the generate command to create a clean requirements.txt from scratch based on your project's imports.# Generate a file with only primary (directly imported) packages req-scanner generate /path/to/your/project -o minimal-reqs.txt

Generate a complete file with all dependencies included (recommended)

req-scanner generate . --include-deps -o requirements.txt ContributingContributions are welcome! Please feel free to open an issue or submit a pull request.LicenseThis project is licensed under the MIT License - see the LICENSE file for details.

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

req_scanner-0.2.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

req_scanner-0.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file req_scanner-0.2.0.tar.gz.

File metadata

  • Download URL: req_scanner-0.2.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for req_scanner-0.2.0.tar.gz
Algorithm Hash digest
SHA256 31df2a832598595f3ca8d0c4badf3b49dd5bdafc2ecf692656a98df59a946b4f
MD5 61839d621960c5dcfe79e30957cbe25d
BLAKE2b-256 2577330402fb17dec9b1ed26a68f692a2b3c9f369fc0252741fe8bb828c4eb48

See more details on using hashes here.

File details

Details for the file req_scanner-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: req_scanner-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for req_scanner-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2864a5ee334222e7cae5f8b0df1070b0cc3c99a72019a7b909fde3ab5ad9717b
MD5 bb0330d8a4199d22a33c101534b35962
BLAKE2b-256 eccd950ddd6dfa227c359f56b400c3af368f1537260420b2a910757164d4e692

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