-
Notifications
You must be signed in to change notification settings - Fork 195
Bump: Min python version to 3.9 #1288
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
Conversation
Signed-off-by: Rahul Tuli <[email protected]>
👋 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you had this in another PR right? are we getting this in first before the other lands?
You are correct; the Python version upgrade has been broken out from that PR into its own separate diff here (the description on that diff was also updated accordingly). Both the diffs can land in any order they don't depend on each other! |
This PR resolves [Issue #1250](#1250), where the codebase relied on Python 3.10+ syntax for multiple context managers in a single `with` statement (using parentheses). This syntax is not supported in Python 3.9, causing compatibility issues. To address this, ~we introduce a new `multi_context` utility that leverages `contextlib.ExitStack` to provide a clean and safe workaround for managing multiple context managers across all supported Python versions.~ we use native Python line continuation either by using backslashes or by leveraging line continuation support for function calls. This is a little uglier that using the multi_context util IMO, but protects us from adding extra functionality which we would have to maintain ~Additionally, this PR updates the minimum Python version requirement from 3.8 to 3.9 in `setup.py`. Python 3.8 reached its end-of-life (EOL) on October 14, 2024, and is no longer receiving security updates or bug fixes. Aligning with the broader ecosystem, the [vLLM project](https://github.com/vllm-project/vllm/blob/27df5199d99627e1eb101071c2155f888181bd64/pyproject.toml#L22) also requires Python 3.9+, making this a natural step to ensure compatibility and maintainability.~ This will be added in a separate PR #1288 ### Changes 1. ~**Added `multi_context` Utility**~ This has been removed as per offline discussion and native python3.9 syntax has been used, using backlashes and/or leveraging line continuation with python function calling syntax - ~Implemented in `src/llmcompressor/utils/helpers.py` as a context manager that supports multiple contexts using `contextlib.ExitStack`.~ - ~Provides a clean syntax for Python 3.9 compatibility while preserving functionality in Python 3.10+.~ - ~Example usage:~ ```python with multi_context(ctx1(), ctx2()) as [cm1, cm2]: ``` 2. **Refactored Affected Modules** - Updated `src/llmcompressor/modifiers/obcq/base.py`, `src/llmcompressor/modifiers/pruning/wanda/base.py`, `src/llmcompressor/modifiers/quantization/gptq/base.py`, `src/llmcompressor/pipelines/sequential/helpers.py`, and `src/llmcompressor/utils/helpers.py` - Modified `tests/llmcompressor/modifiers/utils/test_hooks.py` 3. ~**Bumped Minimum Python Version**~ As per offline discussion this will be added in a separate PR #1288 - ~Changed `python_requires=">=3.8"` to `python_requires=">=3.9"` in `setup.py` to reflect the new minimum supported version.~ ### Testing - Verified that all modified modules run correctly under Python 3.9 and 3.10. - Ran the updated test suite (`test_hooks.py`) to confirm hook disabling behavior remains intact. - Confirmed no regressions in sparsification, quantization, or tracing pipelines. ### Related Issues - Fixes [#1250](#1250) --------- Signed-off-by: Rahul Tuli <[email protected]>
This PR updates the minimum Python version requirement from 3.8 to 3.9 in
setup.py
. Python 3.8 reached its end-of-life (EOL) on October 14, 2024, and is no longer receiving security updates or bug fixes. Aligning with the broader ecosystem, the vLLM project also requires Python 3.9+,