From a8ad8e378c51857103a85b2270712fb6f0803574 Mon Sep 17 00:00:00 2001 From: Toby Hodges Date: Fri, 29 Aug 2025 11:38:45 +0200 Subject: [PATCH 1/3] scaffold new episode --- episodes/99-env.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 episodes/99-env.md diff --git a/episodes/99-env.md b/episodes/99-env.md new file mode 100644 index 000000000..3256df056 --- /dev/null +++ b/episodes/99-env.md @@ -0,0 +1,27 @@ +--- +title: Managing your Project Environment +--- + +:::::::::::::::::::::::::::::: questions + +FIXME + +:::::::::::::::::::::::::::::::::::::::: + +::::::::::::::::::::::::::::: objectives + +* Identify some advantages of creating an environment for their scripts to run in. +* Create a new environment. +* Install Python libraries into an environment. +* Activate and deactivate an environment. + +:::::::::::::::::::::::::::::::::::::::: + + + + +:::::::::::::::::::::::::::::: keypoints + +FIXME + +:::::::::::::::::::::::::::::::::::::::: \ No newline at end of file From d6f3aafb84c515db53a4f935728d6c7c21973608 Mon Sep 17 00:00:00 2001 From: Toby Hodges Date: Fri, 29 Aug 2025 12:07:55 +0200 Subject: [PATCH 2/3] draft exercise for first objective --- episodes/99-env.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/episodes/99-env.md b/episodes/99-env.md index 3256df056..49d205648 100644 --- a/episodes/99-env.md +++ b/episodes/99-env.md @@ -17,7 +17,31 @@ FIXME :::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::: challenge +### Benefits of an Isolated Environment +Consider the following scenarios. +In which circumstances would it be appropriate to create a new environment to work in? +In which would it be better to continue working in the existing environment? + +1. You have completed an analysis of the current inflammation data and receive a new dataset that you want to process and analyse in the same way. +1. You want to expand your analysis to compare these two datasets in a different way that requires a new library to be installed. +1. You need to begin a new project, which you expect to use the same libraries you already have installed in your first project environment. +1. You need to begin a new project, which will use a completely different set of libraries to those you are currently working with. + +::::::::::::::::::::: solution + +#### Solution + +1. Use the same environment. This is exactly the kind of reproducible analysis that an encapsulated environment is perfect for. +1. As this new analysis is an extension of the same project, you should use the same environment and install the new dependency there. +1. Even though you expect to use the same libraries as you currently have installed in the existing environment, it is good practice to create a new environment anyway. + As a project develops we often find that we need to install a new dependency and when this happens, the environment you need for the new project will diverge from what is needed in the previous one. +1. Create a new environment and install the dependencies there. + +:::::::::::::::::::::::::::::: + +:::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::: keypoints From f0438876b4fd1e875a44ceb604273638f1f6d37a Mon Sep 17 00:00:00 2001 From: Toby Hodges Date: Fri, 29 Aug 2025 14:00:57 +0200 Subject: [PATCH 3/3] draft exercise to practice env creation, activation, management, deactivation --- episodes/99-env.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/episodes/99-env.md b/episodes/99-env.md index 49d205648..8e7a9f636 100644 --- a/episodes/99-env.md +++ b/episodes/99-env.md @@ -41,6 +41,34 @@ In which would it be better to continue working in the existing environment? :::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::: + +:::::::::::::::::::::::::::::::::::::::: challenge + +### Creating and Managing Environments +You want to begin a new project to keep track of the side effects from Dr. Maverick's new medication. + +1. Create an environment for this project, called `side-effects`. +1. Activate the new environment. +1. Install the following dependencies for the project: + * `numpy` + * `matplotlib` + * `skimage`, a popular library for image processing +1. Deactivate the environment. +1. Finally, activate the `carpentries` environment for the workshop again. + +::::::::::::::::::::: solution + +1. `conda create --name=side-effects` +1. `conda activate side-effects` +1. `conda install numpy matplotlib skimage` +1. `conda deactivate side-effects` +1. `conda activate carpentries` + +:::::::::::::::::::::::::::::: + + + ::::::::::::::::::::::::::::::::::::::::::::::::::