A Very Gentle Introduction

An Introduction to the Introduction

This gentle introduction is made for people with absolutely no coding experience who are likely feeling very lost right now. To tell if this guide is right for you, if you know what the command pip install XXXXX does, then feel free to skip this section. If not, welcome! We'll cover the background knowledge you'll need for the general getting started guide.

Learn the Very Basics of Python Syntax

MechWolf is written in Python, a high level programming language that is the lingua franca of scientific computation and that was specifically designed for humans to read. This one language can do anything from machine learning to web server development and now robotic chemistry. In order to get started with MechWolf, it can help to learn a few elements of Python syntax so that you'll have enough understanding to get tinkering.

Don't panic.

If you just want to call up and run someone else’s MechWolf procedure, you can get away with knowing almost no Python. You don't need to know every nook and cranny of Python, just the most basic aspects of the language. In fact, all of the Python that you'll need to understand the underlying code is able to fit on a two-page cheatsheet. (It might be a good idea to print it out and have it handy as you get started with Python.) If you are inspired to start writing your own automated procedures, MechWolf's tutorials provide lots of examples to follow and use as the basis of your code, so you won't be starting from scratch.

If you're looking for a quick guide to learn basic syntax with biologically inspired examples (rather than contrived computer science-y ones), take a look at the eight-page Python for Biologists guide. You can pick up the basics of Python in less than a day.

Should you be interested in learning more about Python than just the very basics (and we certainly hope you are), here are a few good resources:

Install Python 3.7 or greater

Although Python is likely already installed on your computer (especially if you're using Mac or Linux), you probably don't have a recent enough version of Python to support MechWolf. Python is available from the download page at Python.org. For a detailed guide, see The Hitchhiker's Guide to Python section on installing Python 3.

Important

Be sure to download Python 3.7! MechWolf is written in Python 3.7, which is not backwards compatible.

Learn the Command Line

In order to effectively use your computer to code, you'll want to understand how to use the command line, at least to a cursory level. Go over common commands to at least get an idea of how to navigate the filesystem (cd, ls, and pwd). This will be invaluable going forward.

Create a virtualenv (optional)

virtualenv is a tool that allows you to create isolated environments on your computer. For example, imagine that one piece of code required having version 1.0 of MechWolf but another required version 2.0. The solution is to run each piece of code inside a virtual environment to keep their dependencies separate. You don't have to do this step, but it's highly recommended to prevent bad, unpredictable things from happening that can be hard to debug. The Hitchhiker's Guide to Python's section on virtualenv is well worth the read for getting a feel for virtualenv.

To install virtualenv use the following command in your terminal:

$ pip3 install virtualenv

Then in the directory you want to use, create a virtualenv named mechwolf-env:

$ virtualenv -p python3.7 mechwolf-env

And then activate the environment with:

$ source mechwolf-env/bin/activate

You can leave the virtualenv at any time with the command:

(mechwolf-env) $ deactivate