Metadata-Version: 2.4
Name: qc_grader
Version: 2026.6.29
Summary: Grading client for the IBM Quantum Challenge
Project-URL: Homepage, https://quantum.cloud.ibm.com/
Author: IBM Quantum Community Team
License: Apache-2.0
License-File: LICENSE.txt
Keywords: challenge,grader,qiskit,quantum
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: ibm-platform-services
Requires-Dist: moocore
Requires-Dist: networkx
Requires-Dist: qiskit-ibm-runtime>=0.47.0
Requires-Dist: qiskit<3.0,>=2.3.0
Requires-Dist: requests
Requires-Dist: samplomatic
Requires-Dist: typeguard
Description-Content-Type: text/markdown

# Quantum Challenge Grader

Grading client for the IBM Quantum Challenge grading service.


### Run locally

Pre-requisites:

- [IBM Quantum account](https://quantum.cloud.ibm.com/)
- [Python](https://www.python.org/) (3.10 or later) environment with
    - Classic [Jupyter Notebook](https://jupyter.readthedocs.io/en/latest/install/notebook-classic.html) interface or [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html)

To install the grader locally:

1. In the Python environment, install the grading client: `pip install qc-grader`
1. Configure the `QC_API_KEY` environment variables

    From a terminal (before launching your JupyterLab environment), enter

    ```
    export QC_API_KEY=your_ibmcloud_api_key
    ```

    where `your_ibmcloud_api_key` is your IBM Cloud API Key found in your **[Account page](https://cloud.ibm.com/iam/apikeys)**.

    Alternatively, if you prefer you can instead run the following at the top cell of a notebook cell (whenever you start/restart the kernel)

    ```
    %set_env QC_API_KEY=your_ibmcloud_api_key
    ```


    > 
    > **Note1**: you can check if the environment variable has been set by running the following in a notebook cell:
    > 
    > ```python
    > import os
    > print(os.getenv('QC_API_KEY'))
    > ```
    > 
    > **Note2**: If you already installed [qiskit-ibm-runtime](https://github.com/Qiskit/qiskit-ibm-runtime) and saved your token by using `QiskitRuntimeService` by following [this instruction](https://quantum.cloud.ibm.com/docs/en/guides/cloud-setup#set-up-to-use-ibm-cloud) once, you don't need to set-up the env variable. You can save your token by using `QiskitRuntimeService` like below:
    >
    > ``` python
    > from qiskit_ibm_runtime import QiskitRuntimeService
    > QiskitRuntimeService.save_account(
    >     channel="ibm_quantum",
    >     token="<YOUR_TOKEN>",
    >     set_as_default=True,
    >     overwrite=True,
    > )
    > ```
    > 

## Usage

1. Open an exercise notebook

    - In IBM Quantum Lab, the notebooks can be found in the `
quantum-challenge` folder in the **Lab files** panel
    - For local install, download the notebooks (from IBM Quantum Lab or specific challenge repo) and import into local Jupyter environment

1. Run the notebook cells, answering the exercises and submitting solution for grading. For example

    ```python
    from qc_grader.challenges.challenge_2021 import grade_lab1_ex1 

    grade_lab1_ex1(qc_1)
    ```
    
    
    ```python
    from qc_grader.challenges.challenge_2021 import grade_lab1_ex2 

    grade_lab1_ex2(qc_2)
    ```
