2020
2121if TYPE_CHECKING :
2222 from collections .abc import MutableMapping
23+ from pathlib import Path
2324
2425 from tomlkit .items import Table
2526
@@ -44,7 +45,9 @@ def update_pixi_configuration(
4445 add_badge ,
4546 "[](https://pixi.sh)" ,
4647 )
47- do (_define_minimal_project , config )
48+ if config_path == CONFIG_PATH .pixi_toml :
49+ do (_rename_workspace_table , config )
50+ do (_define_minimal_project , config , config_path )
4851 do (_import_conda_dependencies , config )
4952 do (_import_conda_environment , config )
5053 if package_manager == "pixi+uv" :
@@ -88,9 +91,24 @@ def _define_combined_ci_job(config: ModifiablePyproject) -> None:
8891 config .changelog .append (msg )
8992
9093
91- def _define_minimal_project (config : ModifiablePyproject ) -> None :
94+ def _rename_workspace_table (config : ModifiablePyproject ) -> None :
95+ if not __has_table (config , "project" ):
96+ return
97+ project = __get_table (config , "project" )
98+ workspace = __get_table (config , "workspace" , create = True )
99+ workspace .update (project )
100+ del config ._document ["project" ] # type:ignore[misc] # noqa: SLF001
101+ msg = 'Renamed "project" table to "workspace" in Pixi configuration'
102+ config .changelog .append (msg )
103+
104+
105+ def _define_minimal_project (config : ModifiablePyproject , path : Path ) -> None :
92106 """Create a minimal Pixi project definition if it does not exist."""
93- settings = __get_table (config , "project" , create = True )
107+ if path == CONFIG_PATH .pixi_toml :
108+ table_name = "workspace"
109+ else :
110+ table_name = "project"
111+ settings = __get_table (config , table_name , create = True )
94112 minimal_settings : dict [str , Any ] = dict (
95113 channels = ["conda-forge" ],
96114 platforms = ["linux-64" ],
0 commit comments