Skip to content

Commit 335693f

Browse files
author
Leah Wasser
committed
merge
2 parents a82aa11 + 1d30d62 commit 335693f

5 files changed

Lines changed: 62 additions & 52 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#
1+
.mypy_cache/
22
.DS_Store
3-
3.6
43
.nbgrader.log
4+
3.6

Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ MAINTAINER Leah Wasser <leah.wasser@colorado.edu>
44

55
COPY environment.yml environment.yml
66

7-
RUN conda env update -n root -f environment.yml
8-
9-
RUN conda info --envs
10-
11-
RUN conda list
7+
RUN conda env update -n root -f environment.yml \
8+
&& conda info --envs \
9+
&& conda list \
10+
&& rm environment.yml
1211

12+
# Test imports
1313
RUN python -c "import rasterio"
1414
RUN python -c "import earthpy"
15-
16-
RUN rm environment.yml

README.md

Lines changed: 27 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![](https://images.microbadger.com/badges/image/earthlab/earth-analytics-python-env.svg)](https://microbadger.com/images/earthlab/earth-analytics-python-env "EA-Environment Docker Stats")
88
![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/earthlab/earth-analytics-python-env?style=plastic)
99

10-
Welcome to the Earth Analytics Environment Repository! Here you will find a conda envt that can be installed on your computer using a `.yaml` file. You will also find a docker image that can be used to actually run the environment in a containerized environment.
10+
Welcome to the Earth Analytics `Python` Environment Repository! Here you will find a conda environment that can be installed on your computer using a `.yaml` file. You will also find a docker image that can be used to actually run the environment in a containerized environment.
1111

1212

1313
## Contributors:
@@ -23,27 +23,40 @@ Welcome to the Earth Analytics Environment Repository! Here you will find a cond
2323

2424
### 1. Install the Earth Lab Conda Environment on your Local Computer.
2525

26-
To begin, install git and conda for Python 3.x (we suggest 3.6).
26+
To begin, install `git` and `conda` for Python 3.x (we suggest 3.6).
2727

2828
Installing git: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
2929

30-
Installing conda: https://www.anaconda.com/
31-
32-
We recommend installing geo-related dependencies with `conda-forge`. We
33-
have created a custom yaml list with all of the dependencies that you will
34-
need to run the lessons in this course. Follow
35-
these steps below to get your environment ready.
30+
Installing miniconda: https://docs.conda.io/en/latest/miniconda.html
3631

3732
About Conda Environments: https://conda.io/docs/user-guide/tasks/manage-environments.html
3833

39-
An environment for conda has been created specifically for this course. To load it, run:
34+
### Tutorial On Setup
35+
If you want a more detailed tutorial on setting up this environment using miniconda,
36+
please visit our learning portal: https://www.earthdatascience.org/workshops/setup-earth-analytics-python/
37+
38+
We recommend installing everything using the with `conda-forge` channel.
39+
40+
### Quick Start: Setup Your Environment
41+
42+
The tutorial above will provide you with more detailed setup instructions.
43+
But here are the cliff notes:
44+
45+
To begin, install the environment using:
4046

4147
`conda env create -f environment.yml`
4248

43-
* Note that it takes a bit of time to run this setup
44-
* Also note that for the code above to work, you need to be in the directory where the `environment.yml` file lives (ex: cd earth-analytics-python-env).
49+
This will take a bit of time to run.
50+
51+
* Also note that for the code above to work, you need to be in the directory where the `environment.yml` file lives so CD to that directory first
52+
53+
`$ cd earth-analytics-python-env`
54+
55+
56+
### Update Your EA Environment from the YAML File
57+
58+
You can update your environment at any time using:
4559

46-
To update this environment from a yaml file use:
4760
`conda env update -f environment.yml`
4861

4962
To manage your conda environments, use the following commands:
@@ -58,20 +71,6 @@ To manage your conda environments, use the following commands:
5871
conda activate earth-analytics-python
5972
```
6073

61-
[Conda versions prior to 4.6:](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)
62-
63-
On Mac or Linux:
64-
65-
```
66-
source activate earth-analytics-python
67-
```
68-
69-
On Windows:
70-
71-
```
72-
activate earth-analytics-python
73-
```
74-
7574
The environment name is `earth-analytics-python` as
7675
defined in the `environment.yml` file.
7776

@@ -111,19 +110,6 @@ into your browser to run jupyter with the earth analytics environment installed!
111110
If you wish to update the earth analytics environment, do the following.
112111

113112
1. make a **PR** with changes to master
114-
2. **think** about your changes - don't do silly things or break things :)
115-
3. **merge** the PR into the master branch
116-
4. Check & wait till [Dockerhub](https://hub.docker.com/r/earthlab/earth-analytics-python-env/tags/) has built the image for the merging of the **PR** you can see builds in progress, [here](https://hub.docker.com/r/earthlab/earth-analytics-python-env/builds/)
117-
5. Finally, once the build is complete you can then you can update hub-ops repo with the newly tagged image.
118-
119-
## Important Notes
120-
If the update the `earthpy` package, you must specify the commit number that you
121-
wish to build `earthpy` against. This will ensure that the docker image
122-
automagically rebuilds using the latest version of `earthpy`
123-
124-
like this: `- git+https://github.com/earthlab/earthpy.git@283683affac9e46b1690c7913ebd2621c82ba43a`
125-
126-
This PR should kick off a rebuild of the docker image. But that docker image will
127-
not be usable until it's built off of the master branch.
113+
1. An code admin will **merge** the PR into the master branch
114+
1. Check & wait till [Dockerhub](https://hub.docker.com/r/earthlab/earth-analytics-python-env/tags/) has built the image for the merging of the **PR** you can see builds in progress, [here](https://hub.docker.com/r/earthlab/earth-analytics-python-env/builds/)
128115

129-
NOTE 2: The DockerHub build actually takes forever and ever. So it's best to check out the build status rather than assuming it's built.

hooks/build

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,17 @@
22

33
SHA=`git rev-parse --short HEAD`
44

5-
docker build -t earthlab/earth-analytics-python-env:$SHA .
5+
6+
# Get current branch
7+
current_branch="$(git name-rev --name-only HEAD)"
8+
echo $current_branch
9+
10+
if [ "$current_branch" == "master" ]
11+
then
12+
# Create a tag for that commit number to use for tracking but also update latest
13+
docker build -t earthlab/earth-analytics-python-env:$SHA .
14+
docker build -t earthlab/earth-analytics-python-env:latest .
15+
else
16+
# Create a tag for that particular branch
17+
docker build -t earthlab/earth-analytics-python-env:$current_branch .
18+
fi

hooks/push

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,17 @@
22

33
SHA=`git rev-parse --short HEAD`
44

5-
docker push earthlab/earth-analytics-python-env:$SHA
5+
# Get current branch
6+
current_branch="$(git name-rev --name-only HEAD)"
7+
echo $current_branch
8+
9+
if [ "$current_branch" == "master" ]
10+
then
11+
# Create a tag for that commit number to use for tracking but also update latest
12+
docker push earthlab/earth-analytics-python-env:$SHA
13+
docker push earthlab/earth-analytics-python-env:latest
14+
else
15+
# Push a tagged build for that particular branch only
16+
# This will reduce the number of commit based tags in our environment
17+
docker push earthlab/earth-analytics-python-env:$current_branch
18+
fi

0 commit comments

Comments
 (0)