Skip to content
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

fix: Export 'channels' as part of environments' export #3587

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mathbunnyru
Copy link
Contributor

@mathbunnyru mathbunnyru commented Nov 8, 2024

If I run the following:

mamba env create --name empty
mamba env export --name empty

it will give me:

name: empty
channels:
dependencies:

prefix: "/Users/asalikhov/test-mamba-root/envs/empty"

Note: channels, dependencies are always printed, even if empty.

But if I run export with --json, it will not print channels::

{
  "dependencies": [
  ],
  "name": "empty",
  "prefix": "/Users/asalikhov/test-mamba-root/envs/empty"
}

I think it's always good to print channels, it makes parsing easier.

Related: #3582

@pytest.mark.parametrize("channel_subdir_flag", [None, "--channel-subdir"])
@pytest.mark.parametrize("md5_flag", [None, "--md5", "--no-md5"])
@pytest.mark.parametrize("explicit_flag", [None, "--explicit"])
@pytest.mark.parametrize("no_build_flag", [None, "--no-build", "--no-builds"])
@pytest.mark.parametrize("json_flag", [None, "--json"])
def test_env_export(
export_env, json_flag, no_build_flag, explicit_flag, md5_flag, channel_subdir_flag
channel_subdir_flag, md5_flag, explicit_flag, no_build_flag, json_flag, export_env
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the order it is mentioned above, it's better to have the same order everywhere

else:
ret = yaml.safe_load(output)
# json is already parsed
ret = output if json_flag else yaml.safe_load(output)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is quite easy to read as a one-line

@jjerphan jjerphan added the release::bug_fixes For PRs fixing bugs label Nov 15, 2024
@jjerphan jjerphan changed the title Always print 'channels' during env export fix: Export 'channels' as part of environments' export Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release::bug_fixes For PRs fixing bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants