CLI tool to list and classify Python imports in a project.
Project description
🧠 importscanner
A lightweight CLI tool to list and classify Python imports: standard library, pip-installed (third-party), and local modules.
🎞️ Features
-
📚 Categorizes Python imports:
- ✅ Standard Library modules
- ✅ Third-party packages installed via
pip - ✅ Your project's local modules
-
✍️ Optionally generates a
requirements.txt -
🦢 Works on any Python-based project or codebase
-
🧫 Graceful handling of broken files, bad syntax, and missing packages
-
📄 Optional logging to
importscanner.log
🚀 Installation
From PyPI (recommended):
pip install importscanner
From source (GitHub):
git clone https://github.com/harshmeet-1029/importscanner.git
cd importscanner
pip install .
💻 Usage
Once installed, the CLI command is available as:
list-imports [directory] [--save] [--log]
🧪 Examples
▶️ Basic usage (scan current directory):
list-imports
📂 Scan a specific folder:
list-imports ./src
📆 Save third-party packages to requirements.txt:
list-imports ./project --save
�� Enable log file output to importscanner.log:
list-imports --log
📦 Combine all options:
list-imports ./backend --save --log
📂 Output Format
📦 Third-Party Packages (installed via pip):
- requests
- flask
📁 Local Modules (your own project's files/modules):
- myutils
- handlers
📚 Standard Library (built-in Python modules):
- os
- sys
- json
📝 Notes
- Uses the
stdlib_listpackage to detect standard library modules. - Gracefully skips unreadable or invalid
.pyfiles. - Supports Python 3.8+
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 Distribution
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 py_import_scanner-0.1.1.tar.gz.
File metadata
- Download URL: py_import_scanner-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
756a07e8904e3c463062d494b4b85c6a8aa4e3052c86bcd20cfc52467653612b
|
|
| MD5 |
214d229e202e07b0029bac99435d5e08
|
|
| BLAKE2b-256 |
e1e09b09609013b1a45f7b34d320999be71f03c9434ab19a5d3827f9c616bd72
|
File details
Details for the file py_import_scanner-0.1.1-py3-none-any.whl.
File metadata
- Download URL: py_import_scanner-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e65eb07d57d6ce8c7d11fd36c06d7605ab4bd277ff3ef91d6430338c6ad9aa6
|
|
| MD5 |
4f14c9ea9a8f53dc5f2062559cde2231
|
|
| BLAKE2b-256 |
f4626f69f49bcd7112c452df38c034c82b449a29cd76b0fb7131e59b7d8b8046
|