refactor: migrate project metadata to pyproject.toml (PEP 621)#2441
refactor: migrate project metadata to pyproject.toml (PEP 621)#2441NJX-njx wants to merge 1 commit intovllm-project:mainfrom
Conversation
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
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
👋 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. |
Summary of ChangesHello, 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
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
| files = "src/guidellm" | |
| files = "src/llmcompressor" |
There was a problem hiding this comment.
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.pyto only handle SCM versioning and release dependency overrides. - Added setuptools configuration for package discovery and
setuptools_scmversion 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.
| _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()) |
There was a problem hiding this comment.
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).
| quick experimentation.\ | ||
| """ | ||
| readme = { file = "README.md", content-type = "text/markdown" } | ||
| license = "Apache-2.0" |
There was a problem hiding this comment.
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.
| license = "Apache-2.0" | |
| license-expression = "Apache-2.0" |
| """ | ||
|
|
||
| import os | ||
| import sys |
There was a problem hiding this comment.
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.
| 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", | ||
| ] |
There was a problem hiding this comment.
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.
Summary
Migrates all static project metadata from
setup.pytopyproject.toml, complying with PEP 518, PEP 621, and PEP 639. The package is now installable with bothpipanduv.Closes #1966
Changes
Moved to
pyproject.toml(PEP 621)name,description,readme,license(SPDX expression:Apache-2.0)authors,keywords,classifiers,requires-pythonurls(Homepage, Repository, Issues, Documentation)dependencies— lower-bound-only specifiers for dev/nightly buildsoptional-dependencies—[dev]and[qwen]extrasscripts— console entry points[tool.setuptools.packages.find]— replacesfind_packages()call[tool.setuptools_scm]—version_fileconfigRetained in
setup.pysetuptools_scmversion/local scheme functions (required forBUILD_TYPE-dependent nightly/release versioning)_RELEASE_OVERRIDESdictionary — upper-bound dependency pins applied only whenBUILD_TYPE=releaseNoneforinstall_requiresin dev/nightly mode, lettingpyproject.tomldependencies take effectInstallation
Backward Compatibility
setup.pyis preserved for the release build pipeline (BUILD_TYPE=release)pip installcommands continue to workMANIFEST.inremains unchanged