Skip to content

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
Member

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
pyproject.toml Outdated
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

@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?

Copy link

mergify bot commented Feb 17, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @dtrifiro.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Feb 17, 2025
@NickLucche
Copy link
Collaborator

setup.py starting to look a bit cleaner already, thanks!

@dtrifiro dtrifiro force-pushed the pyproject-migration branch from d80220b to 2476f28 Compare February 17, 2025 14:03
@mergify mergify bot removed the needs-rebase label Feb 17, 2025
@dtrifiro
Copy link
Contributor Author

@simon-mo sorry to ping you again, but could we merge this?

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 18, 2025 10:44
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 18, 2025
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 18, 2025 10:45
@simon-mo simon-mo merged commit a02c86b into vllm-project:main Feb 18, 2025
79 of 84 checks passed
@youkaichao
Copy link
Member

QQ: when we use python setup.py , will pyproject.toml still be read?

I'm thinking about this line:

vllm/Dockerfile

Line 115 in a02c86b

&& python3 setup.py bdist_wheel --dist-dir=dist --py-limited-api=cp38 \

@youkaichao
Copy link
Member

cc @dtrifiro

@dtrifiro
Copy link
Contributor Author

@youkaichao yes.

@dtrifiro dtrifiro deleted the pyproject-migration branch February 18, 2025 16:36
xjpang pushed a commit to xjpang/vllm that referenced this pull request Feb 20, 2025
lulmer pushed a commit to lulmer/vllm that referenced this pull request Apr 7, 2025
shreyankg pushed a commit to shreyankg/vllm that referenced this pull request May 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants