-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove defaults channel on input channel: nodefaults
#364
Conversation
Example 6 during
The patch is working as-intendend and in
But then there's something in the Ex6 config that differs from my simple test case that causes it to double-dip for |
Ok, got it: the setup runs |
E.g. because it is not there
Ok, the log shows the |
@conda-incubator/setup-miniconda tests are passing, just waiting on a review. |
dist/setup/index.js
Outdated
core.info("Removing channel defaults"); | ||
if (channel === "nodefaults") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core.info("Removing channel defaults"); | |
if (channel === "nodefaults") { | |
if (channel === "nodefaults") { | |
core.info("Removing channel defaults"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a tiny comment with the logging statements. LGTM otherwise.
I don't agree we should further the "nodefaults" workaround in setup-miniconda, it's a bad API since it's not an actual channel and tends to increase the risk of a messy channel management |
I think it might be enough to simply offer "override_channels" as a config option, which requires specifying a channel but doesn't hard-code the "nodefaults" workaround. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more explicit and future-proof solution is relying on the --override-channels
CLI option since nodefaults
is a pretty bad workaround within conda. That way, running conda config --remove channels defaults
isn't needed here.
Co-authored-by: jaimergp <[email protected]>
@jaimergp, nice catch! Committed 🚀
@jezdez, the current situation is one "bad" API and a second API that silently deviates from the first API in an unproductive way (i.e. a channel named "nodefaults" is literally added to the channels list). Regardless of whether the I definitely like your suggested |
Nice, even better, if conda/conda#14227 is merged I think we can even simply close this PR? |
Yep, timing will work this time. The only other workaround right now is to explicitly pass a |
Haha, yep, did exactly that downstream a couple weeks ago! pyiron/actions#129 |
Builds are breaking in CI as the package |
@oursland I'm afraid I don't have enough context to understand your statement. The only thing breaking here was the linter test -- which failed because I never rebuilt the committed ts suggestions into the js. I did that now, but I also see that conda/conda#14227 got merged last week. @jaimergp my understanding is that now we just need to wait for the next release of conda, and this PR becomes completely unnecessary, yeah? If that's the case I think we can just close this PR. |
GitHub Actions should not be considered like a normal software release as this is a piece of core CI infrastructure and is not something that can always be deferred until the next release of an upstream package, which will then be packaged into a release, and eventually distribution. The current behavior of |
I don't think I feel as strongly about it, but I also don't disagree. My opinion doesn't matter though, I'm just a rando who patched what was bothering me. If you want to get this in ASAP you'll need to convince the two reviewers. If you want something immediately that avoids erroneously including the defaults, you can check out https://github.com/pyiron/actions/blob/main/cached-miniforge/action.yml, a wrapper for
I'm afraid I'm a little lost again. Do you mean the main branch of |
The main branch is broken. This PR fixes the issue. Waiting what could be months for to fix CI is not a reasonable strategy. Your fix through caching is unfortunately not feasible for our application. For FreeCAD and others, we already use 100% of our GitHub provided caching storage budget for various compiler caches. |
@oursland, the action I linked also removes the |
AIUI Conda will go through a depreciation cycle before removal. It will probably be a bit before installers come prebaked with the newer Conda Not to mention some users may pin an installer version as part of this workflow Given this, think this change still is desirable. What do we need to do to get it in? |
Thanks @jakirkham, yes, when I posted this comment I had gone for the straight removal disregarding the deprecation cycle, which was brought in the code review. This change is still needed as a result, but I think @jezdez doesn't want the My ideas:
Since this is a new approach, I'll open a new PR. Thanks all for the fruitful discussion! |
This is the expected behavior. If I provide a list of channels, then I expect that those channels and only those channels are being used. The inclusion of I personally do not believe an additional flag to remove |
Believe it or not, it was intentionally designed that way. Not an oversight. You are "adding" channels to the list, which is prepopulated with If anything, the bug is here in setup-miniconda because we are using |
Yep that is reasonable Jaime. Am not saying it needs to be this fix, but we do need something How about we do the same thing we do in conda-forge? Namely
Then we can add any channels after |
Regardless of whether the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Liam! 🙏
Perhaps a concrete suggestion makes it clearer what I'm proposing. Please let me know what you think 🙂
@@ -47284,8 +47284,19 @@ function applyCondaConfiguration(inputs, options) { | |||
// LIFO: reverse order to preserve higher priority as listed in the option | |||
// .slice ensures working against a copy | |||
for (const channel of channels.slice().reverse()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const channel of channels.slice().reverse()) { | |
if (channels.length) { | |
yield condaCommand(["config", "--remove", "channels", "defaults"], options); | |
} | |
for (const channel of channels.slice().reverse()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this change the behaviour so that the absence of defaults
is the new default behaviour?
I actually disagree with @oursland that including defaults
by default is a bug that needs to be removed -- at least here. I'm 100% in favour of getting rid of it in the default behaviour of conda
itself, but for me it's important that setup-miniconda
be consistent with conda
where they share terminology (like "channels"). To this end I actually don't recommend changing the default behaviour, and still never want to see the channel nodefaults
explicitly get added to the channels list.
Ie fix problems upstream, and keep behaviour downstream consistent with upstream (maybe adding extra convenience on top of that consistency as in... can't find the link on mobile, but you know, the other PR relevant here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case when a user specifies channels
(like below), it would only use those channels
Lines 349 to 353 in 8f65dda
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: foo | |
python-version: 3.6 | |
channels: conda-forge,spyder-ide |
If no channels
are specified, it would fallback to the default behavior of the selected installer/Conda (typically using defaults
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this still differs from default conda
behviour, yeah? Where defaults
is included by default and setting the channel nodefaults
removes it rather than adding a channel nodefaults
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow
We don't specify how the channel
public API of this GHA is implemented. It could be specified through conda config
commands (like now) or it could be specified by writing out a condarc
or it could be options tacked onto each conda create
/conda install
command or some other way not currently being considered
Think relying on how these public APIs are implemented under-the-hood is relying on an implementation detail, which would be subject to change. There is no guarantee the implementation details would remain the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though did miss we do say we will add defaults
to the end of the list 🤦♂️
Lines 335 to 337 in 8f65dda
- conda-forge | |
- spyder-ide | |
- defaults |
That said, I think this is worth breaking. It would mean using a major version bump
if (channel === "nodefaults") { | ||
core.info("Removing channel defaults"); | ||
try { | ||
yield condaCommand(["config", "--remove", "channels", "defaults"], options); | ||
} | ||
catch (err) { | ||
core.info("Removing defaults raised an error -- it was probably not present."); | ||
} | ||
} | ||
else { | ||
core.info(`Adding channel '${channel}'`); | ||
yield condaCommand(["config", "--add", "channels", channel], options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (channel === "nodefaults") { | |
core.info("Removing channel defaults"); | |
try { | |
yield condaCommand(["config", "--remove", "channels", "defaults"], options); | |
} | |
catch (err) { | |
core.info("Removing defaults raised an error -- it was probably not present."); | |
} | |
} | |
else { | |
core.info(`Adding channel '${channel}'`); | |
yield condaCommand(["config", "--add", "channels", channel], options); | |
} | |
core.info(`Adding channel '${channel}'`); | |
yield condaCommand(["config", "--add", "channels", channel], options); |
@@ -126,8 +126,22 @@ export async function applyCondaConfiguration( | |||
// LIFO: reverse order to preserve higher priority as listed in the option | |||
// .slice ensures working against a copy | |||
for (const channel of channels.slice().reverse()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const channel of channels.slice().reverse()) { | |
if (channels.length) { | |
yield condaCommand(["config", "--remove", "channels", "defaults"], options); | |
} | |
for (const channel of channels.slice().reverse()) { |
if (channel === "nodefaults") { | ||
core.info("Removing channel defaults"); | ||
try { | ||
await condaCommand( | ||
["config", "--remove", "channels", "defaults"], | ||
options, | ||
); | ||
} catch (err) { | ||
core.info( | ||
"Removing defaults raised an error -- it was probably not present.", | ||
); | ||
} | ||
} else { | ||
core.info(`Adding channel '${channel}'`); | ||
await condaCommand(["config", "--add", "channels", channel], options); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (channel === "nodefaults") { | |
core.info("Removing channel defaults"); | |
try { | |
await condaCommand( | |
["config", "--remove", "channels", "defaults"], | |
options, | |
); | |
} catch (err) { | |
core.info( | |
"Removing defaults raised an error -- it was probably not present.", | |
); | |
} | |
} else { | |
core.info(`Adding channel '${channel}'`); | |
await condaCommand(["config", "--add", "channels", channel], options); | |
} | |
core.info(`Adding channel '${channel}'`); | |
yield condaCommand(["config", "--add", "channels", channel], options); |
It's maybe worth quickly revisiting why this PR exists: I ran into the nasty situation that Now the real solution is to fix this upstream in But what window dressing should there be? IMO, unless it is very explicitly documented, I patched the problem downstream in my own workflows by initializing an empty EDIT: missed a |
I have taken a look at this GH Search, and there around 200 workflows out there using Also, there are like 3.5k files with |
If we are going to add this with a warning, should we instead tailor the warning to...
Just thinking fewer deprecation cycles and more targeted at the end result that we want |
That sounds wise. Feel free to make a suggestion in the ts with the message worded how you want it, and I'm happy to commit it and rebuild the js |
Closed by #367 |
Changes conda setup to run
conda config --remove channels defaults
whennodefaults
is found in thechannels
input instead of adding the- nodefaults
channel. I.e.Will correctly give
Instead of
Here is a log of the modified version in action.
Closes #207