A fast, shell-friendly Python syntax inspector inspired by PHP's php -l
.
- Simple CLI with minimal output
- Checks files and directories for Python syntax errors
- Recursive directory scanning
- Shell-friendly exit codes
pipx install pyinsp
# or
pip install pyinsp
General usage:
pyinsp [OPTIONS] PATHS...
PATHS...
: One or more files or directories to check (must exist).
-r
,--recursive
: Recursively check directories-w
,--show-warnings
: Shows both syntax errors and syntax warnings-j
,--output-json
: Output results in JSON format (useful for files with many lines)
0
: No syntax errors found1
: Syntax error found
pyinsp script.py # Check a single Python file
pyinsp file1.py file2.py # Check multiple Python files
pyinsp -r src/ # Check all .py files in src/ recursively
pyinsp -j script.py # Output results in JSON format
pyinsp -r -j src/ # Recursive scan with JSON output
# Clone the repository
git clone https://github.com/dcloutman/pyinsp-command.git
cd pyinsp-command
# Create a virtual environment. `virtaulenv` can be installed locally via `pip install --user virtualenv`
virtualenv venv
# Activate the virtual environment
source venv/bin/activate
# Install dependencies
pip install -e .
pip install -r requirements.txt # if requirements.txt exists
To build the project, run the following command from the repository root:
python -m build
To clean up build artifacts, use:
rm -rf build/ dist/ *.egg-info
After building, you can run the utility directly from your virtual environment:
venv/bin/pyinsp --help
# Run all unit and functional tests
./tests/run_tests.sh
Or run unit tests directly:
venv/bin/python -m unittest discover -s tests/unit
This project does not currently enforce any specific formatting or linting standards.
MIT License (c) 2025 David Cloutman
v0.0.1