About the State Tool activated environment

The State Tool creates an “activated” environment, which allows you to work in an isolated environment with the exact language runtime version and set of packages you need for your coding project. As you install the State Tool, authenticate with the ActiveState Platform, and state activate your project, configuration and executable files are installed on your computer to create the “activated” environment. State Tool related files are stored in three areas on your computer:

  • State Tool application: The state executable and global application configuration files are installed in the standard locations for application files and configuration for your operating system. The exact locations are described in the Installation section.
  • Project configuration: A file named activestate.yaml stores the ActiveState project configuration information. It should be located in the root folder of you coding project, for example, the root of the folder where your Git repository is stored locally.
  • Project runtime: The language runtime files for each “activated” environment are stored as an isolated set of files in a cache folder. This folder is separate from your coding project folder. The cache folder is managed by the State Tool and you should never modify any of the files in this folder directly.

Installation

When you install the State Tool, you can accept the default location which will install the state executable in a folder on your PATH, or you can choose a custom location and the State Tool will prompt you add the directory to your PATH or you can add the directory to your PATH manually.

Windows

C:\USERS\<USERNAME>\APPDATA\ROAMING\ACTIVESTATE
├───bin
│       state.exe        # The State Tool binary install location  
│
└───cli-unstable
        config.yaml
        log.txt
        update-check

Linux

.
├── .local
    └── bin
       └── state           # The State Tool binary in the default install location  
                           # on Red Hat Enterprise Linux (RHEL 8).

macOS

On macOS the State Tool is installed as /usr/local/bin/state by default.

Authorization

When you authenticate with the ActiveState Platform for the first time, your configuration including a private key used to authenticate with the Platform in the future is stored in the State Tool configuration directory.

state auth

Windows

C:\USERS\<USERNAME>\APPDATA\ROAMING\ACTIVESTATE
├───bin
│       state.exe        # The State Tool binary install location  
│
└───cli-unstable         # Configuration files and logs for the State Tool.
        config.yaml
        log.txt
        private.key
        update-check

Linux

.
├── .cache
│   └── activestate           # Directory where virtual environments are created when you state activate a project.
├── .config
│   └── activestate           # Configuration files and logs for the State Tool.
│       └── cli-unstable
│           ├── config.yaml
│           ├── log.txt
│           ├── private.key
│           └── update-check
├── .local
    └── bin
        └── state

macOS

On macOS the configuration information is stored in ~/Library/Application\ Support/activestate/.

.
|── cli-unstable
    ├── config.yaml
    ├── log.txt
    └── update-check

Activation

When you activate a project the runtime environment is downloaded and installed on your computer. It is isolated from any other installations of the language in a cache folder. The activestate.yaml file in the root your working directory, specified using the --path flag in the following examples, stores the reference to the ActiveState Platform runtime environment stored in the cache folder.

Windows

Example activation command on Windows:

state activate ActiveState/ActivePython-3.6 --path C:\Users\<username>\github\web-project-1

This directory structure is created when you activate a project on Windows.

C:\USERS\<username>\APPDATA\LOCAL\ACTIVESTATE
└── 21cb67aa            # The ActiveState/ActivePython-3.6 virtual environment.
    ├── DLLs            # This includes the python3 interpreter, supporting files
    ├── doc             # and packages specified in the ActiveState Platform project
    ├── include         # at https://platform.activestate.com/ActiveState/ActivePython-3.6
    ├── Lib
    ├── libs
    ├── licenses
    ├── scripts
    ├── support
    ├── tcl
    └── tools
    python3.exe         # The Python 3 interpreter executable and other executable files (pylint, py.test, etc.) 
                        # are stored in the root folder

On Windows the cached runtimes are stored in C:\Users\<username>\AppData\Local\ActiveState.

The activestate.yaml file is created in the root of C:\Users\<username>\github\web-project-1, which is the directory where the source code for the project will be located.

Linux

Example activation command on Linux:

state activate ActiveState/ActivePython-3.6 --path /home/<username>/github/web-project-1

This directory structure is created when you activate a project on Linux.

.
├── .cache
│   └── activestate
│       └── bff70e45            # The ActiveState/ActivePython-3.6 virtual environment.
│           ├── bin             # This includes the python3 interpreter, supporting files
│           ├── doc             # and packages specified in the ActiveState Platform project
│           ├── include         # at https://platform.activestate.com/ActiveState/ActivePython-3.6
│           ├── lib
│           ├── licenses
│           ├── share
│           └── support
├── .config
│   └── activestate
│       └── cli-unstable
│           ├── config.yaml
│           ├── hail-update
│           ├── log.txt
│           ├── private.key      # A private key is created the first time you use
│           └── update-check     # the `state auth` command to authenticate with the ActiveState Platform.
├── github
│   └── web-project-1            # The location the ActiveState/ActivePython-3.6 project is checked out to.
│       └── activestate.yaml     # Stores the reference to the ActiveState Platform project and project configuration.
├── .local
    └── bin
        └── state

The activestate.yaml file is created in the root of /User/<username>/github/web-project-1, which is the directory where the source code for the project will be located.

macOS

Example activation command on macOS:

state activate ActiveState/ActivePython-3.6 --path /Users/<username>/github/web-project-1

This directory structure is created when you activate a project on macOS.

./activestate/
└── 92e5ea64
    ├── Library
    │   └── Frameworks
    │       └── Python.framework

On macOS the cached runtimes are stored in /Users/<username>/Library/Caches/activestate/.

The activestate.yaml file is created in the root of /Users/<username>/github/web-project-1, which is the directory where the source code for the project will be located.