|
22 | 22 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23 | 23 | # SOFTWARE.
|
24 | 24 |
|
| 25 | +import json |
25 | 26 | import logging
|
26 | 27 | import re
|
27 | 28 | from collections import defaultdict
|
28 | 29 | from itertools import chain
|
29 | 30 | from typing import Any, Optional
|
30 | 31 |
|
31 |
| -import yaml |
32 | 32 | from docker.models.containers import Container
|
33 | 33 | from tabulate import tabulate
|
34 | 34 |
|
@@ -61,7 +61,7 @@ def start_container(container: TrackedContainer) -> Container:
|
61 | 61 | @staticmethod
|
62 | 62 | def _conda_export_command(from_history: bool) -> list[str]:
|
63 | 63 | """Return the mamba export command with or without history"""
|
64 |
| - cmd = ["mamba", "env", "export", "--no-build"] |
| 64 | + cmd = ["mamba", "env", "export", "--no-build", "--json"] |
65 | 65 | if from_history:
|
66 | 66 | cmd.append("--from-history")
|
67 | 67 | return cmd
|
@@ -96,7 +96,7 @@ def _execute_command(self, command: list[str]) -> str:
|
96 | 96 | @staticmethod
|
97 | 97 | def _parse_package_versions(env_export: str) -> dict[str, set[str]]:
|
98 | 98 | """Extract packages and versions from the lines returned by the list of specifications"""
|
99 |
| - dependencies = yaml.safe_load(env_export).get("dependencies") |
| 99 | + dependencies = json.loads(env_export).get("dependencies") |
100 | 100 | # Filtering packages installed through pip
|
101 | 101 | # since we only manage packages installed through mamba here
|
102 | 102 | # They are represented by a dict with a key 'pip'
|
|
0 commit comments