Skip to main content

Sweep away unused imports from your codebase

Project description

sweepy

Sweep away unused imports from your codebase.

A minimal, zero-dependency Python tool that detects unused imports. Just point it at any local directory or GitHub URL.

Installation

pip install sweepy-cli

Usage

# Local directory
sweepy .
sweepy /path/to/repo

# GitHub URL (no clone needed)
sweepy https://github.com/user/repo

# Specific branch
sweepy https://github.com/user/repo/tree/develop
sweepy https://github.com/user/repo/tree/feature/new-api

Options

# Exclude directories
sweepy . --exclude-dir migrations --exclude-dir tests

# Exclude files
sweepy . --exclude-file conftest.py

Python API

from sweepy import analyze

result = analyze("https://github.com/user/repo")

print(result.summary())

for item in result.unused_imports:
    print(f"{item.file}:{item.line} - {item.module}")

Example Output

============================================================
SWEEPY ANALYSIS REPORT
============================================================
Repository: https://github.com/user/repo
Files analyzed: 42
Files skipped: 3
Unused imports: 5

------------------------------------------------------------

src/utils.py
   Line   3: json
   Line   7: typing

src/main.py
   Line   1: os
   Line   4: sys
   Line   5: re

Why sweepy?

sweepy ruff autoflake
Zero dependencies O O X
GitHub URL support O X X
Single purpose O X X
Setup required None Config Config

sweepy does one thing: find unused imports. No config files, no complex rules, no setup.

License

MIT

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

sweepy_cli-0.1.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

sweepy_cli-0.1.5-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file sweepy_cli-0.1.5.tar.gz.

File metadata

  • Download URL: sweepy_cli-0.1.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sweepy_cli-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dd95b97c1130a3cc60362fdfbed5f28ee4c54d364be0229afed576ca669c34c5
MD5 6c0beb12fd82ddbb27a46bb224c74b2e
BLAKE2b-256 90bc8afaeebf3279f5a73ae6dc906c82be9497b368e0578eabe36a628f1aca33

See more details on using hashes here.

File details

Details for the file sweepy_cli-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: sweepy_cli-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sweepy_cli-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 30541c13c00cbb5540895b80c9a9f3c48c558870db1aea1dc3fbb29aced9a17f
MD5 3e7e35b87737928d9053c3bb87c7a2b6
BLAKE2b-256 1c862a58e6345d9d0afd9d4a91165a6146513e01119635d327fafaf1560dc5c8

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