Created
May 23, 2023 01:27
-
-
Save emileten/272d9843d662f7a798f595727cae1009 to your computer and use it in GitHub Desktop.
show-yaml
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import yaml\n", | |
"\n", | |
"def show_yaml(input_file): \n", | |
" with open(input_file, 'r') as file:\n", | |
" yaml_content = yaml.load(file, yaml.Loader)\n", | |
"\n", | |
" yaml_output = yaml.dump(yaml_content, sort_keys=False)\n", | |
" print(yaml_output)" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Env2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"name: env2\n", | |
"channels:\n", | |
"- conda-forge\n", | |
"dependencies:\n", | |
"- python=3.9\n", | |
"- xarray=2023.3.0\n", | |
"- pip=23.0.1\n", | |
"- pip:\n", | |
" - stackstac==0.4.3\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"show_yaml('docs/source/system_reference_guide/example_conda_configuration_files/env2.yml')" | |
] | |
}, | |
{ | |
"attachments": {}, | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Env2" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 19, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"name: env2\n", | |
"channels:\n", | |
"- conda-forge\n", | |
"dependencies:\n", | |
"- python=3.9\n", | |
"- xarray=2023.3.0\n", | |
"- pip=23.0.1\n", | |
"- pip:\n", | |
" - stackstac==0.4.3\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"show_yaml('docs/source/system_reference_guide/example_conda_configuration_files/env2.yml')" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.10.9" | |
}, | |
"orig_nbformat": 4 | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment