pycln
A formatter for finding and removing unused import statements.
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later.
- 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 · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute pycln with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2025-10-21 (297 days) · last repo commit 2026-01-13 · 314 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 349,230 downloads/mo, #7,336 on PyPI
Alternatives
Verify before relying
pip install pycln
pycln /path/to/code
# Or as a module:
python3 -m pycln /path/to/code- 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.
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 on this page. Verify before relying on it.
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
pycln on PyPI
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.
Requires Python 3.9 or later.
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
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 the current Python release <4,>=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagestyperpyyamlpathspectomlkitlibcst |
| Maintenance | Aging 297 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 349,230 / month, #7,336 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Utilities |
Evidence: pycln-2.6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “import cleanup formatter”
- pyclnPycln finds and removes unused import statements from Python code,…
- autoflakeautoflake removes unused imports and unused variables from Python…
- mbakembake formats and lints Makefiles, enforcing consistent spacing, tab…
Give your agent the search over MCP, or paste the wish link into any chat.
More Utilities packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Pygments is a syntax highlighter that colorizes source code and text in over 500 languages and formats, outputting to HTML, LaTeX, RTF, SVG, images, or ANSI terminal sequences.
Install it if you need to display or transform source code.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
See also autoflake · clang-tidy · uncalled · creosote · clang-format · pip-check-reqs · tclint · usort · deadcode · pytest-unused-fixtures