Skip to content

Commit

Permalink
Upgrade environment and devcontainer (#284)
Browse files Browse the repository at this point in the history
* Update devcontainer definition.

* Switch to using mambaforge for Docker container base image.

* Update environment.yml to use Python=3.9

* Add instructions for VSCode Development Containers.

* Released version of NetworkX.

* Update docs with Windows/Linux commands.
  • Loading branch information
ericmjl authored Apr 22, 2022
1 parent d36ba56 commit a128a2e
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------

FROM continuumio/miniconda3
FROM condaforge/mambaforge

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -31,7 +31,6 @@ RUN apt-get update \
&& /opt/conda/bin/pip install pylint \
#
# Update Python environment based on environment.yml (if present)
&& /opt/conda/bin/conda install -c conda-forge mamba -y \
&& if [ -f "/tmp/conda-tmp/environment.yml" ]; then /opt/conda/bin/mamba env update -n base -f /tmp/conda-tmp/environment.yml; fi \
&& rm -rf /tmp/conda-tmp \
#
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"extensions": [
"ms-python.vscode-pylance",
"ms-python.python"
]
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created - for example installing git.
// "postCreateCommand": "apt-get update && apt-get install -y git",
"postCreateCommand": "python -m pip install -e .",
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-in-docker.
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nams # Network Analysis Made Simple
channels:
- conda-forge
dependencies:
- python=3.8
- python=3.9
- black
- ffmpeg
- gitpython # used by mkdocs
Expand All @@ -19,7 +19,7 @@ dependencies:
- nbconvert-utils>=0.6
- nbconvert>=6.0.7
- nbstripout>=0.3.9
- networkx=2.6.3
- networkx>=2.6.3
- numpy
- nxviz
- pandas>=1.0
Expand Down
37 changes: 36 additions & 1 deletion notebooks/00-preface/01-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,45 @@ which contains data loaders and solutions.
python setup.py develop
```

## VSCode Development Containers

Assuming that you're using Visual Studio Code
and have attempted to use development containers before,
you can run the Network Analysis Made Simple tutorial content
inside a development container.
After Binder, this is the second easiest way to get set up.
You need to have Docker installed on your computer
but don't worry -- you won't have to execute any Docker commands :).

### Install the Remote Containers extension

This is found in the Extensions marketplace.

![Remote Containers extension.](https://user-images.githubusercontent.com/2631566/164070556-7ca675bc-d700-4e1b-a8e4-f07bc77c79f8.png)

### Clone the repository to your local drive

```bash
git clone https://github.com/ericmjl/Network-Analysis-Made-Simple.git
```

### Open the repository in VSCode

Use `Cmd+Shift+P` (on macOS) or `Ctrl+Shift+P` (on Linux/Windows)
to open the command palette, and search for "Rebuild and Reopen in Container" as below:

![Search for "Rebuild and Reopen in Container"](https://user-images.githubusercontent.com/2631566/164071398-ff115bd0-02fc-4827-935a-2785a354360f.png)

Hit enter and wait for the container to build automagically. This may take around 10 minutes or so, depending on your system.

![Development container will be built.](https://user-images.githubusercontent.com/2631566/164071594-d3ddf3fa-9c78-48f3-be56-09a453f8eb0a.png)

## `conda` environments

We also recommend the use of `conda` environments!
If you are feeling confident enough to set up a conda environment at the terminal,
Use this if you're not already using one of the options above.
If you are feeling confident enough to set up
a conda environment at the terminal,
then follow along.
(We'll be assuming you've already cloned the repository locally.)

Expand Down

0 comments on commit a128a2e

Please sign in to comment.