A cute Python package updater
Project description
pipu
Author: Scott Arne Johnson (sajohn2@gmail.com)
A powerful and user-friendly Python package updater with advanced constraint handling, beautiful TUI, and intelligent version management. Keep your Python packages up-to-date while maintaining stability through smart constraint enforcement.
โจ Key Features
- ๐ฎ Interactive TUI - Beautiful terminal interface with keyboard navigation and real-time feedback
- ๐ฏ Smart Constraints - Automatic constraint discovery and enforcement to prevent breaking updates
- ๐ซ Flexible Ignoring - Exclude packages from updates with environment-specific rules
- ๐ Rich Output - Color-coded tables showing constraints, versions, and update safety
- ๐ Pre-release Support - Optional inclusion of alpha, beta, and RC versions
- โ๏ธ Configurable - 10+ environment variables for advanced customization
- ๐ Safe Updates - Thread-safe operations with guaranteed resource cleanup
- ๐ Cross-Platform - Full support for Windows, macOS, and Linux
๐ Quick Start
Installation
# Install in editable mode for development
pip install --config-settings editable_mode=compat -e ".[dev]"
Basic Usage
# Launch interactive TUI (recommended)
pipu
# List outdated packages
pipu list
# Update all packages with confirmation
pipu update
# Auto-update without prompting
pipu update --yes
That's it! For most users, just running pipu will give you everything you need.
๐ Detailed Usage
Commands Overview
| Command | Description | Example |
|---|---|---|
pipu |
Launch interactive TUI | pipu |
pipu list |
List outdated packages | pipu list --pre |
pipu update |
Update packages (with confirmation) | pipu update --yes |
pipu constrain |
Manage version constraints | pipu constrain "requests<3.0" |
pipu ignore |
Manage ignored packages | pipu ignore setuptools pip |
Interactive TUI Mode
The TUI is the easiest way to manage updates. Just run pipu with no arguments.
Navigation:
- โ/โ - Navigate packages
- Space - Toggle package selection
- A - Select all packages
- N - Deselect all packages
- Enter - Confirm and update selected packages
- Esc/Q - Cancel and exit
- H - Show help
Visual Indicators:
- โ Green checkmark = Selected for update
- ๐ข Green constraint = Safe to update
- ๐ด Red constraint = Update blocked by constraint
- โซ Gray dash (-) = No constraint
Command-Line Mode
For automation and scripting, use command-line mode:
# List outdated packages
pipu list
# Include pre-releases (alpha, beta, rc)
pipu list --pre
# Update with confirmation prompt
pipu update
# Update without confirmation (for scripts)
pipu update --yes
# Update including pre-releases
pipu update --pre --yes
Managing Constraints
Constraints prevent packages from updating beyond specific versions, ensuring stability.
Add Constraints:
# Single constraint
pipu constrain "requests>=2.25.0,<3.0.0"
# Multiple constraints
pipu constrain "numpy>=1.20.0" "pandas<2.0.0" "django~=4.1.0"
# Environment-specific (for conda/venv/poetry environments)
pipu constrain "pytest>=7.0.0" --env development
List Constraints:
# All constraints
pipu constrain --list
# Environment-specific
pipu constrain --list --env production
Remove Constraints:
# Remove specific packages
pipu constrain --remove requests numpy
# Remove from specific environment
pipu constrain --remove django --env production
# Remove ALL constraints (prompts for confirmation)
pipu constrain --remove-all
# Skip confirmation
pipu constrain --remove-all --yes
Auto-Discovery:
Pipu automatically discovers constraints from your installed packages' dependencies. For example, if deprecated==1.2.10 depends on wrapt<2, pipu will automatically constrain wrapt<2 and show "deprecated>1.2.10" as the trigger. These auto-constraints are temporary and removed when no longer needed.
Managing Ignored Packages
Ignored packages are completely excluded from update checks.
Add Ignores:
# Ignore packages globally
pipu ignore setuptools pip wheel
# Environment-specific ignores
pipu ignore pytest black mypy --env development
List Ignores:
pipu ignore --list
pipu ignore --list --env production
Remove Ignores:
pipu ignore --remove setuptools wheel
pipu ignore --remove-all
pipu ignore --remove-all --yes # Skip confirmation
โ๏ธ Configuration
Environment Variables
Customize pipu's behavior with environment variables:
Network Settings:
export PIPU_TIMEOUT=30 # Network timeout (default: 10s)
export PIPU_RETRIES=3 # Retry attempts (default: 0)
export PIPU_MAX_NETWORK_ERRORS=3 # Max consecutive errors (default: 1)
export PIPU_RETRY_DELAY=1.0 # Delay between retries (default: 0.5s)
Subprocess Settings:
export PIPU_SUBPROCESS_TIMEOUT=60 # Subprocess timeout (default: 30s)
export PIPU_UNINSTALL_TIMEOUT=180 # Uninstall timeout (default: 120s)
export PIPU_FORCE_KILL_TIMEOUT=10 # Force kill timeout (default: 5s)
Caching & Logging:
export PIPU_CACHE_TTL=120 # Cache lifetime (default: 60s)
export PIPU_LOG_LEVEL=DEBUG # Logging level (default: WARNING)
Example: Slow Network Configuration
# For slow or unreliable networks
export PIPU_TIMEOUT=60
export PIPU_RETRIES=5
export PIPU_RETRY_DELAY=2.0
pipu update --yes
Pip Configuration Integration
Pipu seamlessly integrates with pip's configuration files:
Linux/macOS:
~/.config/pip/pip.conf(user-specific)~/.pip/pip.conf(legacy)/etc/pip.conf(system-wide)
Windows:
%APPDATA%\pip\pip.ini(user-specific)C:\ProgramData\pip\pip.ini(system-wide)
Example Configuration:
[global]
index-url = https://pypi.org/simple/
trusted-host = pypi.org
# Global constraints
constraints =
requests>=2.25.0,<3.0.0
numpy>=1.20.0
django>=4.1.0,<5.0.0
# Global ignores
ignores = pip setuptools wheel
[development]
# Development-specific constraints
constraints =
pytest>=7.0.0
black>=22.0.0
mypy>=1.0.0
ignores =
requests
numpy
๐ Advanced Topics
Constraint Sources (Priority Order)
Pipu checks these sources in order:
-
PIP_CONSTRAINTenvironment variableexport PIP_CONSTRAINT=/path/to/constraints.txt
-
Pip config - Environment-specific section
[myenv] # Detected from conda/venv/poetry constraints = /path/to/constraints.txt
-
Pip config - Global section
[global] constraints = /path/to/constraints.txt
-
Project root (legacy fallback)
your-project/ โโโ pyproject.toml # or setup.py โโโ constraints.txt -
Auto-discovered constraints (from installed packages)
- Automatically detected from package dependencies
- Temporary and self-cleaning
- Displayed with "Invalid When" trigger information
Constraint File Format
# Web frameworks
requests>=2.25.0,<3.0.0
django>=4.1.0,<5.0.0
flask~=2.0.0
# Data science
numpy>=1.20.0
pandas>=1.5.0,!=1.5.1
scipy>=1.9.0,!=1.9.1,<2.0.0
# Comments and empty lines are ignored
matplotlib==3.6.0 # Exact version
Constraint Operators
| Operator | Description | Example |
|---|---|---|
==1.0.0 |
Exact version | requests==2.28.0 |
>=1.0.0 |
Minimum version | numpy>=1.20.0 |
<=2.0.0 |
Maximum version | django<=4.2.0 |
>1.0.0,<2.0.0 |
Version range | flask>2.0,<3.0 |
~=1.4.0 |
Compatible version | black~=22.0 |
!=1.5.1 |
Exclude version | pandas!=1.5.1 |
Environment Detection
Pipu automatically detects your Python environment:
- Conda/Mamba/Micromamba: Uses
$CONDA_DEFAULT_ENV - Poetry: Runs
poetry env info --name - Virtualenv/venv: Uses basename of
$VIRTUAL_ENV
This enables environment-specific constraints and ignores.
Invalidation Triggers
Pipu supports automatic constraint removal when packages are updated. Useful for temporary constraints:
# Add constraint with trigger
pipu constrain "wrapt<2" --invalidation-triggers "deprecated>1.2.10"
# When deprecated is updated to >1.2.10, wrapt constraint is automatically removed
pipu update deprecated
# Manually check and clean invalid constraints
pipu constrain --list # Shows triggers
๐จ Output Examples
List Command Output
Outdated Packages
โโโโโโโโโโโโโโโโณโโโโโโโโโโณโโโโโโโโโโณโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโ
โ Package โ Version โ Latest โ Type โ Constraint โ Invalid When โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ requests โ 2.28.0 โ 2.31.0 โ wheel โ - โ - โ
โ numpy โ 1.19.5 โ 1.24.3 โ wheel โ >=1.20.0 โ - โ
โ wrapt โ 1.14.0 โ 2.0.0 โ wheel โ <2 โ deprecated>1.2.10โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโ
Color Coding:
- ๐ข Green = Constraint satisfied, safe to update
- ๐ด Red = Constraint violated, update blocked
- โซ Gray dash = No constraint
๐ง Development
Running Tests
# All tests (422 tests)
pytest tests/ -v
# Specific test categories
pytest tests/test_constraints.py -v
pytest tests/test_cli.py -v
pytest tests/test_tui_usability.py -v
# With coverage
pytest tests/ --cov=pipu_cli --cov-report=html
Building
# Install build dependencies
pip install build
# Build distribution
python -m build
# Install locally
pip install dist/pipu_cli-*.whl
Code Quality
The codebase includes:
- โ Thread-safe operations
- โ Cross-platform compatibility
- โ Comprehensive error handling
- โ Type hints on key functions
- โ Extensive test coverage (422 tests)
- โ Resource cleanup guarantees
๐ค Common Workflows
Workflow 1: First-Time Setup
# 1. Install pipu
pip install -e .
# 2. Check what's outdated
pipu list
# 3. Use interactive mode to select packages
pipu
# 4. Add constraints for critical packages
pipu constrain "django>=4.1,<5.0" "numpy>=1.20"
# 5. Update everything else
pipu update --yes
Workflow 2: CI/CD Pipeline
# Increase timeouts for CI environments
export PIPU_TIMEOUT=60
export PIPU_RETRIES=3
export PIPU_CACHE_TTL=300
# Check for outdated packages
pipu list
# Update with auto-approval
pipu update --yes
Workflow 3: Development Environment
# Create dev-specific constraints
pipu constrain "pytest>=7.0" --env development
pipu ignore requests numpy --env development
# Update only development packages
pipu update --yes
Workflow 4: Production Environment
# Strict constraints for production
pipu constrain "requests==2.28.0" --env production
pipu constrain "django~=4.1.0" --env production
# List what would be updated (without updating)
pipu list
# Only update when ready
pipu update --yes
๐ Troubleshooting
Common Issues
Slow Package Checks:
# Increase timeout and enable retries
export PIPU_TIMEOUT=30
export PIPU_RETRIES=3
pipu list
Network Errors:
# Enable debug logging
export PIPU_LOG_LEVEL=DEBUG
pipu list
Terminal Display Issues:
# The TUI handles terminal cleanup automatically
# If issues persist, pipu resets terminal state on exit
Package Not Found:
# Check if package is in your pip indexes
pip search package-name
# Check your pip configuration
pip config list
๐ License
MIT License - see LICENSE file for details.
Made with โค๏ธ for Python developers who want safe, smart package updates.
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 Distributions
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 pipu_cli-0.1.dev4-py3-none-any.whl.
File metadata
- Download URL: pipu_cli-0.1.dev4-py3-none-any.whl
- Upload date:
- Size: 73.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b10a5c447a3a971ea9c36f5c88bbbd9797b03b3756cd842a7ce71000dad527
|
|
| MD5 |
0ae56bfb80cd0d112a688a14f0c1f87d
|
|
| BLAKE2b-256 |
e3e66518b69114b86d77ae11b1625e0b9b57d6017f1d203737c26ea7f39d298e
|