From 99e5f4903bbf4872948931789058dc6e7d9123ce Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Wed, 10 Sep 2025 11:35:18 +0800 Subject: [PATCH 1/2] optimize install --- packages/typespec-python/scripts/install.py | 22 +-------------------- packages/typespec-python/scripts/prepare.py | 4 ++-- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/packages/typespec-python/scripts/install.py b/packages/typespec-python/scripts/install.py index 5fa610349fb..b0f1b91f51f 100644 --- a/packages/typespec-python/scripts/install.py +++ b/packages/typespec-python/scripts/install.py @@ -23,24 +23,4 @@ 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() +# Now we have a package manager (uv or pip) and Py >= 3.9 and check is over diff --git a/packages/typespec-python/scripts/prepare.py b/packages/typespec-python/scripts/prepare.py index e15a83d27ac..d10963ade1d 100644 --- a/packages/typespec-python/scripts/prepare.py +++ b/packages/typespec-python/scripts/prepare.py @@ -18,9 +18,9 @@ def main(): venv_path = _ROOT_DIR / "venv" - venv_preexists = venv_path.exists() - assert venv_preexists # Otherwise install was not done + # 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) From 7cad06442e68c4da871bb6f3e4918001df36274f Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 22 Sep 2025 17:05:13 +0800 Subject: [PATCH 2/2] improve install process --- .../changes/optimize-install-speed-2025-8-22-17-4-59.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .chronus/changes/optimize-install-speed-2025-8-22-17-4-59.md diff --git a/.chronus/changes/optimize-install-speed-2025-8-22-17-4-59.md b/.chronus/changes/optimize-install-speed-2025-8-22-17-4-59.md new file mode 100644 index 00000000000..c5e6bc62b5c --- /dev/null +++ b/.chronus/changes/optimize-install-speed-2025-8-22-17-4-59.md @@ -0,0 +1,7 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-python" +--- + +Improve install process \ No newline at end of file