--- id: pycln version: "2.6.0" license: MIT license_treatment: permissive maintenance: aging --- # pycln — A formatter for finding and removing unused import statements. License: permissive · Maintenance: aging · Downloads: 349.2K/mo ## What it is and what it does Pycln is a command-line formatter that scans Python source files to identify and remove unused import statements. It reads code using libcst for precise syntax tree analysis and can be configured via pyproject.toml or setup.cfg to apply project-specific rules like custom include/exclude patterns. The tool runs as a standalone CLI or as a Python module and integrates into CI/CD workflows and editor toolchains. The package depends on typer for CLI argument handling, pyyaml for configuration parsing, pathspec for file matching, tomlkit for TOML manipulation, and libcst for abstract syntax tree operations. It targets modern Python versions (3.9 through 3.14) and is used by high-profile projects including Poetry, Rich, and pybind11. Use it for: - Clean up import sections in a Python project before committing or deploying code. - Integrate into a pre-commit hook or CI pipeline to enforce import hygiene automatically. - Refactor legacy codebases where imports have accumulated over time without cleanup. - Configure project-wide import rules in pyproject.toml to standardize import handling across a team. - Use as a linting step in build tools like cibuildwheel or Poetry to validate import statements. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pycln finds and removes unused import statements from Python code, acting as a formatter that cleans up import sections automatically. Yes. Pycln solves a real maintenance problem with low friction and permissive licensing. The aging maintenance status (297 days since last release) is a minor concern but not a blocker—the repository is active, no vulnerabilities are known, and the tool is trusted by established projects. Install it if import cleanup is a workflow need. ## Install pip install pycln uv add pycln poetry add pycln ## Installing pycln Before you install: Low install friction with a pure-Python wheel distribution. Maintenance status is aging—last release was 297 days ago—but the repository remains active with a recent commit on 2026-01-13 and no archived status. License in practice: MIT license is permissive; you can use, modify, and distribute pycln with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install pycln pycln /path/to/code # Or as a module: python3 -m pycln /path/to/code Requires Python 3.9 or later. Verify before relying: - Whether the -a/--all flag is necessary for typical use cases or only for edge cases. - How pycln handles complex import patterns (star imports, conditional imports, type hints). - Performance characteristics on large codebases or deeply nested directory structures. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 349.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags remove unused imports python, import cleanup formatter, unused import detection, python import linter, clean up import statements, import statement formatter, unused imports remover, import-cleanup, code-quality, cli-tool [View on SkillFed](https://skillfed.io/packages/pycln) · [View on PyPI](https://pypi.org/project/pycln/)