From 77e5dc598d963e0dd0b94db6f2e3c5c8d56b1e9c Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:14:22 +0530 Subject: [PATCH 01/43] Update CI workflow to utilize UV for Python package management and testing - Added environment variable `UV_SYSTEM_PYTHON` to enable UV integration. - Replaced direct `pip` commands with `uv pip` for installing dependencies and running tests. - Updated test and coverage commands to use `uv run` for improved execution within the UV environment. --- .github/workflows/ci-testing.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index dfd24358..f0a0a97c 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [main, "release/*"] +env: + UV_SYSTEM_PYTHON: 1 + defaults: run: shell: bash @@ -29,33 +32,36 @@ jobs: steps: - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - cache: "pip" + enable-cache: true - name: Set min. dependencies if: matrix.requires == 'oldest' run: | - pip install 'lightning-utilities[cli]' - python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' + uv pip install 'lightning-utilities[cli]' + uv python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' - name: Install package & dependencies run: | - pip --version - pip install -e '.[test]' -U -q --find-links $TORCH_URL - pip list + uv pip install -e '.[test]' -U -q --find-links $TORCH_URL + uv pip list - name: Tests timeout-minutes: 15 run: | - python -m pytest --cov=litserve src/ tests/ -v -s --durations=100 + uv run pytest --cov=litserve src/ tests/ -v -s --durations=100 - name: Statistics run: | - coverage report - coverage xml + uv run coverage report + uv run coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 From 20cd3485152386d317577fedd2f0d9f3045731c4 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:19:10 +0530 Subject: [PATCH 02/43] fiix --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index f0a0a97c..f2c4d6f4 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -46,7 +46,7 @@ jobs: if: matrix.requires == 'oldest' run: | uv pip install 'lightning-utilities[cli]' - uv python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' + uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' - name: Install package & dependencies run: | From 3838fb2f552ccc947829be3cc64c3ad569ea09ff Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:20:32 +0530 Subject: [PATCH 03/43] fix --- .github/workflows/ci-testing.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index f2c4d6f4..217f94e2 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -6,9 +6,6 @@ on: pull_request: branches: [main, "release/*"] -env: - UV_SYSTEM_PYTHON: 1 - defaults: run: shell: bash From c99a59e555a420b5ba09fa29b12fdc1caad1beb9 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:21:53 +0530 Subject: [PATCH 04/43] updae --- .github/workflows/ci-testing.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 217f94e2..8109e4f9 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -42,7 +42,8 @@ jobs: - name: Set min. dependencies if: matrix.requires == 'oldest' run: | - uv pip install 'lightning-utilities[cli]' + uv pip install pip + pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' - name: Install package & dependencies From c61578775bd8535281fc1069556622a854776d86 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:25:06 +0530 Subject: [PATCH 05/43] upgrade uv --- .github/workflows/ci-testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 8109e4f9..4be6d065 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -31,10 +31,10 @@ jobs: - uses: actions/checkout@v4 - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 - name: Set up Python ${{ matrix.python-version }} - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python-version }} enable-cache: true From eaec97b955e0a3b1d77afc53af50ccf0fa136336 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:25:55 +0530 Subject: [PATCH 06/43] add env --- .github/workflows/ci-testing.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 4be6d065..7c1a2646 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,6 +10,9 @@ defaults: run: shell: bash +env: + UV_SYSTEM_PYTHON: 1 + jobs: pytester: runs-on: ${{ matrix.os }} From ba61048a655b94a39d49c6fd0df7860d88acbc57 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:31:09 +0530 Subject: [PATCH 07/43] fix --- .github/workflows/ci-testing.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 7c1a2646..648ea188 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -10,9 +10,6 @@ defaults: run: shell: bash -env: - UV_SYSTEM_PYTHON: 1 - jobs: pytester: runs-on: ${{ matrix.os }} @@ -32,15 +29,12 @@ jobs: steps: - uses: actions/checkout@v4 - - - name: Install uv - uses: astral-sh/setup-uv@v6 - - - name: Set up Python ${{ matrix.python-version }} + - name: Install uv and setup python uses: astral-sh/setup-uv@v6 with: python-version: ${{ matrix.python-version }} enable-cache: true + - run: uv pip install --python=${{ matrix.python-version }} pip - name: Set min. dependencies if: matrix.requires == 'oldest' From 19e687ff0fe26cad9a280377abcb5718a1a42e15 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:32:01 +0530 Subject: [PATCH 08/43] update --- .github/workflows/ci-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 648ea188..697a46ce 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -32,6 +32,7 @@ jobs: - name: Install uv and setup python uses: astral-sh/setup-uv@v6 with: + activate-environment: true python-version: ${{ matrix.python-version }} enable-cache: true - run: uv pip install --python=${{ matrix.python-version }} pip From ce76130e032f968be95a0d5623e5614df9b2d502 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:33:40 +0530 Subject: [PATCH 09/43] fix --- .github/workflows/ci-testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 697a46ce..ae6e4aa2 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -52,12 +52,12 @@ jobs: - name: Tests timeout-minutes: 15 run: | - uv run pytest --cov=litserve src/ tests/ -v -s --durations=100 + pytest --cov=litserve src/ tests/ -v -s --durations=100 - name: Statistics run: | - uv run coverage report - uv run coverage xml + coverage report + coverage xml - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 From 624de5d1d88275350a95989064c2af7f4a7f2c2a Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:41:55 +0530 Subject: [PATCH 10/43] fix --- .github/workflows/ci-testing.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index ae6e4aa2..5a1740df 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -40,7 +40,6 @@ jobs: - name: Set min. dependencies if: matrix.requires == 'oldest' run: | - uv pip install pip pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' From 7600c9abd6192cf0047b821930afa0e89ae9ca2a Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 00:46:32 +0530 Subject: [PATCH 11/43] up --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 5a1740df..dac9c181 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -46,7 +46,7 @@ jobs: - name: Install package & dependencies run: | uv pip install -e '.[test]' -U -q --find-links $TORCH_URL - uv pip list + pip list - name: Tests timeout-minutes: 15 From 058fdebdc66853d70043378f30e1feeeb9ea3cf4 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:23:44 +0530 Subject: [PATCH 12/43] Update project configuration and dependencies in pyproject.toml and .gitignore - Added `uv.lock` to .gitignore to prevent lock file from being tracked. - Refactored pyproject.toml to define project metadata, including name, dynamic versioning, and Python requirements. - Specified dependencies for the project, including FastAPI, Uvicorn, and others for development. --- .gitignore | 1 + pyproject.toml | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 008c1d46..a41e8a81 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,4 @@ venv.bak/ lightning_logs/ MNIST .DS_Store +uv.lock diff --git a/pyproject.toml b/pyproject.toml index dc1c7a55..ccd5a562 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,13 +2,33 @@ license_file = "LICENSE" description-file = "README.md" -[build-system] -requires = [ - "setuptools", - "wheel", +[project] +name="litserve" +dynamic = ["version"] +readme = "README.md" +requires-python = ">=3.9" + +dependencies = [ + "fastapi>=0.100", + "pyzmq>=22.0.0", + "uvicorn[standard]>=0.29.0", ] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[tool.hatch.version] +path = "src/litserve/__about__.py" +pattern = "__version__ = \"(?P.+)\"" + +[tool.hatch.metadata] +allow-direct-references = true + + [tool.check-manifest] ignore = [ "*.yml", @@ -128,3 +148,25 @@ convention = "google" [tool.ruff.lint.mccabe] # Unlike Flake8, default to a complexity level of 10. max-complexity = 10 + +[dependency-groups] +dev = [ + "asgi-lifespan>=2.1.0", + "coverage[toml]>=7.5.3", + "fastmcp>=2.9.2 ; python_full_version >= '3.10'", + "httpx>=0.27.0", + "lightning>2.0.0", + "mypy==1.16.0", + "numpy<3.0", + "openai>=1.12.0", + "pillow>=11.3.0", + "psutil>=7.0.0", + "pytest>=8.0", + "pytest-asyncio>=1.0.0", + "pytest-cov>=6.2.1", + "pytest-retry>=1.6.3", + "python-multipart>=0.0.20", + "requests>=2.32.4", + "torch>2.0.0", + "transformers>=4.53.0", +] From ad5c5377305531a79d10aa7b942baa0edfd363c0 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:27:19 +0530 Subject: [PATCH 13/43] update --- .github/workflows/ci-testing.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index dac9c181..bdabada5 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -35,12 +35,13 @@ jobs: activate-environment: true python-version: ${{ matrix.python-version }} enable-cache: true - - run: uv pip install --python=${{ matrix.python-version }} pip + - name: Install the project + run: uv sync --all-extras --dev - name: Set min. dependencies if: matrix.requires == 'oldest' run: | - pip install 'lightning-utilities[cli]' + uv pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' - name: Install package & dependencies From bd1681a5a678cecf6275e24e11325ae1cf436c43 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:44:20 +0530 Subject: [PATCH 14/43] Refactor project configuration by consolidating setup into pyproject.toml - Removed setup.py and requirements.txt files. - Enhanced pyproject.toml with project metadata, including description, authors, and URLs. - Updated Python version requirement to >=3.8 and added relevant classifiers. - Defined project scripts for command-line entry points. --- _requirements/test.txt | 18 ------- pyproject.toml | 40 ++++++++++++-- requirements.txt | 3 -- setup.py | 116 ----------------------------------------- 4 files changed, 35 insertions(+), 142 deletions(-) delete mode 100644 _requirements/test.txt delete mode 100644 requirements.txt delete mode 100755 setup.py diff --git a/_requirements/test.txt b/_requirements/test.txt deleted file mode 100644 index a561abdc..00000000 --- a/_requirements/test.txt +++ /dev/null @@ -1,18 +0,0 @@ -httpx>=0.27.0 -coverage[toml] >=7.5.3 -pytest >=8.0 -pytest-cov -mypy ==1.16.0 -pytest-asyncio -asgi-lifespan -python-multipart -psutil -requests -lightning >2.0.0 -torch >2.0.0 -transformers -openai>=1.12.0 -pillow -numpy <3.0 -pytest-retry>=1.6.3 -fastmcp>=2.9.2; python_version >= '3.10' diff --git a/pyproject.toml b/pyproject.toml index ccd5a562..215dfe47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,10 +3,32 @@ license_file = "LICENSE" description-file = "README.md" [project] -name="litserve" +name = "litserve" dynamic = ["version"] +description = "Lightweight AI server." readme = "README.md" -requires-python = ">=3.9" +license = {text = "Apache-2.0"} +authors = [ + {name = "Lightning-AI et al.", email = "community@lightning.ai"} +] +requires-python = ">=3.8" +keywords = ["deep learning", "pytorch", "AI"] +classifiers = [ + "Environment :: Console", + "Natural Language :: English", + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Scientific/Engineering :: Information Analysis", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] dependencies = [ "fastapi>=0.100", @@ -14,21 +36,30 @@ dependencies = [ "uvicorn[standard]>=0.29.0", ] +[project.urls] +Homepage = "https://github.com/Lightning-AI/litserve" +"Bug Tracker" = "https://github.com/Lightning-AI/litserve/issues" +Documentation = "https://lightning-ai.github.io/litserve/" +"Source Code" = "https://github.com/Lightning-AI/litserve" +Download = "https://github.com/Lightning-AI/litserve" + +[project.scripts] +litserve = "litserve.__main__:main" +lightning = "litserve.cli:main" [build-system] requires = ["hatchling"] build-backend = "hatchling.build" - [tool.hatch.version] path = "src/litserve/__about__.py" pattern = "__version__ = \"(?P.+)\"" + [tool.hatch.metadata] allow-direct-references = true - [tool.check-manifest] ignore = [ "*.yml", @@ -36,7 +67,6 @@ ignore = [ ".github/*" ] - [tool.pytest.ini_options] norecursedirs = [ ".git", diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c2b75086..00000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -fastapi >=0.100 -uvicorn[standard] >=0.29.0 -pyzmq >=22.0.0 diff --git a/setup.py b/setup.py deleted file mode 100755 index f84ae0e1..00000000 --- a/setup.py +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python -# Copyright The Lightning AI team. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -import glob -import os -from importlib.util import module_from_spec, spec_from_file_location -from pathlib import Path - -from pkg_resources import parse_requirements -from setuptools import find_packages, setup - -_PATH_ROOT = os.path.dirname(__file__) -_PATH_SOURCE = os.path.join(_PATH_ROOT, "src") -_PATH_REQUIRES = os.path.join(_PATH_ROOT, "_requirements") - - -def _load_py_module(fname, pkg="litserve"): - spec = spec_from_file_location(os.path.join(pkg, fname), os.path.join(_PATH_SOURCE, pkg, fname)) - py = module_from_spec(spec) - spec.loader.exec_module(py) - return py - - -def _load_requirements(path_dir: str = _PATH_ROOT, file_name: str = "requirements.txt") -> list: - reqs = parse_requirements(open(os.path.join(path_dir, file_name)).readlines()) - return list(map(str, reqs)) - - -about = _load_py_module("__about__.py") -with open(os.path.join(_PATH_ROOT, "README.md"), encoding="utf-8") as fopen: - readme = fopen.read() - - -def _prepare_extras(requirements_dir: str = _PATH_REQUIRES, skip_files: tuple = ("devel.txt", "docs.txt")) -> dict: - # https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras - # Define package extras. These are only installed if you specify them. - # From remote, use like `pip install pytorch-lightning[dev, docs]` - # From local copy of repo, use like `pip install ".[dev, docs]"` - req_files = [Path(p) for p in glob.glob(os.path.join(requirements_dir, "*.txt"))] - extras = { - p.stem: _load_requirements(file_name=p.name, path_dir=str(p.parent)) - for p in req_files - if p.name not in skip_files - } - # todo: eventually add some custom aggregations such as `develop` - extras = {name: sorted(set(reqs)) for name, reqs in extras.items()} - print("The extras are: ", extras) - return extras - - -# https://packaging.python.org/discussions/install-requires-vs-requirements / -# keep the meta-data here for simplicity in reading this file... it's not obvious -# what happens and to non-engineers they won't know to look in init ... -# the goal of the project is simplicity for researchers, don't want to add too much -# engineer specific practices -setup( - name="litserve", - version=about.__version__, - description=about.__docs__, - author=about.__author__, - author_email=about.__author_email__, - url=about.__homepage__, - download_url="https://github.com/Lightning-AI/litserve", - license=about.__license__, - packages=find_packages(where="src"), - package_dir={"": "src"}, - long_description=readme, - long_description_content_type="text/markdown", - include_package_data=True, - zip_safe=False, - keywords=["deep learning", "pytorch", "AI"], - python_requires=">=3.8", - setup_requires=["wheel"], - install_requires=_load_requirements(), - extras_require=_prepare_extras(), - project_urls={ - "Bug Tracker": "https://github.com/Lightning-AI/litserve/issues", - "Documentation": "https://lightning-ai.github.io/litserve/", - "Source Code": "https://github.com/Lightning-AI/litserve", - }, - classifiers=[ - "Environment :: Console", - "Natural Language :: English", - # How mature is this project? Common values are - # 3 - Alpha, 4 - Beta, 5 - Production/Stable - "Development Status :: 3 - Alpha", - # Indicate who your project is intended for - "Intended Audience :: Developers", - "Topic :: Scientific/Engineering :: Artificial Intelligence", - "Topic :: Scientific/Engineering :: Information Analysis", - # Pick your license as you wish - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - entry_points={ - "console_scripts": ["litserve=litserve.__main__:main", "lightning=litserve.cli:main"], - }, -) From cd655af4f3da2f091c067657ce71acf0a6b91829 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:45:34 +0530 Subject: [PATCH 15/43] fix --- tests/e2e/test_e2e.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index 93cfce22..0d3a7ebe 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -31,7 +31,7 @@ def decorator(test_fn): @wraps(test_fn) def wrapper(*args, **kwargs): process = subprocess.Popen( - ["python", filename], + ["uv run", filename], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, From 7cf8a035d57ad735413a07f0dffe16c990eee7fd Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:48:30 +0530 Subject: [PATCH 16/43] fix --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 215dfe47..fa5ab2b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ license = {text = "Apache-2.0"} authors = [ {name = "Lightning-AI et al.", email = "community@lightning.ai"} ] -requires-python = ">=3.8" +requires-python = ">=3.9" keywords = ["deep learning", "pytorch", "AI"] classifiers = [ "Environment :: Console", From eafb4b7e1282ddcaed4f77d5adf79e86d07d0182 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 01:52:01 +0530 Subject: [PATCH 17/43] fic ci --- .azure/gpu-tests.yml | 3 +-- .github/workflows/ci-parity.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index 4fb39030..7ac2eabb 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -59,8 +59,7 @@ jobs: displayName: "Image info & NVIDIA" - bash: | - pip install . -U --prefer-binary \ - -r ./_requirements/test.txt --find-links=${TORCH_URL} + pip install '.[dev]' -U --prefer-binary --find-links=${TORCH_URL} displayName: "Install environment" - bash: | diff --git a/.github/workflows/ci-parity.yml b/.github/workflows/ci-parity.yml index 0a1ce27f..692ae6b4 100644 --- a/.github/workflows/ci-parity.yml +++ b/.github/workflows/ci-parity.yml @@ -26,7 +26,7 @@ jobs: - name: Install LitServe run: | pip --version - pip install . torchvision jsonargparse uvloop tenacity -U -q -r _requirements/test.txt -U -q + pip install '.[dev]' torchvision jsonargparse uvloop tenacity -U -q pip list - name: Parity test From d8677eb7e125bf8c718b8877aae1a21fc70c8a51 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 14:10:21 +0530 Subject: [PATCH 18/43] fix --- .azure/gpu-tests.yml | 30 +++++++++++++++++------------- tests/e2e/test_e2e.py | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index 7ac2eabb..8be1de24 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -45,6 +45,10 @@ jobs: echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/cu${CUDA_version_mm}/torch_stable.html" displayName: "set Env. vars" + - bash: | + curl -LsSf https://astral.sh/uv/install.sh | sh + displayName: "Install uv" + - bash: | whoami && id lspci | egrep 'VGA|3D' @@ -53,43 +57,43 @@ jobs: echo $CUDA_VISIBLE_DEVICES echo $TORCH_URL python --version - pip --version - pip cache dir - pip list + uv --version + uv cache dir + uv pip list displayName: "Image info & NVIDIA" - bash: | - pip install '.[dev]' -U --prefer-binary --find-links=${TORCH_URL} + uv pip install --python=3.12 '.[dev]' -U --prefer-binary --find-links=${TORCH_URL} displayName: "Install environment" - bash: | - pip list + uv pip list python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'found GPUs: {mgpu}'" displayName: "Sanity check" - bash: | - pip install -q py-tree + uv pip install -q py-tree py-tree /var/tmp/torch displayName: "Show caches" - bash: | - coverage run --source litserve -m pytest src tests -v + uv run coverage run --source litserve -m pytest src tests -v displayName: "Testing" - bash: | - python -m coverage report - python -m coverage xml - python -m codecov --token=$(CODECOV_TOKEN) --name="GPU-coverage" \ + uv run coverage report + uv run coverage xml + uv run codecov --token=$(CODECOV_TOKEN) --name="GPU-coverage" \ --commit=$(Build.SourceVersion) --flags=gpu,unittest --env=linux,azure ls -l displayName: "Statistics" - bash: | - pip install torch torchvision -U -q --find-links=${TORCH_URL} -r _requirements/perf.txt - export PYTHONPATH=$PWD && python tests/parity_fastapi/main.py + uv pip install torch torchvision -U -q --find-links=${TORCH_URL} -r _requirements/perf.txt + export PYTHONPATH=$PWD && uv run python tests/parity_fastapi/main.py displayName: "Run FastAPI parity tests" - bash: | - pip install gpustat wget -U -q + uv pip install gpustat wget -U -q bash tests/perf_test/bert/run_test.sh displayName: "Run GPU perf test" diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index 0d3a7ebe..93cfce22 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -31,7 +31,7 @@ def decorator(test_fn): @wraps(test_fn) def wrapper(*args, **kwargs): process = subprocess.Popen( - ["uv run", filename], + ["python", filename], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, From be5385b11efad047b99b4bc4e7302e2f01da6409 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 14:11:48 +0530 Subject: [PATCH 19/43] update --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index bdabada5..6e00ee4b 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -42,7 +42,7 @@ jobs: if: matrix.requires == 'oldest' run: | uv pip install 'lightning-utilities[cli]' - uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt", "_requirements/test.txt"]' + uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' - name: Install package & dependencies run: | From 0a0ca9bf0eafa7b9af88456ec849a6e8d8574507 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 2 Jul 2025 14:15:14 +0530 Subject: [PATCH 20/43] fix --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 6e00ee4b..cebffeb8 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -46,7 +46,7 @@ jobs: - name: Install package & dependencies run: | - uv pip install -e '.[test]' -U -q --find-links $TORCH_URL + uv pip install -e '.[dev]' -U -q --find-links $TORCH_URL pip list - name: Tests From 0770334f5ec9e48fe255a5e76d505601eb4a4546 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 01:43:06 +0530 Subject: [PATCH 21/43] sync --- .azure/gpu-tests.yml | 2 +- .github/workflows/ci-testing.yml | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index 8be1de24..756ce19c 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -63,7 +63,7 @@ jobs: displayName: "Image info & NVIDIA" - bash: | - uv pip install --python=3.12 '.[dev]' -U --prefer-binary --find-links=${TORCH_URL} + uv sync --all-extras --dev displayName: "Install environment" - bash: | diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index cebffeb8..eca36f79 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -35,8 +35,6 @@ jobs: activate-environment: true python-version: ${{ matrix.python-version }} enable-cache: true - - name: Install the project - run: uv sync --all-extras --dev - name: Set min. dependencies if: matrix.requires == 'oldest' @@ -46,7 +44,7 @@ jobs: - name: Install package & dependencies run: | - uv pip install -e '.[dev]' -U -q --find-links $TORCH_URL + uv sync --all-extras --dev pip list - name: Tests From 1b992e4259f2debf9aa8b20fc0965b75446cd9ee Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 01:46:19 +0530 Subject: [PATCH 22/43] fix --- .github/workflows/ci-parity.yml | 15 +++++++++------ .github/workflows/ci-testing.yml | 11 ++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-parity.yml b/.github/workflows/ci-parity.yml index 692ae6b4..6bbdcec8 100644 --- a/.github/workflows/ci-parity.yml +++ b/.github/workflows/ci-parity.yml @@ -18,16 +18,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv and setup python + uses: astral-sh/setup-uv@v6 with: - python-version: "3.11" + activate-environment: true + python-version: "3.12" + enable-cache: true - name: Install LitServe run: | - pip --version - pip install '.[dev]' torchvision jsonargparse uvloop tenacity -U -q - pip list + uv pip --version + uv pip sync + uv pip install torchvision jsonargparse uvloop tenacity -U -q + uv pip list - name: Parity test run: export PYTHONPATH=$PWD && python tests/parity_fastapi/main.py diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index eca36f79..dfcd35e4 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -36,11 +36,12 @@ jobs: python-version: ${{ matrix.python-version }} enable-cache: true - - name: Set min. dependencies - if: matrix.requires == 'oldest' - run: | - uv pip install 'lightning-utilities[cli]' - uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' + # @borda - is this needed? + # - name: Set min. dependencies + # if: matrix.requires == 'oldest' + # run: | + # uv pip install 'lightning-utilities[cli]' + # uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' - name: Install package & dependencies run: | From 9009bf9b2e1899fb86031f7c4a301cc6435c2693 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 01:47:34 +0530 Subject: [PATCH 23/43] fix --- .github/workflows/ci-parity.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci-parity.yml b/.github/workflows/ci-parity.yml index 6bbdcec8..cb4eb357 100644 --- a/.github/workflows/ci-parity.yml +++ b/.github/workflows/ci-parity.yml @@ -27,8 +27,7 @@ jobs: - name: Install LitServe run: | - uv pip --version - uv pip sync + uv pip sync --all-extras --dev uv pip install torchvision jsonargparse uvloop tenacity -U -q uv pip list From 4b7e6834b82b0eae2af1ce3ffb29cbb6365ab83b Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 01:52:31 +0530 Subject: [PATCH 24/43] fix azure --- .azure/gpu-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index 756ce19c..b0d6bb40 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -46,6 +46,7 @@ jobs: displayName: "set Env. vars" - bash: | + apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/* curl -LsSf https://astral.sh/uv/install.sh | sh displayName: "Install uv" From 168dc1272bb38893f2b89fee23c7029e8b8358f5 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 15:53:01 +0530 Subject: [PATCH 25/43] fix requirements --- .azure/gpu-tests.yml | 3 ++- .github/workflows/ci-minimal-dependency-check.yml | 14 ++++++++------ .github/workflows/ci-parity.yml | 3 ++- pyproject.toml | 4 ++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index b0d6bb40..c52b1a75 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -48,6 +48,7 @@ jobs: - bash: | apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/* curl -LsSf https://astral.sh/uv/install.sh | sh + source $HOME/.local/bin/env displayName: "Install uv" - bash: | @@ -90,7 +91,7 @@ jobs: displayName: "Statistics" - bash: | - uv pip install torch torchvision -U -q --find-links=${TORCH_URL} -r _requirements/perf.txt + uv pip install torch torchvision -U -q --find-links=${TORCH_URL} export PYTHONPATH=$PWD && uv run python tests/parity_fastapi/main.py displayName: "Run FastAPI parity tests" diff --git a/.github/workflows/ci-minimal-dependency-check.yml b/.github/workflows/ci-minimal-dependency-check.yml index b869ad3b..9db21e1f 100644 --- a/.github/workflows/ci-minimal-dependency-check.yml +++ b/.github/workflows/ci-minimal-dependency-check.yml @@ -18,16 +18,18 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Install uv and setup python + uses: astral-sh/setup-uv@v6 with: - python-version: "3.11" + activate-environment: true + python-version: "3.12" + enable-cache: true - name: Install LitServe run: | - pip --version - pip install . psutil -U -q - pip list + uv sync --no-dev + uv pip install . psutil -U -q + uv pip list - name: Tests run: python tests/minimal_run.py diff --git a/.github/workflows/ci-parity.yml b/.github/workflows/ci-parity.yml index cb4eb357..a71a845b 100644 --- a/.github/workflows/ci-parity.yml +++ b/.github/workflows/ci-parity.yml @@ -27,7 +27,8 @@ jobs: - name: Install LitServe run: | - uv pip sync --all-extras --dev + uv sync --all-extras --dev + uv pip compile pyproject.toml -o requirements.txt uv pip install torchvision jsonargparse uvloop tenacity -U -q uv pip list diff --git a/pyproject.toml b/pyproject.toml index 226d1a37..6eeba91d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -199,4 +199,8 @@ dev = [ "requests>=2.32.4", "torch>2.0.0", "transformers>=4.53.0", + "uvloop>=0.21.0", + "tenacity>=9.1.2", + "jsonargparse", + "rich", ] From 93a346fa499327579c77d8c4d664a4fd098e29df Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 15:55:11 +0530 Subject: [PATCH 26/43] fix toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6eeba91d..1f888197 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -199,7 +199,7 @@ dev = [ "requests>=2.32.4", "torch>2.0.0", "transformers>=4.53.0", - "uvloop>=0.21.0", + "uvloop>=0.21.0 ; sys_platform != 'win32'", "tenacity>=9.1.2", "jsonargparse", "rich", From ee7636075464ef3e8d3859da1e0ba75fa3b123ab Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 15:58:47 +0530 Subject: [PATCH 27/43] backward compatibility --- .github/workflows/ci-testing.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index dfcd35e4..8d1348af 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -36,16 +36,17 @@ jobs: python-version: ${{ matrix.python-version }} enable-cache: true - # @borda - is this needed? - # - name: Set min. dependencies - # if: matrix.requires == 'oldest' - # run: | - # uv pip install 'lightning-utilities[cli]' - # uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' + - name: Set min. dependencies + if: matrix.requires == 'oldest' + run: | + uv pip compile pyproject.toml -o requirements.txt + uv pip install 'lightning-utilities[cli]' + uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' - name: Install package & dependencies run: | - uv sync --all-extras --dev + uv pip install -r requirements.txt -U -q + uv sync --group dev pip list - name: Tests From 890c1780b8ba5ff3ca3b5d0118702f0a3ced151e Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:01:12 +0530 Subject: [PATCH 28/43] fix --- .azure/gpu-tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index c52b1a75..f3900e7d 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -46,9 +46,7 @@ jobs: displayName: "set Env. vars" - bash: | - apt-get update && apt-get install -y --no-install-recommends curl ca-certificates && rm -rf /var/lib/apt/lists/* - curl -LsSf https://astral.sh/uv/install.sh | sh - source $HOME/.local/bin/env + pip install uv displayName: "Install uv" - bash: | From 99d09eb35aff26e5e6a36ab750d2cdc9f662acb2 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:06:49 +0530 Subject: [PATCH 29/43] fix ci --- .github/workflows/ci-testing.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 8d1348af..746da4a8 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -36,14 +36,16 @@ jobs: python-version: ${{ matrix.python-version }} enable-cache: true + - name: Set up dependencies + run: uv pip compile pyproject.toml -o requirements.txt + - name: Set min. dependencies if: matrix.requires == 'oldest' run: | - uv pip compile pyproject.toml -o requirements.txt uv pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' - - name: Install package & dependencies + - name: Install package run: | uv pip install -r requirements.txt -U -q uv sync --group dev From b6c6d44f69b8d0d2f7b95345674b25a4c9e08075 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:08:40 +0530 Subject: [PATCH 30/43] fix gpu test --- .azure/gpu-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index f3900e7d..4946f1fb 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -64,6 +64,7 @@ jobs: - bash: | uv sync --all-extras --dev + source .venv/bin/activate displayName: "Install environment" - bash: | @@ -73,7 +74,7 @@ jobs: - bash: | uv pip install -q py-tree - py-tree /var/tmp/torch + uv run py-tree /var/tmp/torch displayName: "Show caches" - bash: | From 256cacbf8ab4a7796de5fa7f0ed279be85ef12a4 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:21:58 +0530 Subject: [PATCH 31/43] fix python script subprocess --- tests/e2e/test_e2e.py | 3 ++- tests/parity_fastapi/main.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/test_e2e.py b/tests/e2e/test_e2e.py index 93cfce22..40e51b05 100644 --- a/tests/e2e/test_e2e.py +++ b/tests/e2e/test_e2e.py @@ -14,6 +14,7 @@ import json import os import subprocess +import sys import time from concurrent.futures import ThreadPoolExecutor from functools import wraps @@ -31,7 +32,7 @@ def decorator(test_fn): @wraps(test_fn) def wrapper(*args, **kwargs): process = subprocess.Popen( - ["python", filename], + [sys.executable, filename], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL, diff --git a/tests/parity_fastapi/main.py b/tests/parity_fastapi/main.py index fea0fdb7..ffe818e8 100644 --- a/tests/parity_fastapi/main.py +++ b/tests/parity_fastapi/main.py @@ -1,4 +1,5 @@ import subprocess +import sys import time from functools import wraps @@ -28,7 +29,7 @@ def decorator(test_fn): @wraps(test_fn) def wrapper(*args, **kwargs): process = subprocess.Popen( - ["python", filename], + [sys.executable, filename], ) print("Waiting for server to start...") time.sleep(10) From 2efcd81cd78597b8003fa1c9b05c709c4637ad49 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:36:07 +0530 Subject: [PATCH 32/43] update --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 1f888197..99e297e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -203,4 +203,5 @@ dev = [ "tenacity>=9.1.2", "jsonargparse", "rich", + "torchvision>=0.22.1", ] From a2c2e8e959b659480d613940f4bf08fcc00a155e Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:46:56 +0530 Subject: [PATCH 33/43] fix gpu test --- tests/perf_test/stream/run_test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/perf_test/stream/run_test.sh b/tests/perf_test/stream/run_test.sh index 03cc139b..aaca2fe6 100644 --- a/tests/perf_test/stream/run_test.sh +++ b/tests/perf_test/stream/run_test.sh @@ -3,14 +3,14 @@ # Function to clean up server process cleanup() { - pkill -f "python tests/perf_test/stream/stream_speed/server.py" + pkill -f "uv run tests/perf_test/stream/stream_speed/server.py" } # Trap script exit to run cleanup trap cleanup EXIT # Start the server in the background and capture its PID -python tests/perf_test/stream/stream_speed/server.py & +uv run tests/perf_test/stream/stream_speed/server.py & SERVER_PID=$! echo "Server started with PID $SERVER_PID" @@ -18,7 +18,7 @@ echo "Server started with PID $SERVER_PID" # Run your benchmark script echo "Preparing to run benchmark.py..." -export PYTHONPATH=$PWD && python tests/perf_test/stream/stream_speed/benchmark.py +export PYTHONPATH=$PWD && uv run tests/perf_test/stream/stream_speed/benchmark.py # Check if benchmark.py exited successfully if [ $? -ne 0 ]; then From e4bba1e71c6d308ec92d840c85d9b4a03b60a76b Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 16:58:54 +0530 Subject: [PATCH 34/43] fix gpu --- .azure/gpu-tests.yml | 2 +- tests/perf_test/bert/run_test.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index 4946f1fb..d2fe0283 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -91,7 +91,7 @@ jobs: - bash: | uv pip install torch torchvision -U -q --find-links=${TORCH_URL} - export PYTHONPATH=$PWD && uv run python tests/parity_fastapi/main.py + export PYTHONPATH=$PWD && uv run tests/parity_fastapi/main.py displayName: "Run FastAPI parity tests" - bash: | diff --git a/tests/perf_test/bert/run_test.sh b/tests/perf_test/bert/run_test.sh index 86d24d9f..3685c484 100644 --- a/tests/perf_test/bert/run_test.sh +++ b/tests/perf_test/bert/run_test.sh @@ -2,14 +2,14 @@ # Function to clean up server process cleanup() { - pkill -f "python tests/perf_test/bert/server.py" + pkill -f "uv run tests/perf_test/bert/server.py" } # Trap script exit to run cleanup trap cleanup EXIT # Start the server in the background and capture its PID -python tests/perf_test/bert/server.py & +uv run tests/perf_test/bert/server.py & SERVER_PID=$! echo "Server started with PID $SERVER_PID" @@ -17,7 +17,7 @@ echo "Server started with PID $SERVER_PID" # Run your benchmark script echo "Preparing to run benchmark.py..." -export PYTHONPATH=$PWD && python tests/perf_test/bert/benchmark.py +export PYTHONPATH=$PWD && uv run tests/perf_test/bert/benchmark.py # Check if benchmark.py exited successfully if [ $? -ne 0 ]; then From 8a4f787129feaa419b60f0361e3ff48408923b20 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 13:56:19 +0200 Subject: [PATCH 35/43] Apply suggestions from code review --- .azure/gpu-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure/gpu-tests.yml b/.azure/gpu-tests.yml index d2fe0283..b2966871 100644 --- a/.azure/gpu-tests.yml +++ b/.azure/gpu-tests.yml @@ -64,7 +64,6 @@ jobs: - bash: | uv sync --all-extras --dev - source .venv/bin/activate displayName: "Install environment" - bash: | From dd5a323a4df426325d8a536ec810d9c9eae57eec Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 14:03:14 +0200 Subject: [PATCH 36/43] Apply suggestions from code review --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 746da4a8..283c6186 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -49,7 +49,7 @@ jobs: run: | uv pip install -r requirements.txt -U -q uv sync --group dev - pip list + uv pip list - name: Tests timeout-minutes: 15 From 47b99651e7e854550258b3308469114312ab97d7 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 14:14:25 +0200 Subject: [PATCH 37/43] cat requirements.txt --- .github/workflows/ci-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 283c6186..fe514f96 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -44,6 +44,7 @@ jobs: run: | uv pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' + cat requirements.txt - name: Install package run: | From e0689298e3443b34a40677ac760cd11691b1ad2d Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 19:27:47 +0530 Subject: [PATCH 38/43] list before and after --- .github/workflows/ci-testing.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index fe514f96..4df3f7f1 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -49,6 +49,7 @@ jobs: - name: Install package run: | uv pip install -r requirements.txt -U -q + uv pip list uv sync --group dev uv pip list From 37ae942cc765a694a21beb188409c662d92ab5bb Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:39:17 +0200 Subject: [PATCH 39/43] echo --- .github/workflows/ci-testing.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 4df3f7f1..db247c59 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -44,7 +44,9 @@ jobs: run: | uv pip install 'lightning-utilities[cli]' uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' + echo "======requirements.txt======" cat requirements.txt + echo "----------------------------" - name: Install package run: | From f4c4e786fa4180534d72debd7026ab6d842e60bc Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:44:36 +0200 Subject: [PATCH 40/43] echo --- .github/workflows/ci-testing.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index db247c59..15a6fbc3 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -37,7 +37,11 @@ jobs: enable-cache: true - name: Set up dependencies - run: uv pip compile pyproject.toml -o requirements.txt + run: | + uv pip compile pyproject.toml -o requirements.txt + echo "======requirements.txt======" + cat requirements.txt + echo "----------------------------" - name: Set min. dependencies if: matrix.requires == 'oldest' From fd8e8049e07974ee02b55cf5d961a81b42d6cb33 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 20:23:02 +0530 Subject: [PATCH 41/43] remove min dep --- .github/workflows/ci-testing.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 15a6fbc3..993d2cc0 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -39,24 +39,20 @@ jobs: - name: Set up dependencies run: | uv pip compile pyproject.toml -o requirements.txt - echo "======requirements.txt======" cat requirements.txt - echo "----------------------------" - - name: Set min. dependencies - if: matrix.requires == 'oldest' - run: | - uv pip install 'lightning-utilities[cli]' - uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' - echo "======requirements.txt======" - cat requirements.txt - echo "----------------------------" + # TODO: FIX THIS TO SUPPORT PYPROJECT.TOML + # - name: Set min. dependencies + # if: matrix.requires == 'oldest' + # run: | + # uv pip install 'lightning-utilities[cli]' + # uv run python -m lightning_utilities.cli requirements set-oldest --req_files='["requirements.txt"]' + # cat requirements.txt - name: Install package run: | - uv pip install -r requirements.txt -U -q uv pip list - uv sync --group dev + uv sync --all-extras --dev uv pip list - name: Tests From 3e249a66bbbb6e20204d17e83eb58e0c5d929c7e Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:56:42 +0200 Subject: [PATCH 42/43] Update ci-testing.yml --- .github/workflows/ci-testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 993d2cc0..3e0de048 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -21,7 +21,7 @@ jobs: include: - { os: "macos-latest", python-version: "3.12" } - { os: "windows-latest", python-version: "3.11" } - - { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest" } + #- { os: "ubuntu-22.04", python-version: "3.9", requires: "oldest" } # fixme timeout-minutes: 35 env: From d49312d67f15d845ae7e20ad210c4206002a0f13 Mon Sep 17 00:00:00 2001 From: Aniket Maurya Date: Wed, 9 Jul 2025 20:56:19 +0530 Subject: [PATCH 43/43] fixes --- tests/unit/test_readme.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_readme.py b/tests/unit/test_readme.py index 7060829d..64fa80c2 100644 --- a/tests/unit/test_readme.py +++ b/tests/unit/test_readme.py @@ -52,7 +52,7 @@ def run_script_with_timeout(file, timeout, extra_time, killall): sel = selectors.DefaultSelector() try: process = subprocess.Popen( - ["python", str(file)], + [sys.executable, str(file)], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=1, # Line-buffered