Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@soapy1
Copy link
Contributor

@soapy1 soapy1 commented Sep 17, 2025

Description

Previously, the environment.yml plugin would produce duplicate errors for invalid keys. For example, consider the environment.yml:

channels:
  - anaconda
dependencies:
  - nltk
variables:
  VARIABLE: value
prefix: /something/miniconda/envs/test
wrong: surely

would produce:

$ conda env create --file tests/env/support/test.yml --env-spec environment.yml

EnvironmentSectionNotValid: The following section on 'tests/env/support/test.yml' is invalid and will be ignored:
 - wrong


EnvironmentSectionNotValid: The following section on 'tests/env/support/test.yml' is invalid and will be ignored:
 - wrong

. . .

This change makes the message only appear once:

$ conda env create --file tests/env/support/test.yml --env-spec environment.yml

EnvironmentSectionNotValid: The following section on 'tests/env/support/test.yml' is invalid and will be ignored:
 - wrong

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@github-project-automation github-project-automation bot moved this to 🆕 New in 🔎 Review Sep 17, 2025
@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Sep 17, 2025
return False

try:
self._environment = env.from_file(self.filename)
Copy link
Contributor Author

@soapy1 soapy1 Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment.yml plugin is able to handle any yaml file thrown at it. As long as the file can be read and parsed to yaml, it's good to go. The work in #15139 will update the environment spec api to read and cache the file contents.

def env(self) -> Environment:
if not self._environment:
self.can_handle()
self._environment = env.from_file(self.filename)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now we can load the environment when the user asks for the environment to be loaded.

@soapy1 soapy1 force-pushed the refactor-environment_yml-can_handle branch from fb22b7a to a7b7cac Compare September 17, 2025 22:48
@soapy1 soapy1 marked this pull request as ready for review September 17, 2025 22:49
@soapy1 soapy1 requested a review from a team as a code owner September 17, 2025 22:49
@soapy1 soapy1 force-pushed the refactor-environment_yml-can_handle branch 2 times, most recently from e91ea77 to 74eb022 Compare September 17, 2025 23:50
@codspeed-hq
Copy link

codspeed-hq bot commented Sep 18, 2025

CodSpeed Instrumentation Performance Report

Merging #15237 will not alter performance

Comparing soapy1:refactor-environment_yml-can_handle (a7fae14) with main (a01a09f)1

Summary

✅ 21 untouched

Footnotes

  1. No successful run was found on main (b512cc1) during the generation of this report, so a01a09f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@dholth dholth changed the title Don't load the environment.yml environment as part of it's can_handle Don't load environment.yml as part of its can_handle Sep 19, 2025
@dholth
Copy link
Contributor

dholth commented Sep 19, 2025

What is its can_handle?

@kenodegard
Copy link
Contributor

is this intended to be a followup to #15120?

@soapy1
Copy link
Contributor Author

soapy1 commented Sep 19, 2025

is this intended to be a followup to #15120?

yep. It uses some of the changes in #15120

Copy link
Contributor

@ryanskeith ryanskeith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I love the break up operations so more addins can be performed.

I am worried about some of the validations. I also think we might want to decide if the plugin's repsonsibility is to also check system file like errors (like missing file) or if that is another processes job.

@soapy1
Copy link
Contributor Author

soapy1 commented Sep 22, 2025

@ryanskeith it looks like all this review has more to do with #15120. I'll apply the changes there. Lemme filp this one into draft mode so it's more clear that this is a follow up PR.

@soapy1 soapy1 marked this pull request as draft September 22, 2025 15:06
@soapy1 soapy1 force-pushed the refactor-environment_yml-can_handle branch from 74eb022 to 6370759 Compare September 23, 2025 19:36
@soapy1 soapy1 marked this pull request as ready for review September 23, 2025 19:36
jezdez
jezdez previously approved these changes Sep 26, 2025
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Approved in 🔎 Review Sep 26, 2025
Co-authored-by: Jannis Leidel <[email protected]>
@soapy1 soapy1 force-pushed the refactor-environment_yml-can_handle branch from 202dac8 to a7fae14 Compare September 26, 2025 15:47
@kenodegard kenodegard changed the base branch from main to 25.9.x September 26, 2025 18:19
kenodegard
kenodegard previously approved these changes Sep 26, 2025
@kenodegard kenodegard changed the base branch from 25.9.x to main September 26, 2025 18:21
@kenodegard kenodegard dismissed their stale review September 26, 2025 18:21

The base branch was changed.

ryanskeith
ryanskeith previously approved these changes Sep 26, 2025
Copy link
Contributor

@ryanskeith ryanskeith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look great. Thank you for the work.

@kenodegard kenodegard changed the base branch from main to 25.9.x September 26, 2025 19:53
@kenodegard kenodegard dismissed ryanskeith’s stale review September 26, 2025 19:53

The base branch was changed.

@kenodegard kenodegard merged commit 84103bf into conda:25.9.x Sep 26, 2025
142 of 145 checks passed
@github-project-automation github-project-automation bot moved this from ✅ Approved to 🏁 Done in 🔎 Review Sep 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed [bot] added once the contributor has signed the CLA

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants