@@ -986,6 +986,37 @@ def cargo_installation(cloned_plugin: InstInfo):
986
986
return cloned_plugin
987
987
988
988
989
+ def install_python_uv (cloned_plugin : InstInfo ):
990
+ """This uses the rust-based python plugin manager uv to manage the python
991
+ installation and create a virtual environment."""
992
+
993
+ source = Path (cloned_plugin .source_loc ) / 'source' / cloned_plugin .name
994
+ # This virtual env path matches the other python installations and allows
995
+ # creating the wrapper in the same manner. Otherwise uv would build it in
996
+ # the source/{name} subdirectory.
997
+ cloned_plugin .venv = Path ('.venv' )
998
+
999
+ # We want the virtual env at the head of our directory structure and uv
1000
+ # will need a pyproject.toml there in order to get started.
1001
+ (Path (cloned_plugin .source_loc ) / 'pyproject.toml' ).\
1002
+ symlink_to (source / 'pyproject.toml' )
1003
+
1004
+ call = ['uv' , '-v' , 'sync' ]
1005
+ uv = run (call , cwd = str (cloned_plugin .source_loc ), stdout = PIPE , stderr = PIPE ,
1006
+ text = True , check = False )
1007
+ if uv .returncode != 0 :
1008
+ for line in uv .stderr .splitlines ():
1009
+ log .debug (line )
1010
+ log .error ('Failed to install virtual environment' )
1011
+ raise InstallationFailure ('Failed to create virtual environment!' )
1012
+
1013
+ # Delete entrypoint symlink so that a venv wrapper can take it's place
1014
+ (Path (cloned_plugin .source_loc ) / cloned_plugin .entry ).unlink ()
1015
+
1016
+ create_wrapper (cloned_plugin )
1017
+ return cloned_plugin
1018
+
1019
+
989
1020
python3venv = Installer ('python3venv' , exe = 'python3' ,
990
1021
manager = 'pip' , entry = '{name}.py' )
991
1022
python3venv .add_entrypoint ('{name}' )
@@ -997,6 +1028,7 @@ poetryvenv = Installer('poetryvenv', exe='python3',
997
1028
manager = 'poetry' , entry = '{name}.py' )
998
1029
poetryvenv .add_entrypoint ('{name}' )
999
1030
poetryvenv .add_entrypoint ('__init__.py' )
1031
+ poetryvenv .add_dependency_file ('poetry.lock' )
1000
1032
poetryvenv .add_dependency_file ('pyproject.toml' )
1001
1033
poetryvenv .dependency_call = install_to_python_virtual_environment
1002
1034
@@ -1007,6 +1039,9 @@ pyprojectViaPip.add_entrypoint('__init__.py')
1007
1039
pyprojectViaPip .add_dependency_file ('pyproject.toml' )
1008
1040
pyprojectViaPip .dependency_call = install_to_python_virtual_environment
1009
1041
1042
+ pythonuv = Installer ('pythonuv' , exe = 'python3' , manager = 'uv' , entry = "{name}.py" )
1043
+ pythonuv .add_dependency_file ('uv.lock' )
1044
+ pythonuv .dependency_call = install_python_uv
1010
1045
1011
1046
# Nodejs plugin installer
1012
1047
nodejs = Installer ('nodejs' , exe = 'node' ,
@@ -1020,7 +1055,8 @@ rust_cargo = Installer('rust', manager='cargo', entry='Cargo.toml')
1020
1055
rust_cargo .add_dependency_file ('Cargo.toml' )
1021
1056
rust_cargo .dependency_call = cargo_installation
1022
1057
1023
- INSTALLERS = [python3venv , poetryvenv , pyprojectViaPip , nodejs , rust_cargo ]
1058
+ INSTALLERS = [pythonuv , python3venv , poetryvenv , pyprojectViaPip , nodejs ,
1059
+ rust_cargo ]
1024
1060
1025
1061
1026
1062
def help_alias (targets : list ):
0 commit comments