{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Initialize Q# with a project root. This will look for a `qsharp.json` at the specified directory and compile the Q# sources included by the manifest."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1e8e4faa",
   "metadata": {},
   "outputs": [],
   "source": [
    "from qdk import qsharp\n",
    "\n",
    "qsharp.init(project_root='./test_project')\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a107432",
   "metadata": {},
   "source": [
    "Now we can reference the compiled sources."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9df62352",
   "metadata": {
    "vscode": {
     "languageId": "qsharp"
    }
   },
   "outputs": [],
   "source": [
    "%%qsharp\n",
    "\n",
    "Sample.Main()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5fad86c4",
   "metadata": {},
   "source": [
    "The callables from the project are also available under `qdk.code` and can be called or imported from Python."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "423b6fc4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from qdk import code\n",
    "Main = code.Sample.Main\n",
    "res = Main()\n",
    "print(f\"Got return value from Q# code: {res}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.14.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
