Transferring your VSCode profile to Civis Studio
VSCode uses profiles to manage your user settings. This includes your extensions and any specific settings you’ve configured such as your theme or keyboard shortcuts. In order to get set up in Civis Studio it can be helpful to automatically transfer these details to your Civis Studio set up. To do so you’ll want to export your profile from your local VSCode configuration and then import it in Civis Studio. The steps are outlined below.
Step 1: Export your local profile
Open VSCode and navigate to “Profiles” by clicking the gear in the bottom left corner of the screen and then selecting the “Profiles” option.
In the profiles panel select the three dots next to your default profile, or another profile if you would prefer to use a different one. From there click the “Export…” option.
At the top of the screen you will be prompted to enter a name for your profile and then when you press ‘Enter’ you will be asked how you would like to export the profile, select “GitHub gist”.
A pop up window will confirm your export and ask if you’d like to copy the link, press Copy Link.
Step 2: Import your profile in Civis Studio
Open Civis Studio and navigate to profiles, again by selecting the gear icon and then “Profiles”
Once the profile tab opens select the drop down next to “New Profile” and then click “Import profile…”
You will be prompted to enter a url to import the profile from, here you will paste the url you copied during step 1.
After importing the profile the screen will provide some configuration options. You can rename your profile and select which settings you would like to use from the profile. Once you’re happy with them you’ll just want to hit "Create”
To activate the new profile you’ll need to click the check mark next to its name in the menu on the left hand side. You’ll be prompted to reload your screen, click okay to continue to and then the page should refresh with your new profile in place.
Transferring Python environments
If you currently use an environment of some form to manage packages locally you can transfer the entire environment to Civis Studio to enable easy development. The instructions below cover conda environments and venv environments but other package management systems may have similar transfer options.
Transferring Conda Environments
Step 1: Export your local conda environment
In your local VSCode open a terminal window, activate your environment and type:
conda env export --from-histroy > {environment}.yml
Replace {environment} with the name you would like to give the yaml file.
Once you have the yaml file you have two options for transferring it to Civis Studio:
- Commit the new yaml file to the git repository you will use in Civis Studio
- Open the file locally and copy the file’s contents manually and then paste them into a new {environment}.yml file in Civis Studio.
Step 2: Build the new environment in Civis Studio
If you have not yet used conda in Civis Studio you will need to install it first. You can install conda using linux command line arguments the same way you would elsewhere. The following code gives an example of how to do this for miniconda. Note that the url for the miniconda sh file may change over time but you can reference their documentation to find up to date urls.
mkdir -p ~/miniconda3
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
e
conda initOnce Conda is installed and you have your new yaml file available in Civis Studio, either via git version control or thanks to copying the file over manually, you can activate the new environment. To do so run:
conda env create -f {environment}.ymlTransferring a venv to Civis Studio
If you use virtual environments locally you can transfer those to Civis Studio as well.
Step 1: Export your environment
Start by activating the environment you wish to export. Once it’s activated you can export it by using the command:
pip freeze > requirements.txtThis will create a new text file containing all of the requirements for the environment.
You will then need to copy this file over to Civis Studio by doing one of the following:
- Commit the new yaml file to the git repository you will use in Civis Studio
- Open the file locally and copy the file’s contents manually and then paste them into a new {environment}.yml file in Civis Studio.
Step 2: Activate the environment in Civis Studio
In Civis Studio you will want to start by creating a new empty virtual env and then installing the requirements by using the following commands:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Comments
0 comments
Please sign in to leave a comment.