libscan: A Python dependency scanner and installer
Project description
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 arequirements.txtfile containing all detected dependencies with their installed versions. - Customizable Output: Beautiful and colorful output using
richfor a better user experience. - Help Command: Use
--helpto 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.pyOutput will display a list of found dependencies and ask for confirmation to install them.
-
Generate a
requirements.txtfor your project:libscan -r myscript.py
This will create a
requirements.txtfile 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 arequirements.txtfile 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libscan-1.1-py3-none-any.whl.
File metadata
- Download URL: libscan-1.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c9d0b88c9c2feaac1e4aa79b173b2382ca5131a615e4b7f89918327e7f8c90
|
|
| MD5 |
2af3224ceb8cb322e72346d6d76adc97
|
|
| BLAKE2b-256 |
1c4dd6d0884ebfca43958606cb7ce19e5f744ca7d5b4d8559920706e0363182b
|