How Do I Get Started with GitHub Codespaces?

To start using GitHub Codespaces with Leap, you must create a GitHub account, which you can get for free, and set up Codespaces to work with Leap.

Note: This article describes starting with a D-Wave example in GitHub, which already has the Ocean SDK installed; to start with a new GitHub repository, you must configure your codespace to use Ocean-Dev Docker Images.

Setting Up Codespaces to Work with Leap

When you create or open an existing repository, you must authorize the Ocean SDK to access your Leap account and then fetch your solver API token.

Open an Existing Repository in Codespaces

  1. From the main page of a GitHub repository, select the green Code button.
  2. Under the Codespaces tab, select the plus sign to open a new Codespace.
    Note: If you already have a Codespace with the current repository, you can
    reopen, close, or delete that existing Codespace.

The repository opens in a new tab.

Authorize the Ocean SDK Access to Your Leap Account

To run the code, you need to authorize the Ocean SDK access to your Leap account. Specifically, the Ocean SDK needs to access your Solver API token.

  1. In a terminal, type dwave auth login --oob (as shown below) and press Enter:

    dave_auth_login_oob.png

    A window displays and asks if you want Code to open the external website with a URL that begins with https://cloud.dwavesys.com/leap.

    dwave_auth_login_oob_open_leap_dialog.png
  2. Click Open.
    If you are not currently logged into Leap, a new tab opens and displays the Leap login page. 
  3. Enter your account credentials and log in.
  4. Click Authorize on the Leap Request for Permission tab, which asks for permission to access your Leap Solver API token.
  5. In the Authorization Code field, an authorization code is displayed. Click the Copy icon that is displayed above the authorization code.
  6. Return to the terminal in Codespaces, paste the authorization code into the terminal at the prompt, and press Enter.
    dwave_auth_login_oob_auth_prompt.png
    A confirmation message displays, as shown below.
    dwave_auth_login_oob_auth_confirm1.png

Fetching Your Leap Solver API Token

Now that the Ocean SDK is allowed to access your Leap Solver API (SAPI) token, you can direct it to fetch that token. This is the final step which then allows you to access the D-Wave solvers.

  1. In the terminal, type dwave config create --auto-token and press Enter.
  2. A message displays stating that a SAPI token was fetched from your Leap project and a configuration was saved.
    dwave_auth_login_oob_auth_confirm.png
    You can now run the Python code and access the D-Wave solvers.

For more detailed information, see Leap Support for IDEs.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.