Repository navigation
Conversation
| examples=[{"requirements.txt": "ewoks==7.0.0\nnetworkx==3.4.2\n"}], | ||
| ) | ||
|
|
||
| @model_serializer(mode="wrap") |
There was a problem hiding this comment.
Adding this to put files at the end of the manager section so it's more readable.
| """Environment the manager creates at this location.""" | ||
| return Environment.at_location(location, self.ENVIRONMENT_SUBDIR) | ||
|
|
||
| def files_environment( |
There was a problem hiding this comment.
Allows pixi to override this and install into the environment named in the requirements instead of default.
| """ | ||
| return dict() | ||
|
|
||
| def _gather_extra_fields(self) -> Dict[str, str]: |
There was a problem hiding this comment.
Allows pixi to override this and add an extra field, pixi_environment_name, to record the environment name.
|
The CI issue will be fixed in: #357 |
d006a93 to
4872766
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Claude found that the env name change (not necessarily called default) was not covered everywhere:
Location is unchanged, but the prefix is no longer always default. That breaks later lookups.
-
ewoks execute --env <name>runs the wrong Pythoncommand_in_environment(__main__.py) usesEnvironment.from_location().- It only scans
ENVIRONMENT_SUBDIRS:"",.venv,.pixi/envs/default. create_environmentstill buildsdefaultfirst, so for a workspace installed from envtest,from_locationreturns the emptydefaultenv, not.pixi/envs/test.- Only
install_requirementsreturns the right environment. - Suggestion: make the lookup find the real environment (e.g. scan
.pixi/envs/*, or record the subdir in the workspace). A test with a non-default name throughfrom_locationwould cover it.
-
Empty
defaultenv is still createdcreate_environmentrunspixi installon an empty manifest before the files are installed.- Wasteful, and it is what makes the point above silently pick the wrong env.
-
_owns/is_nativestill assumedefault- They compare against
ENVIRONMENT_SUBDIR, so they return False for the non-default env. - Fine today because
is_nativeruns beforefiles_environment, but fragile.
- They compare against
-
pixi add --environmentneeds pixi >= 0.74_add_ewoksnow always passes--environment, also fordefault.pixi addhas no--environmentoption before 0.74, as far as I can tell: it came with inline environments (prefix-dev/pixi#6497).- So with an older pixi,
ewoks installfails at its last step (adding ewoks), even for thedefaultenv. - Nothing checks the pixi version. I suggest passing
--environmentonly when the name is notdefault. Otherwise, add a minimum version check like the one inpoetry.py.
-
Minor
PIXI_ENVIRONMENT_NAMEtakes precedence oversys.prefix; they can disagree if the interpreter is not the one pixi activated.
Related: #353 (install location). Both need one way to resolve "the environment of a location" instead of fixed subdirs. I can make a follow-up for both.
6570627 to
be75292
Compare
PR summary
Closes #355
ewoks installwith pixi always installed thedefaultenvironment of the workspace, even when the requirements were gathered in another pixi environment. The requirements now record the name of the pixi environment, and the install uses it.Recording the pixi environment name
pixi_environment_name, was added to the pixi manager._gather_extra_fields()was added toBaseManager: each package manager can add its own fields to its manager info if needed.Installing the pixi environment
files_environment()was added toBaseManager: each package manager can set the environment in which the files of the requirements are installed if needed. Ex: Pixi returns<workspace>/.pixi/envs/<pixi_environment_name>instead of<workspace>/.pixi/envs/defaultpixi installandpixi addnow pass--environment.default.Tests
AI Disclosure