Development Environment - Principles of Programming Languages - CSCI 3155 - Fall 2024

\(\newcommand{\TirName}[1]{\text{#1}} \newcommand{\inferrule}[3][]{ \let\and\qquad \begin{array}{@{}l@{}} \TirName{#1} \\ \displaystyle \frac{#2}{#3} \end{array} } \newcommand{\infer}[3][]{\inferrule[#1]{#2}{#3}} \)

As part of this class, we work with two main software tools:

coding.csel.io

For registered students, the above software is already available in a cloud-compute environment at coding.csel.io JupyterLab and coding.csel.io CodeServer, respectively. The instructions are very simple: go to the website, sign-in using IdentityKey, and select the environment for our course CSCI 3155.

However,

  • Coding.csel.io can sometimes go down or become overloaded — and typically this happens on Friday evenings! It is a shared resource for all computer science students used by many classes.
  • You should never keep your important files on a cloud-compute. Always download them to your machine in order to keep a local copy for submission.
  • A backup option to coding.csel.io is highly recommended.

Local Installation

The current version of project has been tested with the following:

  • Scala 2.13.x (currently, 2.13.14 released May 1, 2024).
  • Java 11. You may use Temurin, OpenJDK, or Oracle. Java 8 will also work, but newer versions of Java may not.

You may follow the installation instructions from the above links or use your platform’s package manager (e.g., Homebrew on macOS).

Although the instructions are rather long, there is a reward for doing all of this. You will get to have your files on your laptop, you can work offline when you do not have internet connectivity, and you can backup your work when you backup your laptop.

Windows users may be using different shells/terminals such as WSL, Git Bash, etc. You should be consistent in installing and using the same sub-system or terminal. These instructions will generally work for macOS, Linux and Windows, but installation procedures are slightly different for each machine.

Note that we cannot possibly have experience on every environment, but we will help as best we can. Getting help from the class-at-large on the class Piazza will also be invaluable. We assume you have administrator/superuser privileges on your machine. If not, please consider other options.

Step 1: Install Java JDK 11

First, make sure you have the Java JDK 11 installed. Or, Java 8 (1.8) will also work, but newer versions of Java may not. To check, open a terminal and type:

java -version

Make sure you have version 11 or 1.8. If you don’t have it installed, download from the link above or use your platform’s package manager.

It is possible to have multiple versions of Java on your system and manage them for different courses (e.g., CSCI 4448), or for different projects. The jEnv tool is popular for Mac. In Windows, it is recommended to set Java 11 or 8 as the default Java using JAVA_HOME, you can refer to the article here for more information.

Step 2: Install Scala 2.13

Follow the instructions for your platform from the link above. It is recommended to follow instructions there to install Coursier and let Coursier manage your Scala versions.

Step 3: Install Jupyter

There are many ways to do this. I personally use pip and prefer to use it on command line, but I am told that Anaconda works equally well.

jupyter notebook

You can also install and use jupyter lab.

Step 4: Install Almond

Scala is supported in Jupyter by a kernel called Almond.

Note: It is important to ensure that the kernel be for Scala 2.13. Double check the Almond Installation document, but the following should work on macOS:

coursier launch --use-bootstrap almond --scala 2.13 -- --install

And the following is the equivalent on Windows:

bitsadmin /transfer downloadCoursierCli https://git.io/coursier-cli "%cd%\coursier"
bitsadmin /transfer downloadCoursierBat https://git.io/coursier-bat "%cd%\coursier.bat"
.\coursier launch --use-bootstrap almond --scala 2.13 -- --install

Step 5: Install VS Code with Metals

You can install Metals through the Marketplace or from the Extensions tab within VS Code.

Note that Metals may complain if it cannot find Java 11. It may prompt you to install Java 11; accepting this will download and install it for Metals specifically (and not outside of VS Code).

You are welcome to use any development environment, but we may not be able answer questions in your particular environment. Another commonly used development environment for Scala is IntelliJ IDEA.

Contributed Platform-Specific Instructions

macOS using Homebrew

Last Updated: 2024-09-01

Install Homebrew.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Temurin Java 11.

brew install temurin@11

Install jEnv.

brew install jenv
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(jenv init -)"' >> ~/.zshrc
. ~/.zshrc
jenv add /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/
jenv global 11
java -version

Install Coursier.

brew install coursier/formulas/coursier
cs setup

Install Jupyter.

pip install jupyter

Install Almond.

coursier launch --use-bootstrap almond --scala 2.13 -- --install

Install VS Code.

brew install visual-studio-code