From 1e56cc7eb904f4833c2a440700d971ce11545875 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 9 Sep 2025 14:59:06 +0800 Subject: [PATCH 1/2] remove unnecessary files --- packages/typespec-python/package.json | 2 - packages/typespec-python/scripts/install.py | 46 --------------------- packages/typespec-python/scripts/prepare.py | 34 --------------- 3 files changed, 82 deletions(-) delete mode 100644 packages/typespec-python/scripts/install.py delete mode 100644 packages/typespec-python/scripts/prepare.py diff --git a/packages/typespec-python/package.json b/packages/typespec-python/package.json index 889e681f3d5..a0ca41366fa 100644 --- a/packages/typespec-python/package.json +++ b/packages/typespec-python/package.json @@ -32,8 +32,6 @@ "clean": "rimraf ./dist ./temp ./venv ./node_modules", "build": "tsc -p .", "watch": "tsc -p . --watch", - "install": "tsx ./scripts/run-python3.ts ./scripts/install.py", - "prepare": "tsx ./scripts/run-python3.ts ./scripts/prepare.py", "lint": "tsx ./scripts/eng/lint.ts", "lint:fix": "eslint . --fix --ext .ts", "format": "npx prettier **/*.ts --write && tsx ./scripts/eng/format.ts", diff --git a/packages/typespec-python/scripts/install.py b/packages/typespec-python/scripts/install.py deleted file mode 100644 index 5fa610349fb..00000000000 --- a/packages/typespec-python/scripts/install.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import sys - -if not sys.version_info >= (3, 9, 0): - raise Exception("Autorest for Python extension requires Python 3.9 at least") - -try: - from package_manager import detect_package_manager, PackageManagerNotFoundError - - detect_package_manager() # Just check if we have a package manager -except (ImportError, ModuleNotFoundError, PackageManagerNotFoundError): - raise Exception("Your Python installation doesn't have a suitable package manager (pip or uv) available") - -try: - import venv -except ImportError: - raise Exception("Your Python installation doesn't have venv available") - - -# Now we have a package manager (uv or pip) and Py >= 3.9, go to work - -from pathlib import Path - -_ROOT_DIR = Path(__file__).parent.parent - - -def main(): - venv_path = _ROOT_DIR / "venv" - - # Create virtual environment using package manager abstraction - from package_manager import create_venv_with_package_manager, install_packages - - venv_context = create_venv_with_package_manager(venv_path) - - # Install required packages - install_packages handles package manager logic - install_packages(["-U", "black"], venv_context) - - -if __name__ == "__main__": - main() diff --git a/packages/typespec-python/scripts/prepare.py b/packages/typespec-python/scripts/prepare.py deleted file mode 100644 index e15a83d27ac..00000000000 --- a/packages/typespec-python/scripts/prepare.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -import sys - -if not sys.version_info >= (3, 9, 0): - raise Exception("Autorest for Python extension requires Python 3.9 at least") - -from pathlib import Path -from package_manager import create_venv_with_package_manager, install_packages - -_ROOT_DIR = Path(__file__).parent.parent - - -def main(): - venv_path = _ROOT_DIR / "venv" - venv_preexists = venv_path.exists() - - assert venv_preexists # Otherwise install was not done - - venv_context = create_venv_with_package_manager(venv_path) - - try: - install_packages(["-r", f"{_ROOT_DIR}/dev_requirements.txt"], venv_context) - except FileNotFoundError as e: - raise ValueError(e.filename) - - -if __name__ == "__main__": - main() From 9fc33a1e3ef88a9706fa45b7d4c9565abc2849f5 Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Tue, 9 Sep 2025 15:00:23 +0800 Subject: [PATCH 2/2] remove unnecessary install scripts --- .chronus/changes/fix-install-2025-8-9-15-0-7.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/fix-install-2025-8-9-15-0-7.md diff --git a/.chronus/changes/fix-install-2025-8-9-15-0-7.md b/.chronus/changes/fix-install-2025-8-9-15-0-7.md new file mode 100644 index 00000000000..79a3238d586 --- /dev/null +++ b/.chronus/changes/fix-install-2025-8-9-15-0-7.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-python" +--- + +Remove useless install scripts \ No newline at end of file