Your First Project

To work with the State Tool you need to create an ActiveState Platform project.

You can create and configure your project in two ways:

  1. Using the Command Line
  2. Using the Website

Creating a Project Using the Command Line

To create your account using the State Tool:

  1. Create a new project using the state init command:

    state init <org>/<project_name> <language>[@version]
    

    See the state init reference documentation for usage information.

    Follow the instructions on screen.

  2. Once completed switch to the directory where the project was initialized and run state push.

    For example:

    cd ActiveCo/python-web-dev
    state push
    

    Running state push will take the local project you created with state init to create it on the ActiveState Platform. This is required to be able to do almost anything with your project.

Adding Platforms

By default only the platform you run the state init command on is added.

Let’s say you initialize the project on Linux, but you only want macOS and Windows, you can remove Linux and add the latest platforms for macOS and Windows 10:

state platforms remove Linux 
state platforms add Darwin
state platforms add Windows

See the state platforms reference documentation for usage information.

Installing / Importing Packages

Configure packages for your project. You can either add packages individually, or all at once using a requirements.txt file (Python) or cpanfile or META.json file (Perl).

To add an individual package:

state install pandas@1.0.0

See the state install reference documentation for usage information.

To add packages using a requirements.txt file:

state import requirements.txt 

See the state import reference documentation for usage information.

TIP: You can search for specific packages on the Platform using the state search subcommand. For example: state search pandas lists the versions of pandas that are available.

See the state search reference documentation for usage information.

Activating Your Project

Activate your project using the activate command: state activate <owner>/<projectName>

See the state activate reference documentation for usage information.

Running the activate command will create a new project folder under the current working directory containing an activestate.yaml file with the essential configuration for your project. The State Tool will “activate” under this new project directory. This means that you have access to a completely isolated virtual environment with the language and packages you have selected in your project.

Deactivating

When you are finished working with your project, you can deactivate the runtime environment for your project by entering exit or pressing Ctrl+D to return to your regular shell environment.

Reactivating

When you want to work on your project again you can run the same state activate owner/projectName command from any directory and you’ll be switched into an activated state under your project directory. Alternatively you can manually move to the root of your project directory and run state activate without any other arguments.

What’s Next

Now that you have your project set up and the basics configured check out the following sections to further discover what you can do with the State Tool: