build details

# Developer Basics: Duckietown Shell

Modified 2020-05-26 by Andrea F. Daniele

Andrea F. Daniele

Maintainer: Andrea F. Daniele

This section of the book will introduce the Duckietown Shell (`dts` in short) and the reason behind its creation. In this book, we will use dts commands quite often, make sure you don’t miss this section.

## Brief History

Modified 2020-05-26 by Andrea F. Daniele

The Duckietown Shell is indeed a shell. It was created in July 2018 to help Duckietown users launch Duckietown demos on a Duckiebot. It became clear pretty soon that having a dedicated shell for Duckietown was a game changer for the whole community. In fact, since the very beginning, the shell had a built-in system for auto-update, which allowed developers to develop new commands or improve old ones and deploy the changes in no time.

Duckietown has a history of using `Makefiles` as a way to simplify complex and operations involving many (usually very long) bash commands. Other developers, instead, preferred bash scripts over Makefiles. And finally, our CI system (based on Jenkins), used `Jenkinsfiles` to define automated jobs.

The Duckietown Shell came to the rescue and unified everything, while Makefiles, bash scripts and Jenkinsfiles slowly started disappearing from our repositories. Today, Docker images to run on Duckiebots, Python libraries published on PyPi and even the book you are reading right now are built through dts.

## Get Started

Modified 2020-05-26 by Andrea F. Daniele

The Duckietown Shell is released as a Python3 package through the PyPi package store. You can install the Duckietown Shell on your computer by running,

``````laptop $pip3 install duckietown-shell `````` This will install the `dts` command. The Duckietown Shell is distribution independent, so the first time you launch it you have to specify the distribution of Duckietown software you are working on. You can do so by running the command, ``````laptop$ dts --set-version DISTRO
``````

where `DISTRO` can be any of the official distributions of Duckietown software, e.g., `master19`, `daffy`. This will download the commands for the given distribution before the command prompt is shown.

Use the command,

``````laptop $(Cmd) commands `````` to list all the commands available to the chosen distribution. You don’t really need to run the shell before you can type in your command, for example, you can achieve the same result as above by running, ``````laptop$ dts commands
``````

The nice thing about opening the shell before typing your command is that then you can use the Tab key to auto-complete.

## Installable commands

Modified 2020-05-26 by Andrea F. Daniele

Some commands come not pre-installed. These are usually commands that are either very specific to an application, thus not useful to the majority of Duckietown users, or commands that can only be used during a short time window, like commands that let you participate to competitions periodically organized at international AI and Robotics conferences, e.g. AIDO.

## Hands on

Modified 2020-05-26 by Andrea F. Daniele

Install the Duckietown Shell as instructed in Section 5.2 - Get Started. Make sure everything works as expected by running the command `dts update` successfully.

## Ask the community

Modified 2020-05-26 by Andrea F. Daniele

If you have any questions about the Duckietown Shell, join the Slack channel #help-dt-shell.