Shared Dev Based IDE Setup
You may find it easier to work with the SDK in a modern IDE with code completion, highlighting, and other useful features. Our preferred editor at Q2 is VSCode. It does everything you would expect from a powerful IDE alongside sophisticated remote debugging support. For a best-in-class editor that allows a quick start with minimal custom setup, VSCode is the right choice.
Prefer Eclipse, Vim, etc.? No problem, but we won’t be able to provide as much assistance. We’ve provided guides for VSCode and PyCharm setup below.
Important
As a Caliper SDK member, we recommend adding your public SSH key to GitLab
and running clone_from_gitlab
on the shared dev machine if you have not already.
Visual Studio Code
This section is for SDK clients using a Q2-provided stack.
First, ensure you have already connected to the shared dev box with ssh using your method of choice (ssh on *nix. For Windows, refer to Windows SSH Installation)
Into a terminal of your choice, enter
ssh sdk-shared-dev.q2devstack.com -l <username>
. Your username is your email address, and the password is the same as what you use to log in to q2developer.com.You should see any additional setup items listed for you when you log into shared dev, along with other helpful information.
Download VSCode - https://code.visualstudio.com/download
Once VSCode is downloaded and opened, we need to connect it the remote server. For this we need the Remote Development Extension Pack
Open the VSCode Extension marketplace (Preferences -> extensions or CTRL+SHIFT+X)
Search for the Remote - SSH Extension and Install it
(optional) Add SSH key authentication to the shared dev server - See https://code.visualstudio.com/docs/remote/troubleshooting#_configuring-key-based-authentication
Select the SSH tab on the left and configure a new target by hitting the ‘+’ icon. Enter the ssh command from the first step and select your desired config file. You should see your newly configured host on the SSH tab
Note
This step may ask what kind of server you are connecting to. The Shared Development Server is a Linux box.
Connect to the ssh host. Open the command palette (F1/CMD+SHIFT+P), enter
Remote-SSH: Connect to Host...
, and select the new host. Once connected you should see the following in the bottom left of your windowOpen up the extension marketplace again. Search for “Q2 SDK Extension Pack” and click on “Install on SSH”. Then reload the window.
Go back to the first tab(Explorer tab) and click the
Open Folder
button. Open/home/<username>/sdk
Run
Preferences: Open Remote Settings (JSON) (SSH: sdk-shared-dev.q2devstack.com)
from the Command Palette (F1). Your remote machinesettings.json
should look like the json blob below. If not, copy this into yoursettings.json
file:{ "python.defaultInterpreterPath": ".env/bin/python", "ruff.args": ["--extend-select=B006"], "terminal.integrated.defaultProfile.linux": "bash" }
Enter
generate_vscode_files
into a terminal in your ssh session. This should create a.vscode
directory in your/home/<username>/sdk
directory. Please verify that the contents of the 3 files in the.vscode
directory match the following:settings.json:
{ "files.exclude": { "**/__pycache__": true, "**/.antilles": true, "**/.env": true }, "mssql.connections": [ { "server": <db_host>, "port": <db_port>, "database": "Q2DB_sdk_<stack_name>", "authenticationType": "SqlLogin", "user": <db_user>, "password": <db_password>, "emptyPasswordInput": false, "savePassword": true, "profileName": "<stack_name>" } ], "python.defaultInterpreterPath": ".env/bin/python", "ruff.lint.args": ["--extend-select=B006"] }
launch.json:
{ "version": "0.2.0", "configurations": [ { "name": "q2 run", "type": "python", "request": "launch", "program": "/usr/local/bin/q2", "args": [ "run" ], "console": "integratedTerminal" } ] }
extensions.json:
{ "recommendations": [ "q2.vscode-sdk-pack" ] }
Your Visual Studio code is now setup to do development and debugging!
PyCharm
Warning
The remote configuration is only an option in the professional version of PyCharm, and is currently unavailable in community edition. The trial version is what you want if you do not already have a license. Please consider using VSCode with its remote development capabilities, described above.
On your local workstation, create a new directory you want use as your Q2SDK PyCharm project.
Open your PyCharm project
Add your SSH Configuration
Pycharm Preferences/Settings -> Tools -> SSH Configurations
Host:
sdk-shared-dev.q2devstack.com
Username: provided in Welcome email
Password: same as developer portal
Configure your Project Interpreter for the Remote Python environment.
A Remote Python Interpreter will allow PyCharm to read and execute code on the shared dev box from your workstation.
Pycharm Preferences/Settings -> Project -> Project Interpreter
Add Interpreter by clicking on the settings cog:
Add SSH Interpreter from your existing SSH Configuration
Edit the Interpreter path and Sync folders as follows:
Interpreter:
/home/<username>/sdk/.env/bin/python
Sync folders: Set Remote path to
/
click Finish
Your Project Interpreter should appear similar to this:
Configure your Remote Host
By adding your remote interpreter, you should now see your remote host option
Click on the Remote Host tab (Tools -> Deployment -> Browse Remote Host)
Edit Remote Host Settings
Set the root
sdk
directory for the remote host, and use your existing SSH ConfigurationExclude
.env
and.antilles
directories from Deployment Path
Configure your Database Connection
Click on the Database tab and add your Microsoft SQL Server Data Source
Configure Database Port and User
Use SSH tunnel by selecting your existing SSH Configuration
Select your database and all schemas
Set up Remote Debugging
Add your remote debugger, SDK Debug
Working with PyCharm
New remote files will need to be downloaded:
Local file changes should be automatically uploaded to the remote host:
You should now be ready. Here’s two pieces to get you started:
Tools -> Deployment -> Browse Remote Host will show you files on the server. You can download and edit them locally by right clicking on them
Tools -> Start SSH Session -> <Your Deployment Name> will let you access the remote server from the command line. Handy for running commands in the Tutorial!