Python import health scanner
Project description
py-import-checker
A zero-dependency Python tool that scans a project and reports broken imports.
It loads Python files using the standard library and reports import failures before they reach runtime.
Features
- Zero dependencies (Python standard library only)
- Supports
src/layouts with--src - Reports
ImportErrorandModuleNotFoundError - Ignores runtime errors raised during module execution
- Skips virtual environments and build directories
- Works in CI with meaningful exit codes
Installation
pip install py-import-checker
Usage
py-import-checker
py-import-checker path/to/project
py-import-checker . --src src/
py-import-checker . --src src/ --src lib/
py-import-checker . --glob "app/**/*.py"
py-import-checker . --verbose
Python API
from pathlib import Path
from py_import_checker.checker import check_directory
result = check_directory(
Path("src"),
extra_paths=[Path("src")],
)
if not result.success:
for error in result.errors:
print(error.file, error.message)
Pre-commit
repos:
- repo: https://github.com/matthieugraziani/py-import-checker
rev: v0.2.4
hooks:
- id: py-import-checker
args: [--src, src/]
Development
pip install hatch
hatch env create
hatch run test
hatch run lint
hatch run type-check
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_import_checker-0.2.4.tar.gz.
File metadata
- Download URL: py_import_checker-0.2.4.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74bef1e19446d7cfeb1bf349e189f054bc548f0ef09880ecdab264421a9badd7
|
|
| MD5 |
bd6e57fcd49a7225cfb2eee965809698
|
|
| BLAKE2b-256 |
998df3c1c4f045d19180c4cf837b5c1706fb01e9bf66d43875da4cbd2a73b54c
|
Provenance
The following attestation bundles were made for py_import_checker-0.2.4.tar.gz:
Publisher:
publish.yml on matthieugraziani/py-import-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_import_checker-0.2.4.tar.gz -
Subject digest:
74bef1e19446d7cfeb1bf349e189f054bc548f0ef09880ecdab264421a9badd7 - Sigstore transparency entry: 1849272563
- Sigstore integration time:
-
Permalink:
matthieugraziani/py-import-checker@9cdef0c5346caff245456e47642e7bbcf54afb2f -
Branch / Tag:
refs/tags/V0.2.4 - Owner: https://github.com/matthieugraziani
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9cdef0c5346caff245456e47642e7bbcf54afb2f -
Trigger Event:
release
-
Statement type:
File details
Details for the file py_import_checker-0.2.4-py3-none-any.whl.
File metadata
- Download URL: py_import_checker-0.2.4-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17ad5f7190312f017808f739a01c0cf806bdab63b23111858e0e88cd95709bca
|
|
| MD5 |
eac40c84de3aff9d2310dd44879f45b8
|
|
| BLAKE2b-256 |
257587f61ae8fdf7d85d2ff46fc628e7c1c6435ffaf4b4b721a2295931a0add5
|
Provenance
The following attestation bundles were made for py_import_checker-0.2.4-py3-none-any.whl:
Publisher:
publish.yml on matthieugraziani/py-import-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_import_checker-0.2.4-py3-none-any.whl -
Subject digest:
17ad5f7190312f017808f739a01c0cf806bdab63b23111858e0e88cd95709bca - Sigstore transparency entry: 1849272719
- Sigstore integration time:
-
Permalink:
matthieugraziani/py-import-checker@9cdef0c5346caff245456e47642e7bbcf54afb2f -
Branch / Tag:
refs/tags/V0.2.4 - Owner: https://github.com/matthieugraziani
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9cdef0c5346caff245456e47642e7bbcf54afb2f -
Trigger Event:
release
-
Statement type: