pipu-cli 0.1.dev7__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,422 @@
1
+ Metadata-Version: 2.4
2
+ Name: pipu-cli
3
+ Version: 0.2.0
4
+ Summary: A cute Python package updater
5
+ Author-email: Scott Arne Johnson <scott.arne.johnson@gmail.com>
6
+ License-Expression: MIT
7
+ Keywords: pip,pipu,package,updater,package management
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: rich_click<2.0,>=1.7
14
+ Requires-Dist: rich<15.0,>=13.0
15
+ Requires-Dist: packaging<26.0,>=23.0
16
+ Requires-Dist: tomli>=2.0.0; python_version < "3.11"
17
+ Provides-Extra: dev
18
+ Requires-Dist: invoke; extra == "dev"
19
+ Requires-Dist: build; extra == "dev"
20
+ Dynamic: license-file
21
+
22
+ <p align="center">
23
+ <img src=".assets/pipu.png" alt="pipu logo" width="300"/>
24
+ </p>
25
+
26
+ # pipu
27
+
28
+ **pipu** is a smart Python package updater that safely upgrades your installed packages while respecting dependency constraints. It's like `pip list --outdated` + automated upgrades, but safe and easy.
29
+
30
+ ## Why pipu?
31
+
32
+ Keeping Python packages up-to-date is important, but upgrading packages manually is tedious and risky:
33
+
34
+ - Running `pip install --upgrade` for each package is time-consuming
35
+ - Upgrading one package might break others due to dependency constraints
36
+ - Hard to know which packages can be safely upgraded together
37
+
38
+ **pipu solves these problems:**
39
+
40
+ - Automatically finds all packages that can be safely upgraded
41
+ - Shows you exactly what will be upgraded before doing anything
42
+ - Upgrades everything in one command, letting pip handle the details
43
+ - Provides rollback capability if something goes wrong
44
+ - Beautiful terminal UI with progress indicators
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ pip install pipu-cli
50
+ ```
51
+
52
+ ## Quick Start
53
+
54
+ Simply run `pipu` in your Python environment:
55
+
56
+ ```bash
57
+ pipu
58
+ ```
59
+
60
+ That's it! pipu will:
61
+
62
+ 1. Check all your installed packages
63
+ 2. Find available updates (using cache if fresh, or fetching from PyPI)
64
+ 3. Determine which ones are safe to upgrade
65
+ 4. Show you a table of what will be upgraded
66
+ 5. Ask for confirmation (press Y to proceed)
67
+ 6. Upgrade everything safely
68
+
69
+ ## Example Session
70
+
71
+ ```
72
+ $ pipu
73
+
74
+ Step 1/5: Inspecting installed packages...
75
+ Found 182 installed packages
76
+
77
+ Step 2/5: Checking for updates...
78
+ Found 12 packages with newer versions available
79
+
80
+ Step 3/5: Resolving dependency constraints...
81
+ 3 packages can be safely upgraded
82
+
83
+ Step 4/5: Packages ready for upgrade:
84
+
85
+ ┏━━━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━┓
86
+ ┃ Package ┃ Current ┃ Latest ┃
87
+ ┡━━━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━┩
88
+ │ requests │ 2.28.0 │ 2.31.0 │
89
+ │ rich │ 13.0.0 │ 13.7.0 │
90
+ │ click │ 8.1.3 │ 8.1.7 │
91
+ └───────────────┴─────────┴─────────┘
92
+
93
+ Do you want to proceed with the upgrade? [Y/n]: y
94
+
95
+ Step 5/5: Upgrading packages...
96
+ Successfully installed requests-2.31.0 rich-13.7.0 click-8.1.7
97
+
98
+ Successfully upgraded 3 package(s)
99
+ - requests: 2.28.0 -> 2.31.0
100
+ - rich: 13.0.0 -> 13.7.0
101
+ - click: 8.1.3 -> 8.1.7
102
+ ```
103
+
104
+ ## Usage Examples
105
+
106
+ ### Upgrade specific packages only
107
+
108
+ ```bash
109
+ # Upgrade a single package
110
+ pipu upgrade requests
111
+
112
+ # Upgrade multiple specific packages
113
+ pipu upgrade requests numpy pandas
114
+ ```
115
+
116
+ ### Upgrade to a specific version
117
+
118
+ ```bash
119
+ # Pin to exact version
120
+ pipu upgrade requests==2.31.0
121
+
122
+ # Use version constraints
123
+ pipu upgrade "requests>=2.30,<3.0"
124
+ ```
125
+
126
+ ### Preview changes without installing (dry run)
127
+
128
+ ```bash
129
+ pipu --dry-run
130
+ ```
131
+
132
+ ### Exclude packages from upgrade
133
+
134
+ ```bash
135
+ # Exclude single package
136
+ pipu --exclude numpy
137
+
138
+ # Exclude multiple packages
139
+ pipu --exclude numpy,pandas,scipy
140
+ ```
141
+
142
+ ### See why packages can't be upgraded
143
+
144
+ ```bash
145
+ pipu --show-blocked
146
+ ```
147
+
148
+ This displays packages that have updates available but can't be upgraded due to dependency constraints, along with the specific constraints blocking them.
149
+
150
+ ### Interactive package selection
151
+
152
+ ```bash
153
+ pipu -i
154
+ ```
155
+
156
+ This shows a numbered list of upgradable packages and lets you choose which ones to upgrade.
157
+
158
+ ### Skip confirmation prompt (for scripts/automation)
159
+
160
+ ```bash
161
+ pipu -y
162
+ ```
163
+
164
+ ### Machine-readable JSON output
165
+
166
+ ```bash
167
+ pipu --output json --dry-run
168
+ ```
169
+
170
+ Useful for CI/CD pipelines and scripting.
171
+
172
+ ### Speed up version checking with parallel requests
173
+
174
+ ```bash
175
+ pipu --parallel 10
176
+ ```
177
+
178
+ Uses multiple concurrent requests to check for updates (default: 1, sequential).
179
+
180
+ ### Update requirements.txt after upgrade
181
+
182
+ ```bash
183
+ pipu --update-requirements requirements.txt
184
+ ```
185
+
186
+ Automatically updates your requirements file with the new versions after a successful upgrade.
187
+
188
+ ### Include pre-release versions
189
+
190
+ ```bash
191
+ pipu --pre
192
+ ```
193
+
194
+ ### Debug mode
195
+
196
+ ```bash
197
+ pipu --debug
198
+ ```
199
+
200
+ Shows timing information and explains why packages can or cannot be upgraded.
201
+
202
+ ## Rollback
203
+
204
+ If an upgrade causes problems, you can rollback to the previous state:
205
+
206
+ ```bash
207
+ # Preview what would be rolled back
208
+ pipu rollback --dry-run
209
+
210
+ # Perform the rollback
211
+ pipu rollback
212
+
213
+ # List all saved states
214
+ pipu rollback --list
215
+
216
+ # Rollback to a specific state
217
+ pipu rollback --state state_20241205_143022.json
218
+ ```
219
+
220
+ pipu automatically saves your package state before each upgrade, so you can always revert if needed.
221
+
222
+ ## Caching
223
+
224
+ pipu caches package version information to speed up repeated runs. The cache is per-environment, so it works correctly with venv, conda, mise, and other environment managers.
225
+
226
+ ```bash
227
+ # Refresh the cache manually
228
+ pipu update
229
+
230
+ # Upgrade using cached data (default behavior)
231
+ pipu upgrade
232
+
233
+ # Force fresh version check, ignoring cache
234
+ pipu upgrade --no-cache
235
+
236
+ # View cache status
237
+ pipu cache
238
+
239
+ # Clear all caches
240
+ pipu cache --all
241
+ ```
242
+
243
+ By default, the cache is considered fresh for 1 hour. You can adjust this:
244
+
245
+ ```bash
246
+ # Use a shorter TTL (in seconds)
247
+ pipu upgrade --cache-ttl 300
248
+ ```
249
+
250
+ ## Command Reference
251
+
252
+ ### Commands
253
+
254
+ | Command | Description |
255
+ |---------|-------------|
256
+ | `pipu` or `pipu upgrade` | Upgrade packages (default command) |
257
+ | `pipu update` | Refresh the package version cache |
258
+ | `pipu rollback` | Restore packages to a previous state |
259
+ | `pipu cache` | Show cache information or clear cache |
260
+
261
+ ### Upgrade Options
262
+
263
+ | Option | Short | Description |
264
+ |--------|-------|-------------|
265
+ | `PACKAGES` | | Optional package names to upgrade (default: all) |
266
+ | `--dry-run` | | Show what would be upgraded without installing |
267
+ | `--exclude TEXT` | | Comma-separated list of packages to exclude |
268
+ | `--show-blocked` | | Show packages blocked by constraints |
269
+ | `--interactive` | `-i` | Interactively select packages to upgrade |
270
+ | `--output [human\|json]` | | Output format (default: human) |
271
+ | `--parallel INTEGER` | | Number of parallel version check requests (default: 1) |
272
+ | `--update-requirements PATH` | | Update a requirements.txt file after upgrade |
273
+ | `--no-cache` | | Skip cache and fetch fresh version data |
274
+ | `--cache-ttl INTEGER` | | Cache freshness threshold in seconds (default: 3600) |
275
+ | `--timeout INTEGER` | | Network timeout in seconds (default: 10) |
276
+ | `--pre` | | Include pre-release versions |
277
+ | `--yes` | `-y` | Skip confirmation prompt |
278
+ | `--debug` | | Show detailed logging and timing info |
279
+
280
+ ### Rollback Options
281
+
282
+ | Option | Short | Description |
283
+ |--------|-------|-------------|
284
+ | `--list` | `-l` | List all saved rollback states |
285
+ | `--dry-run` | | Show what would be rolled back |
286
+ | `--state FILE` | | Rollback to a specific state file |
287
+ | `--yes` | `-y` | Skip confirmation prompt |
288
+
289
+ ### Cache Options
290
+
291
+ | Option | Short | Description |
292
+ |--------|-------|-------------|
293
+ | `--all` | `-a` | Clear cache for all environments |
294
+
295
+ ## Configuration File
296
+
297
+ pipu supports configuration files to set default options. Create a `.pipu.toml` file in your project directory:
298
+
299
+ ```toml
300
+ timeout = 30
301
+ exclude = ["numpy", "pandas"]
302
+ pre = false
303
+ parallel = 5
304
+ cache_ttl = 3600
305
+ cache_enabled = true
306
+ ```
307
+
308
+ Or add a `[tool.pipu]` section to your `pyproject.toml`:
309
+
310
+ ```toml
311
+ [tool.pipu]
312
+ timeout = 30
313
+ exclude = ["numpy", "pandas"]
314
+ parallel = 5
315
+ ```
316
+
317
+ You can also create a user-level config at `~/.config/pipu/config.toml`.
318
+
319
+ **Priority:** Command-line options > Project config > User config
320
+
321
+ ### Environment Variables
322
+
323
+ | Variable | Description |
324
+ |----------|-------------|
325
+ | `PIPU_TIMEOUT` | Network timeout in seconds (default: 10) |
326
+ | `PIPU_CACHE_TTL` | Cache freshness threshold in seconds (default: 3600) |
327
+ | `PIPU_CACHE_ENABLED` | Enable/disable caching (default: true) |
328
+ | `PIPU_CACHE_DIR` | Cache directory (default: ~/.pipu/cache) |
329
+
330
+ ## How Does It Work?
331
+
332
+ pipu analyzes your package dependencies to determine which packages can be upgraded without breaking anything:
333
+
334
+ - **Safe by default**: Only upgrades packages when all dependency constraints are satisfied
335
+ - **Batch upgrades**: Upgrades compatible packages together, letting pip's resolver handle the details
336
+ - **Smart resolution**: Uses a fixed-point iteration algorithm to handle complex dependency scenarios, including circular dependencies
337
+ - **Rollback support**: Saves package state before upgrades so you can revert if needed
338
+ - **Per-environment caching**: Caches version data separately for each Python environment (venv, conda, mise, etc.)
339
+
340
+ If pipu says a package can't be upgraded, it's usually because upgrading it would break another package. Use `--show-blocked` to see exactly which constraints are preventing the upgrade.
341
+
342
+ ## Common Questions
343
+
344
+ **Q: Is it safe to use pipu?**
345
+ A: Yes! pipu only upgrades packages when it's safe to do so. It uses the same pip underneath, with added safety checks. Plus, you can always rollback if needed.
346
+
347
+ **Q: Why didn't pipu upgrade package X?**
348
+ A: Probably because upgrading it would break another package. Use `--show-blocked` to see the specific constraints, or `--debug` for more details.
349
+
350
+ **Q: Can I use pipu in scripts or CI/CD?**
351
+ A: Absolutely! Use `pipu --yes --output json` for automated workflows.
352
+
353
+ **Q: What if all my packages are blocked?**
354
+ A: This means upgrading them would cause conflicts. This is actually good - pipu is preventing a broken environment.
355
+
356
+ **Q: Does pipu work with private PyPI repositories?**
357
+ A: Yes! pipu respects your pip configuration (index-url, extra-index-url, trusted-host, etc.).
358
+
359
+ **Q: How do I speed up pipu for large environments?**
360
+ A: Use `--parallel 10` (or higher) to check multiple packages concurrently.
361
+
362
+ ## Tips
363
+
364
+ - **Run pipu regularly** to keep your packages up-to-date
365
+ - **Use `--dry-run`** first to preview changes before committing
366
+ - **Use `--show-blocked`** to understand why certain packages can't be upgraded
367
+ - **Use `--update-requirements`** to keep your requirements.txt in sync
368
+ - **Use `pipu update`** to refresh the cache before checking for updates
369
+ - **Use virtual environments** to isolate different projects
370
+
371
+ ## Troubleshooting
372
+
373
+ ### "No packages can be upgraded (all blocked by constraints)"
374
+
375
+ This means all available updates would violate dependency constraints. Your environment is in a stable state, which is good! If you really need a specific update:
376
+
377
+ 1. Use `--show-blocked` to see what's blocking each package
378
+ 2. Consider upgrading the blocking packages first
379
+ 3. Or manually upgrade with `pip install --upgrade package-name` if you accept the risk
380
+
381
+ ### Network timeout errors
382
+
383
+ If you see timeout errors, increase the timeout:
384
+
385
+ ```bash
386
+ pipu --timeout 30
387
+ ```
388
+
389
+ ### Stale cache data
390
+
391
+ If pipu shows outdated version info, refresh the cache:
392
+
393
+ ```bash
394
+ pipu update
395
+ # or
396
+ pipu upgrade --no-cache
397
+ ```
398
+
399
+ ### Rolling back after a bad upgrade
400
+
401
+ If something broke after an upgrade:
402
+
403
+ ```bash
404
+ pipu rollback
405
+ ```
406
+
407
+ ## Requirements
408
+
409
+ - Python 3.10 or higher
410
+ - pip (comes with Python)
411
+
412
+ ## License
413
+
414
+ MIT License - See LICENSE file for details
415
+
416
+ ## Author
417
+
418
+ Scott Arne Johnson (scott.arne.johnson@gmail.com)
419
+
420
+ ## Contributing
421
+
422
+ Found a bug or want to contribute? Check out the [GitHub repository](https://github.com/scott-arne/pipu-cli)!
@@ -0,0 +1,16 @@
1
+ pipu_cli/__init__.py,sha256=oN3HVmBGVKNTLG_Ut4GZrH1W3EfUrK_MJqZQ1NIwOnc,1191
2
+ pipu_cli/cache.py,sha256=kQa1GrrDcCT_CcJuMPX79BLBrcB55NArtxQTzzwyNOE,9199
3
+ pipu_cli/cli.py,sha256=W1LNlo3zbO11x-AiFJHJY1Z2eFSNIVcnECLANNgPnwY,34807
4
+ pipu_cli/config.py,sha256=lixyWhJBz5GqdyRIygc4g5Wzc94HPC4sVFCgeINtQtw,1542
5
+ pipu_cli/config_file.py,sha256=2X2UqtJQV7M-czNTx_Hqu-rWLKkK7cn8l8kZ4HNbBkM,2196
6
+ pipu_cli/output.py,sha256=9g64hxHIXxJlq0mmhRwZnbPMMGPpTfSRkH90rc-QPjA,3510
7
+ pipu_cli/package_management.py,sha256=p4m7o5W-RZu4wOZMiU5Sp6WvvnZ2SbUoCIXqYIT3yQU,44822
8
+ pipu_cli/pretty.py,sha256=6qBohKDtocm6vJc2rtH9RLgvvHYJiaGMnmhs6QyC0kE,9293
9
+ pipu_cli/requirements.py,sha256=zbh7XwxD9he_5csJitEGT0NfiE4qbXPw_-JSDuHv4G8,2665
10
+ pipu_cli/rollback.py,sha256=gL9ueYtAKDoALqRfJE2S5gnw1Id5QBLaPC1UL_WjzzY,2980
11
+ pipu_cli-0.2.0.dist-info/licenses/LICENSE,sha256=q6TxVbSI0WMB9ulF2V0FWQfeA5om3d-T9X7QwuhdiYE,1075
12
+ pipu_cli-0.2.0.dist-info/METADATA,sha256=ZArCxjCSlgfz4uTSYb0Szpa3_fOjpOJqaNYxjLHF_jU,11919
13
+ pipu_cli-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ pipu_cli-0.2.0.dist-info/entry_points.txt,sha256=VSv6od00zOPblnFPflNLaci4jBtQIgLYJjL1BKxLz_o,42
15
+ pipu_cli-0.2.0.dist-info/top_level.txt,sha256=z3Yce93-jGQjGRpsGZUZvbS8osh3OyS7MVpzG0uBE5M,9
16
+ pipu_cli-0.2.0.dist-info/RECORD,,
pipu_cli/common.py DELETED
@@ -1,4 +0,0 @@
1
- # Global console object
2
- from rich.console import Console
3
-
4
- console = Console()