-
Notifications
You must be signed in to change notification settings - Fork 432
maint: YAML environment specification utilities #4158
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
Open
jjerphan
wants to merge
2
commits into
mamba-org:main
Choose a base branch
from
jjerphan:maint/yaml-utils
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,388
−258
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // Copyright (c) 2026, QuantStack and Mamba Contributors | ||
| // | ||
| // Distributed under the terms of the BSD 3-Clause License. | ||
| // | ||
| // The full license is in the file LICENSE, distributed with this software. | ||
|
|
||
| #ifndef MAMBA_API_ENVIRONMENT_YAML_HPP | ||
| #define MAMBA_API_ENVIRONMENT_YAML_HPP | ||
|
|
||
| #include <iosfwd> | ||
| #include <map> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #include "mamba/fs/filesystem.hpp" | ||
|
|
||
| // Include install.hpp for other_pkg_mgr_spec definition (needed by yaml_file_contents) | ||
| #include "mamba/api/install.hpp" | ||
|
|
||
| namespace mamba | ||
| { | ||
| class Context; | ||
| class PrefixData; | ||
|
|
||
| /** Options for converting prefix data to YAML export contents */ | ||
| struct PrefixToYamlOptions | ||
| { | ||
| bool no_builds = false; | ||
| bool ignore_channels = false; | ||
| bool include_md5 = false; | ||
| }; | ||
|
|
||
| namespace detail | ||
| { | ||
| // yaml_file_contents is now defined here instead of install.hpp | ||
| struct yaml_file_contents | ||
| { | ||
| std::string name; | ||
| std::string prefix; | ||
| std::vector<std::string> dependencies, channels; | ||
| std::map<std::string, std::string> variables; | ||
| std::vector<other_pkg_mgr_spec> others_pkg_mgrs_specs; | ||
| }; | ||
| } | ||
|
|
||
| // Convert PrefixData to yaml_file_contents | ||
| detail::yaml_file_contents prefix_to_yaml_contents( | ||
| const PrefixData& prefix_data, | ||
| const Context& ctx, | ||
| const std::string& env_name = "", | ||
| const PrefixToYamlOptions& options = {} | ||
| ); | ||
|
|
||
| // Write yaml_file_contents to output stream | ||
| void yaml_contents_to_stream(const detail::yaml_file_contents& contents, std::ostream& out); | ||
|
|
||
| // Write yaml_file_contents to YAML file | ||
| void | ||
| yaml_contents_to_file(const detail::yaml_file_contents& contents, const fs::u8path& yaml_file_path); | ||
|
|
||
| // Read YAML file to yaml_file_contents | ||
| detail::yaml_file_contents file_to_yaml_contents( | ||
| const Context& ctx, | ||
| const std::string& yaml_file, | ||
| const std::string& platform, | ||
| bool use_uv = false | ||
| ); | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) 2026, QuantStack and Mamba Contributors | ||
| // | ||
| // Distributed under the terms of the BSD 3-Clause License. | ||
| // | ||
| // The full license is in the file LICENSE, distributed with this software. | ||
|
|
||
| #ifndef MAMBA_API_EXPORT_HPP | ||
| #define MAMBA_API_EXPORT_HPP | ||
|
|
||
| #include "mamba/api/configuration.hpp" | ||
|
|
||
| namespace mamba | ||
| { | ||
| class Configuration; | ||
|
|
||
| void export_environment(Configuration& config); | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are changes made to this file API breakages?