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 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)