pythagoras 0.20.3__py3-none-any.whl → 0.20.4__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.
@@ -3,12 +3,43 @@ import importlib
|
|
3
3
|
import sys
|
4
4
|
from typing import Optional
|
5
5
|
|
6
|
+
_uv_and_pip_installation_needed:bool = True
|
7
|
+
|
8
|
+
def _install_uv_and_pip() -> None:
|
9
|
+
global _uv_and_pip_installation_needed
|
10
|
+
if not _uv_and_pip_installation_needed:
|
11
|
+
return
|
12
|
+
_uv_pip_installation_attempted = False
|
13
|
+
|
14
|
+
try:
|
15
|
+
importlib.import_module("uv")
|
16
|
+
except:
|
17
|
+
install_package("uv", use_uv=False)
|
18
|
+
|
19
|
+
try:
|
20
|
+
importlib.import_module("pip")
|
21
|
+
except:
|
22
|
+
install_package("pip", use_uv=True)
|
23
|
+
|
24
|
+
|
6
25
|
def install_package(package_name:str
|
7
26
|
, upgrade:bool=False
|
8
27
|
, version:Optional[str]=None
|
28
|
+
, use_uv:bool = True
|
9
29
|
) -> None:
|
10
30
|
"""Install package using pip."""
|
11
|
-
|
31
|
+
|
32
|
+
if package_name == "pip":
|
33
|
+
assert use_uv
|
34
|
+
elif package_name == "uv":
|
35
|
+
assert not use_uv
|
36
|
+
else:
|
37
|
+
_install_uv_and_pip()
|
38
|
+
|
39
|
+
if use_uv:
|
40
|
+
command = [sys.executable, "-m", "uv", "pip", "install"]
|
41
|
+
else:
|
42
|
+
command = [sys.executable, "-m", "pip", "install"]
|
12
43
|
|
13
44
|
if upgrade:
|
14
45
|
command += ["--upgrade"]
|
@@ -21,10 +52,17 @@ def install_package(package_name:str
|
|
21
52
|
|
22
53
|
importlib.import_module(package_name)
|
23
54
|
|
24
|
-
def uninstall_package(package_name:str)->None:
|
25
|
-
"""Uninstall package using pip."""
|
26
55
|
|
27
|
-
|
56
|
+
def uninstall_package(package_name:str, use_uv:bool=True)->None:
|
57
|
+
"""Uninstall package using uv or pip."""
|
58
|
+
|
59
|
+
assert package_name not in ["pip", "uv"]
|
60
|
+
|
61
|
+
if use_uv:
|
62
|
+
command = [sys.executable, "-m", "uv", "pip", "uninstall", package_name]
|
63
|
+
else:
|
64
|
+
command = [sys.executable, "-m", "pip", "uninstall", "-y", package_name]
|
65
|
+
|
28
66
|
subprocess.run(command, check=True, stdout=subprocess.PIPE
|
29
67
|
, stderr=subprocess.STDOUT, text=True)
|
30
68
|
|
@@ -36,7 +36,7 @@ pythagoras/_070_protected_code_portals/RAM_guards.py,sha256=cd439db72375ad0c2c62
|
|
36
36
|
pythagoras/_070_protected_code_portals/__init__.py,sha256=1e1a4ccccede6cd416d172967fb766ba91bbafddff078187799f044ed71677b3,195
|
37
37
|
pythagoras/_070_protected_code_portals/fn_arg_names_checker.py,sha256=2000ba3cab7d5828eba5b096358249c3ed460f7b82d41aaabcad945fd5e48a74,1215
|
38
38
|
pythagoras/_070_protected_code_portals/list_flattener.py,sha256=9a54b512ad9dc201db348e7908f5ca5f36d171ae3da433511d38023a6ba8d4b5,331
|
39
|
-
pythagoras/_070_protected_code_portals/package_manager.py,sha256=
|
39
|
+
pythagoras/_070_protected_code_portals/package_manager.py,sha256=30adf8d75f55b9b2c587dc95f4aa1c2154fa9354d668af6f0d586bb42f0d5b17,2008
|
40
40
|
pythagoras/_070_protected_code_portals/protected_decorators.py,sha256=9cede3734b0235e15a9534fcf393454f9107073f90cf9bd5a532696d277e35da,1412
|
41
41
|
pythagoras/_070_protected_code_portals/protected_portal_core_classes.py,sha256=58e66f14598a23d6d4bfa4dd3d510971ce272a11ea73a22d11b72487df112968,6616
|
42
42
|
pythagoras/_070_protected_code_portals/python_packages_guards.py,sha256=a4ff97c250cbc94ad379edcab510fe10d4d590de9733bbff437bed71c025cecb,1025
|
@@ -60,6 +60,6 @@ pythagoras/_900_project_stats_collector/__init__.py,sha256=e3b0c44298fc1c149afbf
|
|
60
60
|
pythagoras/_900_project_stats_collector/project_analyzer.py,sha256=d06e9d7b516cb7424ef777e70abe9d5220e09b0b19476326b8974b4dc3917f89,3506
|
61
61
|
pythagoras/__init__.py,sha256=94303c01a7bde4078fdbd90c0b142807a023fa352c473c3a544a2180b7254ae9,1062
|
62
62
|
pythagoras/core/__init__.py,sha256=26640880921763e8801b74da28fccf1cd47ac0ba0d40ee8fcaf7d748410406bf,189
|
63
|
-
pythagoras-0.20.
|
64
|
-
pythagoras-0.20.
|
65
|
-
pythagoras-0.20.
|
63
|
+
pythagoras-0.20.4.dist-info/WHEEL,sha256=7de84e261f5edc1201bd668234a371ec3eb94db037d1f75c0139430c1319ab31,79
|
64
|
+
pythagoras-0.20.4.dist-info/METADATA,sha256=85100495f6fdc9536d83f64d0fee2ec62b5613c9b38edd80ef564e67f1ee348b,4177
|
65
|
+
pythagoras-0.20.4.dist-info/RECORD,,
|
File without changes
|