State Tool CLI

The State Tool is the CLI client that interfaces with the ActiveState Platform. It can be used to install and manage ActiveState runtimes as well as act as a package manager to install packages from our trusted artifacts package repository.

Setting up with the State Tool

Getting started with your project

Other information


Install the State Tool

Open a command prompt and run the following command:

sh <(curl -q https://platform.activestate.com/dl/cli/install.sh)

Open a command prompt and run the following command:

powershell -Command "& $([scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://platform.activestate.com/dl/cli/install.ps1')))"

Once installed it is recommended that you close your command prompt and start a new one to ensure your environment is properly updated. While our install process uses PowerShell under the hood the State Tool does not yet officially support PowerShell, though its been known to work for various PowerShell use cases.

Uninstalling the State Tool

Make sure you shut down all running instances of the State Tool and then run

state clean uninstall

If you run into any issues uninstalling, you can also follow the manual instructions.

Sign in to the ActiveState Platform

If you don’t have a Platform account yet, you need to sign up:

state auth signup 

Enter the requested information at the prompt to register your account. You will receive an email to verify your account. You have limited permissions to the Platform before you verify it. After registering your account you can sign in.

If you already have an ActiveState Platform account, or you just created an account you need to sign in by running

state auth

Enter your username and password for the Platform at the prompts.

Create a new project locally

You can create a new ActiveState project directly from your command line by running

state init <username_or_org_name>/<project_name> language@version

For example:

state init jsmith/python-3.6 python3@3.6.6

You will need to run

state push

before your new project will be available on the Platform. This command will synchronize your local project with the Platform and can be run at any time during development. To pull in changes made to your project via the Platform use

state pull

Installing a Runtime

To install a runtime directly from the command line you will need to know the project’s name and parent organization. The following are three methods of installing a runtime by using state activate , state checkout, and the Platform web UI.

If you are working with a private project, make sure you authenticate with the State Tool before installing.

1. State activate

The State Tool is designed to help you manage multiple Platform runtimes on the same machine. You can switch between runtimes by activating them, which starts up a virtual environment for that runtime.

A virtual environment creates an isolated shell that gives you access to the language & packages in your runtime, but does not affect your system as a whole. To activate your project, run

state activate <username_or_org_name>/<project_name>

2. State checkout

To checkout a project to a location on your local machine run

state checkout <username_or_org_name>/<project_name> location

For example state checkout jsmith/python-3.6 C:\PythonProject

This will create a project folder at the specified location containing the activestate.yaml file for the project. After checking the project out you can use the runtime by running

state use <username_or_org_name>/<project_name>

3. Using the installer command from the Web UI

For all projects on the the Platform Web UI, you’ll notice command line instructions like the ones below. Run them in your command line terminal to install the corresponding runtime.

To find a project, first go to your organization from platform.activesate.com/organizations, then click on the desired project name. Click the Install button to display the instructions.

Sample install project command

Switch between projects

To find details on your current project enter

state show

For a list of projects currently available on your local machine enter

state projects 

After finding the desired project on the list shown you can switch to a new project by running

state use <username_or_org_name>/<project_name>

You can verify that the new runtime is active by running state show again and noting the differences.

Add required packages for your project

All packages installed with the State Tool or Platform Web UI come from our own package ecosystem. They have been ingested from various public package repositories and are built from source. If you can’t find a package you are looking for let us know.

state packages add requests@2.21.0
state packages add pandas

For Python projects, if you have a requirements.txt file, you can alternatively import all your packages using the file.

state packages import --file requirements.txt

For Perl projects, if you have a cpanfile or META.json file, you can import all your packages using the file.

state packages import --file cpanfile
state packages import --file META.json

Access documentation for CLI commands

To learn more about the State Tool commands, run state --help in the terminal.

For help on individual commands, run state COMMAND --help. For example, state packages --help. For more information on the State Tool and the available commands see the State Tool section of the docs.

Additional Resources

Get help on the command line

  • To learn more about the State Tool commands, run state --help in the terminal.
  • For help on individual commands, run state COMMAND --help. For example, state install --help.