State activate vs state checkout

Hello,
What’s the difference between the state tool
state checkout
state activate?
Previously I used state activate but the current documentation appears to emphasize state checkout.
Thanks.

Hi wilb, thanks for your question. We are recommending users stop using state activate and start using state checkout, and the reason comes down to user control. Previously, state activate would pull down your project to your working directory, install it somewhere on your system (users had no control over where), and open a secure shell in your command prompt. There wasn’t a lot of opportunity for user customization, and because of that many found it somewhat limiting.

With state checkout, you can get your project anywhere on your system in several different ways. After checking out your project(s), you can either open a secure shell for your project using the state shell command (which will close when you end your session or type exit into the command prompt. Useful when working with multiple projects), or set the project as your system default with the state use command.

state activate can still be used, but we encourage users to explore new and better ways to get the most from their project. I hope that answers your question, if there is anything else we can help with please let us know.

2 Likes

Hi andrewd-activestate,
Thanks for your reply. Does state clean cache still apply for reset of an uncertain workspace?
Regards,
Wil Blake

@wilb Only partially. You also have to remove and recreate the yaml control file that describes where the project has been placed. A “state clean cache” and a manually removal of the project control folder can be followed by a fresh checkout, but make sure you read and understand the command options and flags for checkout. The defaults will work exactly like “activate” did, and won’t change anything even if you do the cleanup.

2 Likes

Hi andrewd-activestate,
Do state checkout, state use, state clean cache work under PowerShell?
Thanks,
Wil Blake

Hi @wilb – you should be able to run any command under either PowerShell or cmd on windows. As long as it’s available in your environment, it should still run.

Additional note re: your original question, if you want to enter into a shell inside the environment that you checked out, you can use the new state shell command which will put you into a shell inside that environment. activate is essentially the same as running checkout and shell back to back. It works quite similar to venv for Python.

Let us know if you run into any issues!

Thank you! For the first time a Perl script worked for me under Windows and that’s most beneficial because my employer does not support remote use of Linux.

1 Like