# Installation

DNAstack products can be accessed programmatically through the Command Line Interface (CLI) for Windows, Mac, and Linux environments.

This guide will help you install `dnastack-client-library`. If you need to install a specific version, please check out the list of available versions on the [release history page](https://pypi.org/project/dnastack-client-library/#history).

## Installing Python

First, you need to have:

* Python 3.11 or newer
* Optional: pip 21.3 or newer. This is only required for ARM-based systems e.g., ARM-based MacOS machines..

### MacOs

Newer versions of MaxOS are already bundled with Python3. To determine if you have the correct version of python installed open a terminal and type `python --version`. If it is already installed you will see the version printed to the console

```shell
$ python --version
```

### Linux - Debian

If you are using a debian system (ie Ubuntu) the easiest way to install python is using the bundled `apt` package manager.

```shell
sudo apt update
sudo apt install -y python3 python3-pip
```

You can validate this has run properly in a terminal after:

```shell
python --version
```

### Linux - CentOS, RHEL

If you are using a CentOs the easiest way to install python is using the bundled `yum` package manager.

```shell
sudo yum update
sudo yum install -y python3 python3-pip
```

You can validate this has run properly in a terminal after:

```shell
$ python --version
```

### Windows 10/11

1. Download the installer from [anaconda.com](https://www.anaconda.com/products/distribution).
2. Run the installer to install Python 3

## Installing the CLI/library package

### Windows 10/11

Open the Anaconda Powershell Prompt from the start menu or Anaconda Navigator and type the following

```shell
pip3 install -U dnastack-client-library
omics version
```

### MacOS / Linux

Open a terminal window and type the following:

```shell
pip3 install -U dnastack-client-library
omics version
```

## Enabling Shell Completion (Optional)

You can enable command auto-completion for the `omics` CLI to make it easier to use. The steps vary depending on your shell:

### Bash

Add this to your `~/.bashrc`:

```shell
eval "$(_OMICS_COMPLETE=bash_source omics)"
```

### Zsh

Add this to your `~/.zshrc`:

```shell
eval "$(_OMICS_COMPLETE=zsh_source omics)"
```

### Fish

Add this to your `~/.config/fish/completions/omics.fish`:

```shell
eval (env _OMICS_COMPLETE=fish_source omics)
```

After adding the appropriate line, either restart your shell or run:

```shell
source ~/.bashrc  # for bash
source ~/.zshrc   # for zsh
source ~/.config/fish/completions/omics.fish  # for fish
```

Now you can use tab completion with the `omics` command to auto-complete subcommands and options.

## Installing from Source

First download the source code from the public Git Repository

```
git clone https://github.com/DNAstack/dnastack-client.git

```

Once the git repository is downloaded, you can build it with pip. Building the package will download all of the required dependencies and make the `omics` and `dnastack` commands available from the command line

```
cd dnastack-client
pip3 install -IU .
```
