Skip to main content

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 .py files).
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pimporter-0.1.6.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

pimporter-0.1.6-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pimporter-0.1.6.tar.gz.

File metadata

  • Download URL: pimporter-0.1.6.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for pimporter-0.1.6.tar.gz
Algorithm Hash digest
SHA256 fd7631defddd02aa2f0469b2ac1dbee37ab3adb2e3e576fd5b2e964c12ef4e4b
MD5 487f3f01873dae265e768fa860baf3d9
BLAKE2b-256 d369dbf8a091892ed43034bb3db3f89830ee72f81c8bc8db01ea97a124979287

See more details on using hashes here.

File details

Details for the file pimporter-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: pimporter-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.6

File hashes

Hashes for pimporter-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ba0cc75d22a6b67526d482d73be48ffc92f146a0b78dd7a00c2e02d19a021a77
MD5 6ead45a0e3522cd87a9e734b3500bc49
BLAKE2b-256 50962fbe7fbc2eda6fd526fc6b70094cc2b41432839e291d9e9be4973c9960e4

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