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.6.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.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sweepy_cli-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 5b692a8ba2b22ff040345d016e813f1ce95dc5440469e062468c6b5b36ebd3c8
MD5 271d13400abc309d037e787fe30a5812
BLAKE2b-256 476a80027128b9f233553709e1fb604e37eb833771b937d1a1cc885ef111e7f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sweepy_cli-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 61cdcb5bce495988e1fab5f9a0d5849d20c079888bb7638688464ed26212a353
MD5 d6abe40385eab52bd256d3c2f858ffb9
BLAKE2b-256 98ea5690668e3f9374ede2e5d446f60d020c15bcd2c13ac9f541212038aec4de

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