|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "d5cd329c", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# 🧪 Kernel Selection Test\n", |
| 9 | + "\n", |
| 10 | + "This notebook tests that only the APIM Samples Python 3.12 kernel is visible in the kernel picker.\n", |
| 11 | + "\n", |
| 12 | + "**Expected behavior:**\n", |
| 13 | + "- Only one kernel should be visible in the kernel picker (top right)\n", |
| 14 | + "- It should be automatically selected when opening this notebook\n", |
| 15 | + "- The kernel should be named \"APIM Samples Python 3.12\"" |
| 16 | + ] |
| 17 | + }, |
| 18 | + { |
| 19 | + "cell_type": "code", |
| 20 | + "execution_count": null, |
| 21 | + "id": "18f4e3d6", |
| 22 | + "metadata": {}, |
| 23 | + "outputs": [], |
| 24 | + "source": [ |
| 25 | + "# Test that we're using the correct Python environment\n", |
| 26 | + "import sys\n", |
| 27 | + "import os\n", |
| 28 | + "\n", |
| 29 | + "print(\"🔍 Current Python Environment:\")\n", |
| 30 | + "print(f\" Python executable: {sys.executable}\")\n", |
| 31 | + "print(f\" Python version: {sys.version}\")\n", |
| 32 | + "print(f\" Virtual environment: {os.environ.get('VIRTUAL_ENV', 'Not detected')}\")\n", |
| 33 | + "\n", |
| 34 | + "# Check if we're in the expected venv\n", |
| 35 | + "if '/workspaces/Apim-Samples/.venv' in sys.executable:\n", |
| 36 | + " print(\"\\n✅ SUCCESS: Using the correct APIM Samples virtual environment!\")\n", |
| 37 | + "else:\n", |
| 38 | + " print(\"\\n❌ WARNING: Not using the expected virtual environment\")\n", |
| 39 | + " print(\" Expected path to contain: /workspaces/Apim-Samples/.venv\")" |
| 40 | + ] |
| 41 | + }, |
| 42 | + { |
| 43 | + "cell_type": "code", |
| 44 | + "execution_count": null, |
| 45 | + "id": "3ce03af2", |
| 46 | + "metadata": {}, |
| 47 | + "outputs": [], |
| 48 | + "source": [ |
| 49 | + "# Test that required packages are available\n", |
| 50 | + "packages_to_test = [\n", |
| 51 | + " 'requests',\n", |
| 52 | + " 'pandas', \n", |
| 53 | + " 'matplotlib',\n", |
| 54 | + " 'jwt',\n", |
| 55 | + " 'azure.identity',\n", |
| 56 | + " 'azure.storage.blob'\n", |
| 57 | + "]\n", |
| 58 | + "\n", |
| 59 | + "print(\"📦 Testing package imports:\")\n", |
| 60 | + "failed_imports = []\n", |
| 61 | + "\n", |
| 62 | + "for package in packages_to_test:\n", |
| 63 | + " try:\n", |
| 64 | + " __import__(package)\n", |
| 65 | + " print(f\" ✅ {package}\")\n", |
| 66 | + " except ImportError as e:\n", |
| 67 | + " print(f\" ❌ {package} - {e}\")\n", |
| 68 | + " failed_imports.append(package)\n", |
| 69 | + "\n", |
| 70 | + "if not failed_imports:\n", |
| 71 | + " print(\"\\n🎉 All packages imported successfully!\")\n", |
| 72 | + "else:\n", |
| 73 | + " print(f\"\\n⚠️ Failed to import: {', '.join(failed_imports)}\")" |
| 74 | + ] |
| 75 | + }, |
| 76 | + { |
| 77 | + "cell_type": "code", |
| 78 | + "execution_count": null, |
| 79 | + "id": "fee964fc", |
| 80 | + "metadata": {}, |
| 81 | + "outputs": [], |
| 82 | + "source": [ |
| 83 | + "# Quick visualization test\n", |
| 84 | + "import matplotlib.pyplot as plt\n", |
| 85 | + "import numpy as np\n", |
| 86 | + "\n", |
| 87 | + "# Create a simple test plot\n", |
| 88 | + "x = np.linspace(0, 2*np.pi, 100)\n", |
| 89 | + "y = np.sin(x)\n", |
| 90 | + "\n", |
| 91 | + "plt.figure(figsize=(8, 4))\n", |
| 92 | + "plt.plot(x, y, 'b-', linewidth=2, label='sin(x)')\n", |
| 93 | + "plt.title('🔧 Kernel Test - Matplotlib Visualization')\n", |
| 94 | + "plt.xlabel('x')\n", |
| 95 | + "plt.ylabel('sin(x)')\n", |
| 96 | + "plt.grid(True, alpha=0.3)\n", |
| 97 | + "plt.legend()\n", |
| 98 | + "plt.tight_layout()\n", |
| 99 | + "plt.show()\n", |
| 100 | + "\n", |
| 101 | + "print(\"✅ If you can see the plot above, your Jupyter environment is working correctly!\")" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "markdown", |
| 106 | + "id": "5690412a", |
| 107 | + "metadata": {}, |
| 108 | + "source": [ |
| 109 | + "## 📋 Manual Verification Checklist\n", |
| 110 | + "\n", |
| 111 | + "Please verify the following:\n", |
| 112 | + "\n", |
| 113 | + "1. **Kernel Picker**: Click on the kernel selector in the top right of this notebook\n", |
| 114 | + " - [ ] Only one kernel should be visible: \"APIM Samples Python 3.12\"\n", |
| 115 | + " - [ ] No system Python, conda, or other kernels should appear\n", |
| 116 | + "\n", |
| 117 | + "2. **Automatic Selection**: \n", |
| 118 | + " - [ ] This kernel was automatically selected when opening the notebook\n", |
| 119 | + " - [ ] No manual kernel selection was required\n", |
| 120 | + "\n", |
| 121 | + "3. **Environment Verification**:\n", |
| 122 | + " - [ ] Python executable path contains `/workspaces/Apim-Samples/.venv`\n", |
| 123 | + " - [ ] All packages imported successfully\n", |
| 124 | + " - [ ] Matplotlib plot displays correctly\n", |
| 125 | + "\n", |
| 126 | + "If all checkboxes can be ticked ✅, then the kernel filtering is working perfectly!" |
| 127 | + ] |
| 128 | + } |
| 129 | + ], |
| 130 | + "metadata": { |
| 131 | + "language_info": { |
| 132 | + "name": "python" |
| 133 | + } |
| 134 | + }, |
| 135 | + "nbformat": 4, |
| 136 | + "nbformat_minor": 5 |
| 137 | +} |
0 commit comments