Skip to main content

libscan - Python Dependency Scanner

libscan is a Python utility that helps you easily detect and install external dependencies for your Python project. It scans the imports of a given Python script, identifies missing dependencies, and allows you to install them interactively. Additionally, it can generate a requirements.txt file for your project with the installed versions of the detected dependencies.

Features

  • Dependency Detection: Scans a Python script to detect all external dependencies that need to be installed.
  • Interactive Installation: Prompts you to install missing dependencies.
  • Generate requirements.txt: Optionally generate a requirements.txt file containing all detected dependencies with their installed versions.
  • Customizable Output: Beautiful and colorful output using rich for a better user experience.
  • Help Command: Use --help to get details on the available commands.

Installation

To install libscan, use the following command:

pip install libscan

Usage

1. Scan for Missing Dependencies and Install

Run the following command to scan for missing dependencies in your Python script and install them interactively:

libscan /path/to/your_script.py

It will detect any external dependencies that are not already installed and prompt you with:

📦 Dependencies found:
Module1
Module2
...

Do you want to install these packages? (y/n): [y]:

If you choose y, the script will install the packages.

2. Generate a requirements.txt File

To generate a requirements.txt file with the dependencies of your project, use the -r option:

libscan -r /path/to/your_script.py

This will create a requirements.txt file in the current directory with the names and versions of the external dependencies.

3. Show Help

To view the available commands and options, use the --help flag:

libscan --help

This will display information about the available options and their usage.

Example Commands

  • Scan a script and install missing dependencies:

    libscan myscript.py
    

    Output will display a list of found dependencies and ask for confirmation to install them.

  • Generate a requirements.txt for your project:

    libscan -r myscript.py
    

    This will create a requirements.txt file containing the detected dependencies.

  • Display help:

    libscan --help
    

Example Output

Detecting Dependencies

📦 Dependencies found:
requests
numpy
pandas

Do you want to install these packages? (y/n): [y]: y
✅ requests installed successfully.
✅ numpy installed successfully.
✅ pandas installed successfully.

Generating requirements.txt

📦 Dependencies found:
requests
numpy
pandas

Do you want to save them to `requirements.txt`? (y/n): [y]
✅ `requirements.txt` generated successfully!

Options

  • -r / --requirements: Generate a requirements.txt file with the detected dependencies and their versions.
  • --help: Show help and usage information for the tool.

License

This project is open-source and available under the MIT License.


libscan is designed to simplify your Python dependency management. Whether you're working on a new project or maintaining an existing one, it helps you manage your dependencies efficiently.

Metadata

Release files for libscan 1.1

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

Built distribution (wheel)

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

Release files / libscan-1.1-py3-none-any.whl

Download URL libscan-1.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
39c9d0b88c9c2feaac1e4aa79b173b2382ca5131a615e4b7f89918327e7f8c90
BLAKE2b-256 checksum
How to use checksums
1c4dd6d0884ebfca43958606cb7ce19e5f744ca7d5b4d8559920706e0363182b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.1 This release

1 release file

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