Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI/Build] migrate static project metadata from setup.py to pyproject.toml #8772

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dtrifiro
Copy link
Contributor

@dtrifiro dtrifiro commented Sep 24, 2024

Static metadata can be moved to pyproject.toml and removed from setup.py

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@youkaichao
Copy link
Member

how does this affect the build process of ci, which uses python setup.py ?

@dtrifiro dtrifiro force-pushed the pyproject-migration branch 4 times, most recently from aea82c9 to f0a9bc0 Compare October 10, 2024 13:21
@dtrifiro
Copy link
Contributor Author

@youkaichao It should not. This is just moving static metadata from setup.py to pyproject.toml

Building wheels from this branch and main and looking at metadata doesn't show any difference:

gh pr checkout 8772
VLLM_TARGET_DEVICE=empty python setup.py bdist_wheel
# ^ creates `vllm-0.6.3.dev157+ge3bef869f.empty-py3-none-any.whl`
git checkout main
VLLM_TARGET_DEVICE=empty python setup.py bdist_wheel
# ^ creates `vllm-0.6.3.dev156+g07c11cf4d.empty-py3-none-any.whl`

# you can verify the wheel's generated metadata files:
ls **/*dist-info

Outputs:

vllm-0.6.3.dev156+g07c11cf4d.empty-py3-none-any/vllm-0.6.3.dev156+g07c11cf4d.empty.dist-info:
entry_points.txt
LICENSE
METADATA
RECORD
top_level.txt
WHEEL

vllm-0.6.3.dev157+ge3bef869f.empty-py3-none-any/vllm-0.6.3.dev157+ge3bef869f.empty.dist-info:
entry_points.txt
LICENSE
METADATA
RECORD
top_level.txt
WHEEL

You can compare files, and they're identical (except for the extra embedded license in METADATA in the dev157 build, which is this one)

@hmellor
Copy link
Collaborator

hmellor commented Jan 15, 2025

@dtrifiro do you plan to update this PR? It seems like a nice step towards removing setup.py

@dtrifiro
Copy link
Contributor Author

@hmellor we will not be able to remove setup.py as we heavily rely on a custom build process. This PR aimed to move static metadata to pyproject.toml rather then remove setup.py entirely

@dtrifiro dtrifiro force-pushed the pyproject-migration branch 2 times, most recently from b891f26 to 34d60b6 Compare January 31, 2025 12:16
@mergify mergify bot added the ci/build label Jan 31, 2025
@dtrifiro dtrifiro force-pushed the pyproject-migration branch from 34d60b6 to 8380754 Compare January 31, 2025 12:23
# version_file = "vllm/_version.py" # currently handled by `setup.py:get_version()`
version_file = "vllm/_version.py"

[tool.setuptools.packages.find]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing find_packages() from setup.py and relying on autodiscovery results in a minor change in the final wheel:

A few extra files are included as part of the build:

--- layout_old.txt      2025-01-31 13:23:54.772311579 +0100
+++ layout_new.txt      2025-01-31 13:23:59.458978135 +0100
@@ -117,9 +117,7 @@
 vllm/distributed/device_communicators/tpu_communicator.py
 vllm/distributed/device_communicators/xpu_communicator.py
 vllm/distributed/kv_transfer
-vllm/distributed/kv_transfer/README.md
 vllm/distributed/kv_transfer/__init__.py
-vllm/distributed/kv_transfer/disagg_prefill_workflow.jpg
 vllm/distributed/kv_transfer/kv_transfer_agent.py
 vllm/distributed/kv_transfer/kv_connector
 vllm/distributed/kv_transfer/kv_connector/__init__.py
@@ -334,7 +332,6 @@
 vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3,dtype=fp8_w8a8.json
 vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_H100_80GB_HBM3.json
 vllm/model_executor/layers/fused_moe/configs/E=8,N=3584,device_name=NVIDIA_L40S.json
-vllm/model_executor/layers/fused_moe/configs/README
 vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X,dtype=fp8_w8a8.json
 vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=AMD_Instinct_MI300X.json
 vllm/model_executor/layers/fused_moe/configs/E=8,N=4096,device_name=NVIDIA_A100-SXM4-80GB.json
@@ -696,7 +693,6 @@
 vllm/v1/worker/gpu_model_runner.py
 vllm/v1/worker/gpu_worker.py
 vllm/vllm_flash_attn
-vllm/vllm_flash_attn/.gitkeep
 vllm/vllm_flash_attn/__init__.py
 vllm/vllm_flash_attn/flash_attn_interface.py
 vllm/worker

To check what is included in each wheel (using the CPU build to speed up the process):

export VLLM_TARGET_DEVICE=cpu UV_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu UV_INDEX_STRATEGY="unsafe-best-match" VLLM_CPU_DISABLE_AVX512=true

python -m build --wheel --installer=uv
cd dist
unzip -l vllm*whl

@dtrifiro dtrifiro changed the title [CI/Build] migrate project metadata from setup.py to pyproject.toml [CI/Build] migrate static project metadata from setup.py to pyproject.toml Jan 31, 2025
Copy link
Collaborator

@simon-mo simon-mo left a comment

Choose a reason for hiding this comment

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

Please leave a note in the setup.py's setup function invocation telling developers to add things to pyproject.toml if it is static.

@dtrifiro dtrifiro force-pushed the pyproject-migration branch from 8380754 to d80220b Compare February 4, 2025 10:49
@dtrifiro
Copy link
Contributor Author

dtrifiro commented Feb 4, 2025

@simon-mo done.

Some requirements (optional requirements groups) are currently static but I left them in pyproject.yoml regardless for consistency, maybe this could be worth revisiting after #7525 is merged

Signed-off-by: Daniele Trifirò <dtrifiro@redhat.com>
@dtrifiro
Copy link
Contributor Author

dtrifiro commented Feb 5, 2025

Build failures look unrelated

@dtrifiro
Copy link
Contributor Author

dtrifiro commented Feb 7, 2025

@simon-mo can we merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants