Skip to content

refactor: migrate project metadata to pyproject.toml (PEP 621)#2441

Closed
NJX-njx wants to merge 1 commit intovllm-project:mainfrom
NJX-njx:refactor/pep621-packaging-modernize
Closed

refactor: migrate project metadata to pyproject.toml (PEP 621)#2441
NJX-njx wants to merge 1 commit intovllm-project:mainfrom
NJX-njx:refactor/pep621-packaging-modernize

Conversation

@NJX-njx
Copy link

@NJX-njx NJX-njx commented Mar 4, 2026

Summary

Migrates all static project metadata from setup.py to pyproject.toml, complying with PEP 518, PEP 621, and PEP 639. The package is now installable with both pip and uv.

Closes #1966

Changes

Moved to pyproject.toml (PEP 621)

  • name, description, readme, license (SPDX expression: Apache-2.0)
  • authors, keywords, classifiers, requires-python
  • urls (Homepage, Repository, Issues, Documentation)
  • dependencies — lower-bound-only specifiers for dev/nightly builds
  • optional-dependencies[dev] and [qwen] extras
  • scripts — console entry points
  • [tool.setuptools.packages.find] — replaces find_packages() call
  • [tool.setuptools_scm]version_file config

Retained in setup.py

  • setuptools_scm version/local scheme functions (required for BUILD_TYPE-dependent nightly/release versioning)
  • _RELEASE_OVERRIDES dictionary — upper-bound dependency pins applied only when BUILD_TYPE=release
  • Returns None for install_requires in dev/nightly mode, letting pyproject.toml dependencies take effect

Installation

# pip (unchanged)
pip install -e ".[dev]"

# uv (now supported)
uv pip install -e ".[dev]"

Backward Compatibility

  • setup.py is preserved for the release build pipeline (BUILD_TYPE=release)
  • No changes to CI/CD workflows required — existing pip install commands continue to work
  • MANIFEST.in remains unchanged

Move all static project metadata from setup.py to pyproject.toml:
- name, description, readme, license (SPDX), authors, keywords
- classifiers, requires-python, urls
- dependencies (lower-bound-only for dev/nightly builds)
- optional-dependencies (dev, qwen)
- console_scripts entry points
- setuptools package discovery config

The setup.py is retained as a thin wrapper for:
- setuptools_scm version computation (version_scheme, local_scheme)
- BUILD_TYPE-dependent upper-bound dependency pins for release builds

This modernizes the packaging to comply with:
- PEP 518 (build-system requirements)
- PEP 621 (project metadata in pyproject.toml)
- PEP 639 (license expression)

The package is now installable with both pip and uv:
  pip install -e .[dev]
  uv pip install -e .[dev]

Closes vllm-project#1966
Copilot AI review requested due to automatic review settings March 4, 2026 11:38
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the project's packaging configuration by migrating static project metadata from setup.py to pyproject.toml, aligning with current Python packaging standards (PEP 621). This change centralizes project configuration, improves maintainability, and expands compatibility with modern package managers like uv, while carefully preserving existing build pipeline logic for versioning and release-specific dependency management.

Highlights

  • Project Metadata Migration: Static project metadata, including name, description, license, authors, keywords, classifiers, Python requirements, URLs, dependencies, optional dependencies, and console scripts, has been moved from setup.py to pyproject.toml in compliance with PEP 621.
  • setup.py Simplification: The setup.py file has been significantly streamlined, now primarily retaining logic for setuptools_scm version computation and conditional dependency pinning for release/nightly builds, while deferring to pyproject.toml for general dependencies.
  • Enhanced Installation Support: The package is now fully installable using uv in addition to pip, providing more flexibility for dependency management.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • pyproject.toml
    • Updated setuptools requirement in build-system.
    • Added [project] table with name, dynamic, description, readme, license, requires-python, authors, keywords, and classifiers.
    • Included [project.dependencies] with a comprehensive list of runtime dependencies.
    • Defined [project.optional-dependencies] for dev and qwen extras.
    • Specified [project.urls] for homepage, repository, issues, and documentation.
    • Configured [project.scripts] for console entry points.
    • Added [tool.setuptools.packages.find] for package discovery.
    • Configured [tool.setuptools_scm] to specify version_file.
  • setup.py
    • Added a comprehensive docstring explaining its reduced role.
    • Removed find_packages import and call.
    • Removed name, author, description, long_description, keywords, license, url, include_package_data, package_dir, packages, extras_require, entry_points, python_requires, and classifiers arguments from the setup() call.
    • Simplified version_func and localversion_func by removing verbose print statements and comments.
    • Introduced _RELEASE_OVERRIDES dictionary to define release-specific dependency pins.
    • Added _build_install_requires function to conditionally return release overrides or None (to use pyproject.toml dependencies).
    • Modified setup() to only include use_scm_version and install_requires=_build_install_requires().
Activity
  • No activity (comments, reviews, progress) was found in the provided context.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully migrates the project metadata from setup.py to pyproject.toml in compliance with PEP 621, significantly streamlining the project configuration. The setup.py has been refactored to handle only version computation and conditional dependency pinning for different build types, which is a clean separation of concerns. The new pyproject.toml correctly defines project metadata, dependencies, optional dependencies, URLs, and scripts.

# ---------------------------------------------------------------------------

[tool.mypy]
files = "src/guidellm"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The [tool.mypy] configuration still points to src/guidellm. This appears to be a leftover from a previous project or a typo. It should be updated to src/llmcompressor to correctly apply type checking to the current project's source code.

Suggested change
files = "src/guidellm"
files = "src/llmcompressor"

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates Python package metadata from setup.py to pyproject.toml per PEP 621, keeping a thin setup.py for setuptools_scm-based versioning and release-only dependency pinning.

Changes:

  • Moved static metadata (name/description/classifiers/deps/extras/scripts) into pyproject.toml.
  • Simplified setup.py to only handle SCM versioning and release dependency overrides.
  • Added setuptools configuration for package discovery and setuptools_scm version file generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
setup.py Removes static metadata and introduces release-only dependency override logic.
pyproject.toml Adds PEP 621 metadata, dependencies/extras, scripts, and setuptools tool configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +77 to +97
_RELEASE_OVERRIDES: dict[str, str] = {
"loguru": "loguru>=0.7.2,<=0.7.3",
"pyyaml": "pyyaml>=6.0.1,<=6.0.3",
"numpy": "numpy>=2.0.0,<=2.4.2",
"requests": "requests>=2.32.2,<=2.32.5",
"tqdm": "tqdm>=4.66.3,<=4.67.3",
"torch": "torch>=2.9.0,<=2.10.0",
"datasets": "datasets>=4.0.0,<=4.6.0",
"auto-round": "auto-round>=0.9.6,<=0.10.2",
"accelerate": "accelerate>=1.6.0,<=1.12.0",
"nvidia-ml-py": "nvidia-ml-py>=12.560.30,<=13.590.48",
"pillow": "pillow>=10.4.0,<=12.1.1",
"compressed-tensors": "compressed-tensors==0.14.0",
}


def _build_install_requires() -> list[str] | None:
"""Return overridden deps for release builds; None otherwise."""
if BUILD_TYPE != "release":
return None # fall back to pyproject.toml dependencies
return list(_RELEASE_OVERRIDES.values())
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BUILD_TYPE=release currently sets install_requires to only _RELEASE_OVERRIDES.values(), which drops any dependencies not present in that dict (e.g., transformers is in pyproject.toml but not in _RELEASE_OVERRIDES). This will produce incomplete runtime requirements for release builds. Consider building install_requires from the full base dependency set and then applying upper-bound overrides (or ensure _RELEASE_OVERRIDES covers all core dependencies that must be installed in release mode).

Copilot uses AI. Check for mistakes.
quick experimentation.\
"""
readme = { file = "README.md", content-type = "text/markdown" }
license = "Apache-2.0"
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In PEP 621, project.license is typically a table ({text=...} or {file=...}), and SPDX expressions are standardized via PEP 639 using license-expression. If the intent is an SPDX identifier/expression, prefer license-expression = \"Apache-2.0\" (and optionally license-files) to avoid tooling/build metadata validation issues.

Suggested change
license = "Apache-2.0"
license-expression = "Apache-2.0"

Copilot uses AI. Check for mistakes.
"""

import os
import sys
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys is imported but no longer used after removing the debug print(...) block. Removing the unused import will avoid lint noise and keep the thin setup.py focused.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +45
classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"Operating System :: POSIX :: Linux",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
]
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous setup.py classifiers included a license Trove classifier (License :: OSI Approved :: Apache Software License), but it’s missing from the migrated list. If you still want that metadata on PyPI, add the license classifier back under project.classifiers.

Copilot uses AI. Check for mistakes.
@dsikka dsikka closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Modernize packaging: add support for uv + PEP518 + PEP621

3 participants