python
15 commands
15 shown
Create virtual environment
Create and activate an isolated Python environment
python3 -m venv .venv && source .venv/bin/activate
Install from requirements
Install dependencies without using pip cache
pip install -r requirements.txt --no-cache-dir
Freeze installed packages
Save exact versions of all installed packages
pip freeze > requirements.txt
Show outdated packages
List packages with newer versions available
pip list --outdated --format=columns
Run module as script
Serve current directory over HTTP on port 8080
python3 -m http.server 8080
One-liner JSON pretty print
Pretty-print a JSON file using stdlib
python3 -m json.tool < input.json
Profile script
CPU profiling sorted by cumulative time
python3 -m cProfile -s cumulative script.py | head -30
Debug with pdb
Start script under the Python debugger
python3 -m pdb script.py
Set breakpoint in code
Built-in breakpoint() is equivalent to import pdb; pdb.set_trace()
breakpoint() # Python 3.7+ — drops into pdb at this line
Run tests with pytest
Stop at first failure, verbose, short traceback
pytest -x -v --tb=short tests/
Check syntax without running
Compile to bytecode only to catch syntax errors
python3 -m py_compile script.py && echo OK
Format code with black
Preview changes then apply Black formatting
black --check --diff . && black .
Lint with ruff
Fast linter + auto-fix (replaces flake8, isort, pyupgrade)
ruff check . --fix
Type check with mypy
Strict static type checking for a package
mypy --strict --ignore-missing-imports src/
Inspect object attributes
List public attributes of any Python object
python3 -c "import json; print([x for x in dir(json) if not x.startswith('_')])"
no commands match