Registry / testing / pycln
library2.6.0pypypi✓ verified 82d ago

Pycln is a fast and efficient code formatter for finding and removing unused import statements in Python code. It helps to keep your codebase clean and reduce unnecessary dependencies. The current version is 2.6.0 and it maintains a relatively frequent release cadence, often aligning with Python version updates and bug fixes.

pip install pycln
INSTALL
IMPORT
SIG · PYCLN
P
pycln
testingpythonv2.6.0
Install
3.8s avg
Import
Disk
48MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 47.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 3.8s · import 0.000s · 48MB
48MB installed
● package 48MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pycln
from pycln import pycln
from pycln import main

The primary way to use Pycln is through its command-line interface. Run `pycln .` in your project's root directory to scan and remove unused imports. Use `--check` to preview changes, or `--diff` to see a diff.

# To analyze current directory and remove unused imports: pycln . # To check for unused imports without modifying files: pycln --check . # To include specific files or directories: pycln my_module.py my_package/
pycln --version
Debug
Known issues
breakingPycln dropped support for Python 3.8 in version 2.6.0. Users on Python 3.8 or older must use Pycln v2.5.0 or earlier.
fix
Upgrade to Python 3.9 or newer, or pin Pycln to `<2.6.0`.
affects: >=2.6.0
breakingPycln dropped support for Python 3.7 in version 2.5.0. Users on Python 3.7 or older must use Pycln v2.4.0 or earlier.
fix
Upgrade to Python 3.8 or newer, or pin Pycln to `<2.5.0`.
affects: >=2.5.0
gotchaWhen running Pycln with Python 3.14 (or early development versions), versions prior to 2.6.0 might fail due to changes in Python's AST (specifically, `ast.Str` being removed).
fix
Upgrade to Pycln v2.6.0 or newer for full Python 3.14 compatibility.
affects: <2.6.0
gotchaIn versions prior to 2.5.0, Pycln could encounter 'missing pyproject.toml' errors when reading configuration, even if the file existed.
fix
Upgrade to Pycln v2.5.0 or newer. Ensure your `pyproject.toml` is correctly formatted and accessible.
affects: <2.5.0
gotchaImplicit imports (e.g., `from package import module` where `module` is not directly used but its side effects are needed) were sometimes misparsed and considered unused in Pycln versions prior to 2.1.6.
fix
Upgrade to Pycln v2.1.6 or newer. If issues persist, consider using a `--skip` option for specific files or imports that rely heavily on implicit behavior.
affects: <2.1.6
Upgrade
Version history
2.6.0latest on PyPI · released Oct 21, 2025
Audit
Dependencies
libcstrequiredCore dependency for AST parsing and manipulation.
pathspecrequiredUsed for gitignore-style path filtering.
Agent activity
25 hits · last 30 days
node
22
Resources
pycln — pip install pycln · libregistry