diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 060647d..01b9fa7 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -200,7 +200,7 @@ python -m ipykernel install --user --name=python-venv --display-name='Python (.v source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && -python setup/setup_python_path.py --generate-env && +python setup/local_setup.py --generate-env && az config set core.login_experience_v2=off && az extension add --name containerapp --only-show-errors && az extension add --name front-door --only-show-errors @@ -342,7 +342,7 @@ python -m ipykernel install --user --name=python-venv --display-name="Python (.v **Symptom**: Import errors or path issues **Solution**: Regenerate the `.env` file: ```bash -python setup/setup_python_path.py --generate-env +python setup/local_setup.py --generate-env ``` ### Debug Commands diff --git a/.devcontainer/python312/devcontainer.json b/.devcontainer/python312/devcontainer.json index a1a094b..7b2aad4 100644 --- a/.devcontainer/python312/devcontainer.json +++ b/.devcontainer/python312/devcontainer.json @@ -63,7 +63,7 @@ "updateContentCommand": [ "bash", "-c", - "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/setup_python_path.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" + "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/local_setup.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" ], "postStartCommand": [ "bash", diff --git a/.devcontainer/python313/devcontainer.json b/.devcontainer/python313/devcontainer.json index 9d727ab..2fe8861 100644 --- a/.devcontainer/python313/devcontainer.json +++ b/.devcontainer/python313/devcontainer.json @@ -63,7 +63,7 @@ "updateContentCommand": [ "bash", "-c", - "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/setup_python_path.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" + "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/local_setup.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" ], "postStartCommand": [ "bash", diff --git a/.devcontainer/python314/devcontainer.json b/.devcontainer/python314/devcontainer.json index 2fdaa5e..b4d6681 100644 --- a/.devcontainer/python314/devcontainer.json +++ b/.devcontainer/python314/devcontainer.json @@ -63,7 +63,7 @@ "updateContentCommand": [ "bash", "-c", - "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/setup_python_path.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" + "echo 'šŸ“¦ Installing/updating Python packages from requirements.txt...' && source /workspaces/Apim-Samples/.venv/bin/activate && pip install -r requirements.txt && pip install pytest pytest-cov coverage && echo 'āœ… Python packages installed/updated' && python setup/local_setup.py --generate-env && echo 'āœ… Environment configuration updated' && echo 'āš™ļø Configuring Azure CLI...' && az config set core.login_experience_v2=off 2>/dev/null || true && az extension add --name containerapp --only-show-errors 2>/dev/null || true && az extension add --name front-door --only-show-errors 2>/dev/null || true && echo 'āœ… Azure CLI configured for Codespaces'" ], "postStartCommand": [ "bash", diff --git a/.dockerignore b/.dockerignore index b3d738e..5b112e7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -32,5 +32,5 @@ # Keep essential files for the build !requirements.txt -!setup/setup_python_path.py +!setup/local_setup.py !shared/python/** diff --git a/.vscode/settings.json b/.vscode/settings.json index b3a4bd6..97c405d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,32 +1,12 @@ { - "jupyter.defaultKernel": "apim-samples", - "jupyter.kernels.changeKernelIdForNotebookEnabled": false, - "jupyter.preferredKernelIdForNotebook": { - "*.ipynb": "apim-samples" - }, - "jupyter.kernels.trusted": [ - "./.venv/Scripts/python.exe" - ], - "jupyter.kernels.excludePythonEnvironments": [ - "apim-samples" - ], - "search.exclude": { - "**/.venv": true, - "**/.venv/**": true - }, - "files.watcherExclude": { - "**/.venv/**": true - }, - "files.exclude": { - "**/.venv": true - }, "python.analysis.exclude": [ + "**/.*", + "**/.venv", + "**/venv", + "**/env", "**/node_modules", "**/__pycache__", - ".git", - "**/build", - "env/**", - "**/.venv/**" + "env/**" ], "files.trimTrailingWhitespace": true, "files.insertFinalNewline": true, @@ -34,7 +14,6 @@ "files.eol": "\n", "editor.renderWhitespace": "trailing", "python.defaultInterpreterPath": "./.venv/Scripts/python.exe", - "python.pythonPath": "./.venv/Scripts/python.exe", "python.envFile": "${workspaceFolder}/.env", "[python]": { "editor.codeActionsOnSave": { @@ -43,8 +22,7 @@ }, "editor.formatOnSave": true }, - "notebook.defaultLanguage": "python", - "notebook.kernelPickerType": "mru", + "terminal.integrated.defaultProfile.windows": "PowerShell", "plantuml.render": "Local", "plantuml.exportFormat": "svg", @@ -53,7 +31,5 @@ "plantuml.exportOutDir": "assets/diagrams/out", "python.terminal.activateEnvironment": true, "python.terminal.activateEnvInCurrentTerminal": true, - "python.testing.pytestEnabled": true, - "python.linting.enabled": true, - "python.linting.pylintEnabled": true -} \ No newline at end of file + "python.testing.pytestEnabled": true +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ed9cbfc..52b8fdf 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ "type": "shell", "command": "${config:python.pythonPath}", "args": [ - "setup/setup_python_path.py", + "setup/local_setup.py", "--generate-env" ], "group": "build", diff --git a/README.md b/README.md index 8ce7be0..c34502b 100644 --- a/README.md +++ b/README.md @@ -97,12 +97,76 @@ This menu-driven interface provides quick access to: Example output from option 2 (Verify local setup): ``` šŸ” APIM Samples Local Environment Verification +================================================== + +šŸ“‹ Virtual Environment +---------------------- āœ… Virtual environment is active -āœ… All required packages installed -āœ… Shared modules can be imported -āœ… .env file configured -āš ļø Jupyter kernel not found -āœ… VS Code settings configured + +šŸ“‹ Required Packages +-------------------- +āœ… requests is installed +āœ… ipykernel is installed +āœ… jupyter is installed +āœ… python-dotenv is installed + +šŸ“‹ Shared Modules +----------------- +āœ… All shared modules can be imported + +šŸ“‹ Environment File +------------------- +āœ… .env file is configured correctly + +šŸ“‹ Azure CLI +------------ +āœ… Azure CLI is installed (azure-cli 2.81.0) + +šŸ“‹ Azure Bicep CLI +------------------ +āœ… Azure Bicep CLI is installed (az bicep version: Bicep CLI version 0.39.26 (1e90b06e40)) + +šŸ“‹ Azure Providers +------------------ + Registered providers: + - Microsoft.ApiManagement + - Microsoft.App + - Microsoft.Authorization + - Microsoft.CognitiveServices + - Microsoft.ContainerRegistry + - Microsoft.KeyVault + - Microsoft.Maps + - Microsoft.ManagedIdentity + - Microsoft.Network + - Microsoft.OperationalInsights + - Microsoft.Resources + - Microsoft.Storage +āœ… All required Azure providers are registered + +šŸ“‹ Jupyter Kernel +----------------- +āœ… APIM Samples Jupyter kernel is registered + +šŸ“‹ VS Code Settings +------------------- +āœ… VS Code settings are configured correctly + +šŸ“‹ Summary +---------- +āœ… Virtual Environment : PASS +āœ… Required Packages : PASS +āœ… Shared Modules : PASS +āœ… Environment File : PASS +āœ… Azure CLI : PASS +āœ… Azure Bicep CLI : PASS +āœ… Azure Providers : PASS +āœ… Jupyter Kernel : PASS +āœ… VS Code Settings : PASS + +šŸ“Š Overall: 9/9 checks passed + +šŸŽ‰ All checks passed! Your local environment is ready for APIM Samples. +šŸ’” You can now open any notebook and it should work seamlessly. ``` --- @@ -132,11 +196,11 @@ If you're setting up locally without the dev container: 1. **Create Python Environment**: In VS Code, use Ctrl+Shift+P → "Python: Create Environment" → "Venv" → Select Python version → Check requirements.txt 2. **Complete Environment Setup**: Run the automated setup script: ```bash - python setup/setup_python_path.py --complete-setup + python setup/local_setup.py --complete-setup ``` For help and available options, run without arguments: ```bash - python setup/setup_python_path.py + python setup/local_setup.py ``` 3. **Restart VS Code** to apply all settings 4. **Sign in to Azure**: `az login --tenant ` and `az account set --subscription ` @@ -164,9 +228,9 @@ If you prefer manual setup or the automated script doesn't work: 1. Verify the virtual environment is set up. You should see a new _.venv_ directory with a _pyveng.cfg_ file and the Python version you selected earlier. 1. Set up the project environment: ```bash - python setup/setup_python_path.py --generate-env - python setup/setup_python_path.py --setup-kernel - python setup/setup_python_path.py --setup-vscode + python setup/local_setup.py --generate-env + python setup/local_setup.py --setup-kernel + python setup/local_setup.py --setup-vscode ``` 1. **Restart VS Code** to ensure all environment settings are loaded properly. @@ -178,7 +242,7 @@ If you encounter import errors (e.g., `ModuleNotFoundError: No module named 'req 1. **Fix Python path configuration**: ```bash - python setup/setup_python_path.py --generate-env + python setup/local_setup.py --generate-env ``` 2. **Verify setup**: diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 520776e..21370a0 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -152,7 +152,7 @@ ModuleNotFoundError: No module named 'utils' **Solution:** Use the provided setup script: ```bash -python setup/setup_python_path.py --generate-env +python setup/local_setup.py --generate-env ``` ### Working Directory Issues diff --git a/setup/README.md b/setup/README.md index 6cd8e55..ff89a2b 100644 --- a/setup/README.md +++ b/setup/README.md @@ -7,7 +7,7 @@ Configures cross-platform PYTHONPATH for APIM Samples and provides streamlined l For complete local environment setup that matches the dev container experience: ```shell -python setup/setup_python_path.py --complete-setup +python setup/local_setup.py --complete-setup ``` This will: @@ -23,22 +23,22 @@ If you prefer to run setup steps individually: ```shell # Generate .env file only -python setup/setup_python_path.py --generate-env +python setup/local_setup.py --generate-env # Register Jupyter kernel only -python setup/setup_python_path.py --setup-kernel +python setup/local_setup.py --setup-kernel # Configure VS Code settings only -python setup/setup_python_path.py --setup-vscode +python setup/local_setup.py --setup-vscode # Force kernel consistency (fix kernel switching issues) -python setup/setup_python_path.py --force-kernel +python setup/local_setup.py --force-kernel # Basic PYTHONPATH setup for current session -python setup/setup_python_path.py --run-only +python setup/local_setup.py --run-only # Show help and available options -python setup/setup_python_path.py +python setup/local_setup.py ``` ## Verification @@ -62,13 +62,13 @@ This checks: To ensure notebooks always use the correct kernel ("APIM Samples Python 3.12" instead of ".venv" or "python3"): -1. **Run the complete setup**: `python setup/setup_python_path.py --complete-setup` +1. **Run the complete setup**: `python setup/local_setup.py --complete-setup` 2. **Restart VS Code** completely 3. **Verify with**: `python setup/verify_setup.py` If you still see incorrect kernel names, run: ```shell -python setup/setup_python_path.py --force-kernel +python setup/local_setup.py --force-kernel ``` ## Troubleshooting diff --git a/setup/setup_python_path.py b/setup/local_setup.py similarity index 90% rename from setup/setup_python_path.py rename to setup/local_setup.py index d38ef38..a1d0a70 100644 --- a/setup/setup_python_path.py +++ b/setup/local_setup.py @@ -25,26 +25,12 @@ from pathlib import Path # Cross-platform path handling (Windows: \, Unix: /) -DEFAULT_VSCODE_SEARCH_EXCLUDE = { - "**/.venv": True, - "**/.venv/**": True, -} - -DEFAULT_VSCODE_FILES_WATCHER_EXCLUDE = { - "**/.venv/**": True, -} - -DEFAULT_VSCODE_FILES_EXCLUDE = { - "**/.venv": True, -} - DEFAULT_PYTHON_ANALYSIS_EXCLUDE = [ "**/node_modules", "**/__pycache__", ".git", "**/build", "env/**", - "**/.venv/**", ] KERNEL_NAME = "python-venv" @@ -133,23 +119,6 @@ def check_azure_providers_registered(): print(" āš ļø Could not verify Azure provider registrations (Azure CLI may not be configured)") return False -def _merge_bool_map(existing: object, required: dict[str, bool]) -> dict[str, bool]: - """Merge boolean map settings while enforcing required keys. - - For VS Code exclude maps, required keys are forced to True. - """ - - if isinstance(existing, dict): - merged: dict[str, bool] = {str(k): bool(v) for k, v in existing.items()} - else: - merged = {} - - for key in required: - merged[key] = True - - return merged - - def _normalize_string_list(value: object) -> list[str]: if value is None: return [] @@ -287,7 +256,7 @@ def generate_env_file() -> None: # These paths will be automatically correct for the current platform lines: list[str] = [ "# Auto-generated environment for VS Code and local tooling", - "# Run 'python setup/setup_python_path.py --generate-env' to regenerate", + "# Run 'python setup/local_setup.py --generate-env' to regenerate", "# Good to set console width to 220, 221 - whatever it takes", "", f"APIM_SAMPLES_CONSOLE_WIDTH={managed_keys['APIM_SAMPLES_CONSOLE_WIDTH']}", @@ -376,7 +345,7 @@ def create_vscode_settings(): venv_python = _venv_python_path() - # Settings to update for Python and notebook flow. Excludes and trusted kernels + # Settings to update for Python and notebook flow. Trusted kernels # are merged to avoid overwriting user customizations. required_settings = { "python.defaultInterpreterPath": venv_python, @@ -406,18 +375,6 @@ def create_vscode_settings(): return False merged_settings = existing_settings | required_settings - merged_settings["search.exclude"] = _merge_bool_map( - existing_settings.get("search.exclude"), - DEFAULT_VSCODE_SEARCH_EXCLUDE, - ) - merged_settings["files.watcherExclude"] = _merge_bool_map( - existing_settings.get("files.watcherExclude"), - DEFAULT_VSCODE_FILES_WATCHER_EXCLUDE, - ) - merged_settings["files.exclude"] = _merge_bool_map( - existing_settings.get("files.exclude"), - DEFAULT_VSCODE_FILES_EXCLUDE, - ) merged_settings["python.analysis.exclude"] = _merge_string_list( existing_settings.get("python.analysis.exclude"), DEFAULT_PYTHON_ANALYSIS_EXCLUDE, @@ -429,13 +386,9 @@ def create_vscode_settings(): print(f"āœ… VS Code settings updated: {settings_file}") print(" - Existing settings preserved") print(" - Python interpreter set to .venv") - print(" - .venv excluded from search/watcher/Pylance indexing") else: # Create new settings file try: - required_settings["search.exclude"] = DEFAULT_VSCODE_SEARCH_EXCLUDE - required_settings["files.watcherExclude"] = DEFAULT_VSCODE_FILES_WATCHER_EXCLUDE - required_settings["files.exclude"] = DEFAULT_VSCODE_FILES_EXCLUDE required_settings["python.analysis.exclude"] = DEFAULT_PYTHON_ANALYSIS_EXCLUDE with open(settings_file, 'w', encoding='utf-8') as f: @@ -443,7 +396,6 @@ def create_vscode_settings(): print(f"āœ… VS Code settings created: {settings_file}") print(" - Python interpreter configured for .venv") - print(" - .venv excluded from search/watcher/Pylance indexing") except (ImportError, IOError) as e: print(f"āŒ Failed to create VS Code settings: {e}") return False @@ -517,18 +469,6 @@ def force_kernel_consistency(): existing_settings.get("jupyter.kernels.trusted"), [venv_python], ) - merged_settings["search.exclude"] = _merge_bool_map( - existing_settings.get("search.exclude"), - DEFAULT_VSCODE_SEARCH_EXCLUDE, - ) - merged_settings["files.watcherExclude"] = _merge_bool_map( - existing_settings.get("files.watcherExclude"), - DEFAULT_VSCODE_FILES_WATCHER_EXCLUDE, - ) - merged_settings["files.exclude"] = _merge_bool_map( - existing_settings.get("files.exclude"), - DEFAULT_VSCODE_FILES_EXCLUDE, - ) merged_settings["python.analysis.exclude"] = _merge_string_list( existing_settings.get("python.analysis.exclude"), DEFAULT_PYTHON_ANALYSIS_EXCLUDE, @@ -537,7 +477,7 @@ def force_kernel_consistency(): with open(settings_file, 'w', encoding='utf-8') as f: json.dump(merged_settings, f, indent=4) - print("āœ… Kernel trust and performance excludes refreshed without overriding user settings") + print("āœ… Kernel trust refreshed without overriding user settings") return True except Exception as e: @@ -617,7 +557,7 @@ def show_help(): print("It handles PYTHONPATH setup, Jupyter kernel registration, and VS Code integration.") print("\nUSAGE:") - print(" python setup/setup_python_path.py [OPTION]") + print(" python setup/local_setup.py [OPTION]") print("\nOPTIONS:") print(" (no options) Show this help information") @@ -658,11 +598,11 @@ def show_help(): print("\nEXAMPLES:") print(" # Show this help information:") - print(" python setup/setup_python_path.py") + print(" python setup/local_setup.py") print("\n # Perform complete setup (recommended for new users):") - print(" python setup/setup_python_path.py --complete-setup") + print(" python setup/local_setup.py --complete-setup") print("\n # Only generate the .env file:") - print(" python setup/setup_python_path.py --generate-env") + print(" python setup/local_setup.py --generate-env") print("\nNOTES:") print(" • Running this script without options now displays this help screen") diff --git a/setup/verify_local_setup.py b/setup/verify_local_setup.py index 1c87dc0..f1538de 100644 --- a/setup/verify_local_setup.py +++ b/setup/verify_local_setup.py @@ -142,9 +142,11 @@ def check_vscode_settings(): # Check for key settings (simple string search since the file may have comments) checks = [ - ('jupyter.defaultKernel', 'apim-samples'), ('python.defaultInterpreterPath', '.venv'), - ('notebook.defaultLanguage', 'python') + ('python.envFile', '.env'), + ('python.terminal.activateEnvironment', 'true'), + ('python.testing.pytestEnabled', 'true'), + ('files.eol', '\\n') ] all_found = True @@ -315,7 +317,7 @@ def main(): print("šŸ’” You can now open any notebook and it should work seamlessly.") else: print("\nāš ļø Some checks failed. Consider running the setup script:") - print(" python setup/setup_python_path.py --complete-setup") + print(" python setup/local_setup.py --complete-setup") print(" Then restart VS Code and run this verification again.") return passed == total diff --git a/start.ps1 b/start.ps1 index a447b15..8c6f6b6 100644 --- a/start.ps1 +++ b/start.ps1 @@ -129,7 +129,7 @@ while ($true) { switch ($choice) { '1' { - if (Invoke-Cmd (Get-Python) "$RepoRoot/setup/setup_python_path.py" "--complete-setup") { Invoke-Pause-Menu } + if (Invoke-Cmd (Get-Python) "$RepoRoot/setup/local_setup.py" "--complete-setup") { Invoke-Pause-Menu } } '2' { if (Invoke-Cmd (Get-Python) "$RepoRoot/setup/verify_local_setup.py") { Invoke-Pause-Menu } diff --git a/start.sh b/start.sh index 5449dd1..4bb2443 100644 --- a/start.sh +++ b/start.sh @@ -91,7 +91,7 @@ while true; do read -rp "Select an option: " choice case "$choice" in 1) - run_cmd "$(find_python)" "${REPO_ROOT}/setup/setup_python_path.py" --complete-setup + run_cmd "$(find_python)" "${REPO_ROOT}/setup/local_setup.py" --complete-setup pause_prompt ;; 2) diff --git a/tests/python/test_setup_python_path_settings.py b/tests/python/test_local_setup.py similarity index 83% rename from tests/python/test_setup_python_path_settings.py rename to tests/python/test_local_setup.py index 4c4fa08..b197543 100644 --- a/tests/python/test_setup_python_path_settings.py +++ b/tests/python/test_local_setup.py @@ -20,7 +20,7 @@ if TYPE_CHECKING: # pragma: no cover sps = cast(ModuleType, None) else: - sps = cast(ModuleType, importlib.import_module("setup_python_path")) + sps = cast(ModuleType, importlib.import_module("local_setup")) @pytest.fixture @@ -46,11 +46,6 @@ def test_create_vscode_settings_creates_perf_excludes(temp_project_root: Path) - settings = _read_settings(temp_project_root) - assert settings["search.exclude"]["**/.venv"] is True - assert settings["search.exclude"]["**/.venv/**"] is True - assert settings["files.watcherExclude"]["**/.venv/**"] is True - assert settings["files.exclude"]["**/.venv"] is True - assert settings["python.analysis.exclude"][: len(sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE)] == sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE @@ -61,7 +56,6 @@ def test_create_vscode_settings_merges_excludes(temp_project_root: Path) -> None (vscode_dir / "settings.json").write_text( json.dumps( { - "search.exclude": {"custom/**": True, "**/.venv": False}, "python.analysis.exclude": ["custom2/**", "**/__pycache__"], }, indent=4, @@ -73,11 +67,6 @@ def test_create_vscode_settings_merges_excludes(temp_project_root: Path) -> None settings = _read_settings(temp_project_root) - # Required keys forced on, custom preserved - assert settings["search.exclude"]["custom/**"] is True - assert settings["search.exclude"]["**/.venv"] is True - assert settings["search.exclude"]["**/.venv/**"] is True - # Required patterns come first, custom patterns preserved afterwards assert settings["python.analysis.exclude"][: len(sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE)] == sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE assert "custom2/**" in settings["python.analysis.exclude"] @@ -90,7 +79,6 @@ def test_force_kernel_consistency_merges_excludes(temp_project_root: Path, monke (vscode_dir / "settings.json").write_text( json.dumps( { - "search.exclude": {"**/.venv/**": False}, "files.watcherExclude": {"other/**": True}, "python.analysis.exclude": ["custom3/**"], }, @@ -106,11 +94,6 @@ def test_force_kernel_consistency_merges_excludes(temp_project_root: Path, monke settings = _read_settings(temp_project_root) - assert settings["search.exclude"]["**/.venv"] is True - assert settings["search.exclude"]["**/.venv/**"] is True - assert settings["files.watcherExclude"]["**/.venv/**"] is True - assert settings["files.watcherExclude"]["other/**"] is True - assert settings["python.analysis.exclude"][: len(sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE)] == sps.DEFAULT_PYTHON_ANALYSIS_EXCLUDE assert "custom3/**" in settings["python.analysis.exclude"] diff --git a/tests/python/test_verify_local_setup.py b/tests/python/test_verify_local_setup.py index 9a3a2ce..e6c0da7 100644 --- a/tests/python/test_verify_local_setup.py +++ b/tests/python/test_verify_local_setup.py @@ -66,23 +66,6 @@ def fake_import(name: str, *args: Any, **kwargs: Any) -> Any: assert vls.check_required_packages() is False -def test_check_vscode_settings_success(temp_cwd: Path) -> None: - """VS Code settings check should succeed when required keys are present.""" - - settings_dir = temp_cwd / ".vscode" - settings_dir.mkdir(parents=True) - (settings_dir / "settings.json").write_text( - '{\n' - ' "jupyter.defaultKernel": "apim-samples",\n' - ' "python.defaultInterpreterPath": ".venv/",\n' - ' "notebook.defaultLanguage": "python"\n' - '}\n', - encoding="utf-8", - ) - - assert vls.check_vscode_settings() is True - - def test_check_env_file_validation(temp_cwd: Path) -> None: """Environment file check should validate required keys."""