Checks for conflicting, unused or duplicate import aliases
Project description
pimporter 🐍📦
Clean up your code's cargo.
pimporter is a lightweight static analysis tool for inspecting Python import statements.
It helps you detect:
- Aliases (
as) used for multiple modules (conflicts) - Duplicate or hidden import aliases
- Unused imports
- Local vs external imports
- Clean summary per file
🔧 Installation
Install via pip (after packaging it as a wheel or locally):
pip install pimporter
Or from a local directory:
pip install .
🚀 Usage
pimporter path/to/your/script_or_directory.py
- You can pass either a single Python file or a directory (recursively scans
.pyfiles). - The tool will display detailed line-by-line output with color-coded status.
🖨️ Example Output
[!!!] Conflict: Alias 'foo' is used for multiple modules:
Line 14 -> wurst as foo
Line 24 -> module_a.foo as foo
Line 25 -> module_b.foo as foo
Line 25 - [!!] unused foo from module_b.foo
✅ Features
- Detects alias conflicts across imports
- Highlights hidden and explicit duplicates
- Differentiates between local and external modules
- Colorized terminal output using
colorama - (Planned) CLI arguments for filtering and exporting
- (Planned) Export as JSON or markdown
📦 Dependencies
colorama– for colorful terminal output
💡 Motivation
While linters like pylint, flake8, or ruff cover general import cleanliness, pimporter focuses specifically on the integrity and clarity of alias usage – particularly useful for larger codebases or shared projects where import patterns can become inconsistent or ambiguous.
🧪 Development
Clone and run:
python -m pimporter path/to/codebase/
📄 License
MIT License – use it, modify it, share it.
✍️ Author
Your Name optional.email@example.com]
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 pimporter-0.1.8.tar.gz.
File metadata
- Download URL: pimporter-0.1.8.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52990c2460f404c31befc2ac4f857884800a535b1e928e82e1aacdd68652ebd9
|
|
| MD5 |
c263007102866c7cf423ad3f25e7aed2
|
|
| BLAKE2b-256 |
e3968a3b2a9cb080ba166f688efec6186f74e3b73e388fa73a7dd2ff724f36a6
|
File details
Details for the file pimporter-0.1.8-py3-none-any.whl.
File metadata
- Download URL: pimporter-0.1.8-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fca4ac2b5293f4cec51f193bc3db7c1fadeb7aad236b4b42adc2c18029bc456
|
|
| MD5 |
14837ae01102a915b7adc9b67eff3087
|
|
| BLAKE2b-256 |
0a0d85cff1958b3a96cdecc1516f32ad7136822201e47d214730598cb0d18527
|