pipu-cli 0.1.dev0__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.
pipu_cli/common.py ADDED
@@ -0,0 +1,4 @@
1
+ # Global console object
2
+ from rich.console import Console
3
+
4
+ console = Console()
pipu_cli/config.py ADDED
@@ -0,0 +1,95 @@
1
+ """
2
+ Configuration constants and settings for pipu.
3
+
4
+ This module centralizes all configuration values, magic numbers, and
5
+ environment-based settings to improve maintainability.
6
+ """
7
+
8
+ import os
9
+ import logging
10
+
11
+ # ============================================================================
12
+ # Network Configuration
13
+ # ============================================================================
14
+
15
+ # Default timeout for network operations (seconds)
16
+ DEFAULT_NETWORK_TIMEOUT = int(os.environ.get('PIPU_TIMEOUT', '10'))
17
+
18
+ # Number of retries for failed network operations
19
+ DEFAULT_NETWORK_RETRIES = int(os.environ.get('PIPU_RETRIES', '0'))
20
+
21
+ # Maximum consecutive network errors before failing
22
+ MAX_CONSECUTIVE_NETWORK_ERRORS = int(os.environ.get('PIPU_MAX_NETWORK_ERRORS', '1'))
23
+
24
+ # Brief delay between retries (seconds)
25
+ RETRY_DELAY = float(os.environ.get('PIPU_RETRY_DELAY', '0.5'))
26
+
27
+ # ============================================================================
28
+ # Cache Configuration
29
+ # ============================================================================
30
+
31
+ # Time-to-live for editable packages cache (seconds)
32
+ EDITABLE_PACKAGES_CACHE_TTL = float(os.environ.get('PIPU_CACHE_TTL', '60.0'))
33
+
34
+ # ============================================================================
35
+ # Subprocess Configuration
36
+ # ============================================================================
37
+
38
+ # Timeout for subprocess operations (seconds)
39
+ SUBPROCESS_TIMEOUT = int(os.environ.get('PIPU_SUBPROCESS_TIMEOUT', '30'))
40
+
41
+ # Timeout for package uninstall operations (seconds)
42
+ UNINSTALL_TIMEOUT = int(os.environ.get('PIPU_UNINSTALL_TIMEOUT', '120'))
43
+
44
+ # Timeout for forced process termination (seconds)
45
+ FORCE_KILL_TIMEOUT = float(os.environ.get('PIPU_FORCE_KILL_TIMEOUT', '5.0'))
46
+
47
+ # ============================================================================
48
+ # TUI Configuration
49
+ # ============================================================================
50
+
51
+ # Timeout for graceful exit (seconds)
52
+ FORCE_EXIT_TIMEOUT = float(os.environ.get('PIPU_EXIT_TIMEOUT', '3.0'))
53
+
54
+ # Scroll buffer size for log output
55
+ LOG_SCROLL_BUFFER_LINES = int(os.environ.get('PIPU_LOG_BUFFER', '1000'))
56
+
57
+ # Delay for table refresh operations (seconds)
58
+ TABLE_REFRESH_DELAY = float(os.environ.get('PIPU_TABLE_REFRESH', '0.01'))
59
+
60
+ # ============================================================================
61
+ # Logging Configuration
62
+ # ============================================================================
63
+
64
+ # Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
65
+ LOG_LEVEL_STR = os.environ.get('PIPU_LOG_LEVEL', 'WARNING').upper()
66
+
67
+ # Convert string to logging level
68
+ try:
69
+ LOG_LEVEL = getattr(logging, LOG_LEVEL_STR)
70
+ except AttributeError:
71
+ LOG_LEVEL = logging.WARNING
72
+
73
+ # ============================================================================
74
+ # Testing Configuration
75
+ # ============================================================================
76
+
77
+ # Skip package validation in tests (set by test fixtures)
78
+ SKIP_PACKAGE_VALIDATION = os.environ.get('PIPU_SKIP_PKG_VALIDATION', '').lower() in ('1', 'true', 'yes')
79
+
80
+ # ============================================================================
81
+ # File Paths
82
+ # ============================================================================
83
+
84
+ # Default constraints file name
85
+ DEFAULT_CONSTRAINTS_FILE = 'constraints.txt'
86
+
87
+ # Default ignores file name
88
+ DEFAULT_IGNORES_FILE = 'ignores.txt'
89
+
90
+ # ============================================================================
91
+ # Version Display
92
+ # ============================================================================
93
+
94
+ # Maximum packages to show in summary before truncating
95
+ MAX_PACKAGES_DISPLAY = 5