@@ -105,11 +105,12 @@ def get_cache_dir():
105105
106106
107107def install_platformio_core (shutdown_piohome = True , develop = False , ignore_pythons = None ):
108+ # pylint: disable=unused-argument
109+ # ignore_pythons is deprecated but kept for backward compatibility
108110 try :
109111 return _install_platformio_core (
110112 shutdown_piohome = shutdown_piohome ,
111113 develop = develop ,
112- ignore_pythons = ignore_pythons ,
113114 )
114115 except subprocess .CalledProcessError as exc :
115116 # Issue #221: Workaround for Windows OS when username contains a space
@@ -122,19 +123,18 @@ def install_platformio_core(shutdown_piohome=True, develop=False, ignore_pythons
122123 return _install_platformio_core (
123124 shutdown_piohome = shutdown_piohome ,
124125 develop = develop ,
125- ignore_pythons = ignore_pythons ,
126126 )
127127 raise exc
128128
129129
130- def _install_platformio_core (shutdown_piohome = True , develop = False , ignore_pythons = None ):
130+ def _install_platformio_core (shutdown_piohome = True , develop = False ):
131131 # pylint: disable=bad-option-value, import-outside-toplevel, unused-import, import-error, unused-variable, cyclic-import
132132 from pioinstaller import penv
133133
134134 if shutdown_piohome :
135135 home .shutdown_pio_home_servers ()
136136
137- penv_dir = penv .create_core_penv (ignore_pythons = ignore_pythons )
137+ penv_dir = penv .create_core_penv ()
138138
139139 # Use uv for installation
140140 uv_exe = penv .get_uv_executable ()
@@ -144,6 +144,10 @@ def _install_platformio_core(shutdown_piohome=True, develop=False, ignore_python
144144 )
145145
146146 _install_with_uv (uv_exe , penv_dir , develop )
147+
148+ # Install UV in the penv for future use
149+ _install_uv_in_penv (uv_exe , penv_dir )
150+
147151 _post_install_message (penv_dir )
148152 return True
149153
@@ -194,6 +198,31 @@ def _install_with_uv(uv_exe, penv_dir, develop):
194198 ) from e
195199
196200
201+ def _install_uv_in_penv (uv_exe , penv_dir ):
202+ """Install UV in the penv for future use."""
203+ from pioinstaller import penv
204+
205+ click .echo ("Installing UV in penv for future use" )
206+
207+ venv_python = os .path .join (
208+ penv .get_penv_bin_dir (penv_dir ),
209+ "python.exe" if util .IS_WINDOWS else "python" ,
210+ )
211+
212+ command = [uv_exe , "pip" , "install" , "--python" , venv_python , "uv" ]
213+
214+ log .debug ("Running: %s" , " " .join (command ))
215+ try :
216+ subprocess .check_call (
217+ command , stdout = subprocess .DEVNULL , stderr = subprocess .STDOUT
218+ )
219+ click .echo ("UV successfully installed in penv" )
220+ except subprocess .CalledProcessError as e :
221+ # Don't fail the entire installation if UV installation fails
222+ log .warning ("Could not install UV in penv: %s" , e )
223+ click .echo ("Warning: Could not install UV in penv (non-critical)" )
224+
225+
197226def _post_install_message (penv_dir ):
198227 """Display post-installation success message."""
199228 from pioinstaller import penv
0 commit comments