Skip to content

Commit

Permalink
Split environment file (#79)
Browse files Browse the repository at this point in the history
* Remove pre-commit hook

* Remove packages not available on Windows

* Make environment update file

* Update name of Anaconda distribution

* Update environment install and update instructions
  • Loading branch information
mdpiper committed Jul 27, 2022
1 parent 984762c commit fadbf53
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 24 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions environment.unix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# An update to the `ivy` environment that includes packages not available
# on Windows. The `ivy` environment must exist.
#
# See https://stackoverflow.com/a/43873901/1563298
#
# Usage:
# $ conda env update --name ivy --file environment.unix.yaml --prune

channels:
- conda-forge
dependencies:
- pymt_cem
- pymt_sedflux
13 changes: 7 additions & 6 deletions environment.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# A conda environment for CSDMS Ivy lessons.
# A conda environment file for the CSDMS Ivy lessons.
#
# This file is used to create the `ivy` environment on Linux, macOS, and
# Windows. See "environment.unix.yaml" for additional packages that aren't
# available on Windows.
#
# Usage:
# $ conda env create --file=environment.yaml
# $ source activate ivy
# $ conda env create --file environment.yaml
# $ conda activate ivy

name: ivy
channels:
Expand All @@ -24,9 +28,6 @@ dependencies:
- terrainbento
- pymt_child
- pymt_hydrotrend
- pymt_sedflux # [unix]
- bmi-topography
- imageio
- tqdm
- jupytext
- pre-commit
36 changes: 24 additions & 12 deletions lessons/conda/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@

# Anaconda and conda

One attribute of Python that makes it a great language for science
One feature of Python that makes it a great language for science
is its abundance of packages (numpy! scipy! pandas! xarray! pymt!).
Package management can be difficult, though,
especially when a typical Python installation contains dozens of packages.

This is where the `conda` *package manager* is handy,
and a primary reason why CSDMS uses (and we recommend)
the Anaconda Python distribution
(now called [Anaconda Individual Edition](https://www.anaconda.com/products/individual)).
the [Anaconda Distribution](https://www.anaconda.com/products/distribution).

With `conda`, you can:

* list
* install
* list
* update
* remove

Expand Down Expand Up @@ -45,11 +44,15 @@ change to this directory and view the file **environment.yaml** with `cat`:
```
$ cd ~/Desktop/ivy-main
$ cat environment.yaml
# A conda environment for CSDMS Ivy lessons.
# A conda environment file for the CSDMS Ivy lessons.
#
# This file is used to create the `ivy` environment on Linux, macOS, and
# Windows. See "environment.unix.yaml" for additional packages that aren't
# available on Windows.
#
# Usage:
# $ conda env create --file=environment.yaml
# $ source activate ivy
# $ conda env create --file environment.yaml
# $ conda activate ivy
name: ivy
channels:
Expand All @@ -65,25 +68,25 @@ dependencies:
- pytest
- coverage
- bmipy
- pymt >=1.1
- landlab >=2.0
# - bmi-example-python
- pymt >=1.3
- landlab >=2.5
- terrainbento
- pymt_child
- pymt_hydrotrend
- pymt_sedflux
- bmi-topography
- imageio
- tqdm
```

The environment file lists all the packages needed to run the course material.
The environment file lists the packages needed to run the course material.
If a package has a dependency not explicitly listed
(e.g., `pymt` is built on `xarray`),
`conda` finds a compatible package version for you.

To create the environment, type:
```
$ conda env create --file=environment.yaml
$ conda env create --file environment.yaml
```

Once the environment has been created, type
Expand All @@ -94,6 +97,15 @@ to make this environment current.
(Note on Linux and macOS,
you may have to use `source` instead of `conda` to activate the environment.)

Some packages used in Ivy aren't built for Windows.
These packages have been listed in a second environment file,
**environment.unix.yaml**.
To update the `ivy` environment on Linux or macOS
with these packages, type:
```
$ conda env update --name ivy --file environment.unix.yaml --prune
```

Later,
when finished using the environment, type
```
Expand Down

0 comments on commit fadbf53

Please sign in to comment.