Commit a251c6b
authored
fix(installer): Prioritize system site packages over server-libs (#38)
* fix(installer): prioritize user-installed packages over server-libs
Change sys.path.insert(0, ...) to sys.path.append(...) for server
site-packages so user-installed packages in system site-packages
take precedence over bundled server-libs packages.
Previously, server-libs were inserted at the front of sys.path,
causing bundled versions to override user-installed versions
(e.g., streamlit).
* fix(installer): prioritize user-installed packages over server-libs
Change sys.path.insert(0, ...) to sys.path.append(...) for server
site-packages so user-installed packages in system site-packages
take precedence over bundled server-libs packages.
Previously, server-libs were inserted at the front of sys.path,
causing bundled versions to override user-installed versions
(e.g., streamlit).
* fix(installer): ensure system site-packages has priority over server-libs
Add priority parameter to import_package_bundle that uses sys.path.insert(0)
to place packages at the front of sys.path. System site-packages now uses
this priority flag to ensure user-installed packages are found before
bundled server-libs packages.
* test(installer): add tests for import_package_bundle priority param
Add unit tests for VirtualEnvironment.import_package_bundle covering:
- Plain path appending to .pth file
- Conditional import with env var check
- Priority flag using sys.path.insert(0, ...)
- Ordering of bundles matching __main__.py usage
* refactor(installer): improve import_package_bundle and tests
- Add guard to raise ValueError when both condition_env and priority
are specified (mutually exclusive parameters)
- Update docstring to document the mutual exclusivity constraint
- Refactor tests to use pathlib.Path instead of os.path/os.makedirs
- Add test for mutually exclusive parameter validation
* style(installer): make priority param keyword-only
Add bare * before priority parameter to enforce keyword-only usage,
satisfying Ruff FBT rules for boolean parameters.1 parent 4d48a52 commit a251c6b
File tree
3 files changed
+126
-3
lines changed- installer
- module
- tests/unit
3 files changed
+126
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
91 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
92 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
93 | 107 | | |
94 | 108 | | |
95 | 109 | | |
| |||
105 | 119 | | |
106 | 120 | | |
107 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
108 | 131 | | |
109 | 132 | | |
110 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
0 commit comments