@@ -13,6 +13,7 @@ import fs from 'node:fs/promises';
1313import os from 'node:os' ;
1414import path from 'node:path' ;
1515
16+ import { UvGlobalParameter } from './global-parameter.js' ;
1617import { UvPythonVersionsParameter } from './python-versions-parameter.js' ;
1718import { UvToolsParameter } from './tools-parameter.js' ;
1819
@@ -24,6 +25,10 @@ const schema = z.object({
2425 . array ( z . string ( ) )
2526 . describe ( 'Python versions to install via uv (e.g. ["3.12", "3.11"])' )
2627 . optional ( ) ,
28+ global : z
29+ . string ( )
30+ . describe ( 'Python version to set as the global default (exposes `python` and `python3` on PATH via --default flag)' )
31+ . optional ( ) ,
2732 tools : z
2833 . array ( z . string ( ) )
2934 . describe ( 'Global CLI tools to install via uv tool install (e.g. ["ruff", "black"])' )
@@ -41,19 +46,21 @@ const defaultConfig: Partial<UvConfig> = {
4146
4247const examplePython : ExampleConfig = {
4348 title : 'Install uv with Python versions' ,
44- description : 'Install uv and pin one or more Python versions for use across projects .' ,
49+ description : 'Install uv, pin one or more Python versions, and set one as the global default accessible as `python` on PATH .' ,
4550 configs : [ {
4651 type : 'uv' ,
4752 pythonVersions : [ '3.12' , '3.11' ] ,
53+ global : '3.12' ,
4854 } ]
4955}
5056
5157const exampleWithTools : ExampleConfig = {
5258 title : 'Install uv with Python and global tools' ,
53- description : 'Install uv, pin a Python version , and install commonly used global CLI tools like ruff and black.' ,
59+ description : 'Install uv, set a global default Python , and install commonly used global CLI tools like ruff and black.' ,
5460 configs : [ {
5561 type : 'uv' ,
5662 pythonVersions : [ '3.12' ] ,
63+ global : '3.12' ,
5764 tools : [ 'ruff' , 'black' , 'httpie' ] ,
5865 } ]
5966}
@@ -71,7 +78,8 @@ export class UvResource extends Resource<UvConfig> {
7178 schema,
7279 parameterSettings : {
7380 pythonVersions : { type : 'stateful' , definition : new UvPythonVersionsParameter ( ) , order : 1 } ,
74- tools : { type : 'stateful' , definition : new UvToolsParameter ( ) , order : 2 } ,
81+ global : { type : 'stateful' , definition : new UvGlobalParameter ( ) , order : 2 } ,
82+ tools : { type : 'stateful' , definition : new UvToolsParameter ( ) , order : 3 } ,
7583 } ,
7684 dependencies : [ ...( Utils . isMacOS ( ) ? [ 'homebrew' ] : [ ] ) ] ,
7785 } ;
0 commit comments