Skip to content

Support Python 3.10#35

Open
BaoYunkai wants to merge 1 commit into
amd:release/0.12from
BaoYunkai:bugfix/yunkai/py310-compat
Open

Support Python 3.10#35
BaoYunkai wants to merge 1 commit into
amd:release/0.12from
BaoYunkai:bugfix/yunkai/py310-compat

Conversation

@BaoYunkai

Copy link
Copy Markdown

Summary

Quark 0.12 declares requires-python = ">=3.11,<3.14", but the only Python
3.11-specific features used in the codebase are two symbols that have drop-in
3.10 equivalents. This PR lowers the supported floor to Python 3.10 so Quark
installs and runs on 3.10 environments (e.g. venvs shipping a torch / serving
stack pinned to 3.10).

Changes

  • quark/torch/quantization/nn/modules/quantize_conv_bn_fused.py: import
    Self from typing_extensions instead of typing (typing.Self is 3.11+).
    This module is imported on the Torch quantization path via
    quark.torch.quantization.nn.modules.__init__, so it broke import on 3.10.
  • quark/contrib/llm_eval/experiment_report.py: replace datetime.UTC (3.11+)
    with datetime.timezone.utc.
  • pyproject.toml / setup.py: lower requires-python / python_requires
    floor from 3.11 to 3.10 and add the Python :: 3.10 classifier.

Verification

On Python 3.10.12:

  • Before: from quark.torch.quantization.nn.modules import QuantizedConvBatchNorm2d
    raised ImportError: cannot import name 'Self' from 'typing'.
  • After: from quark.torch import ModelQuantizer and the ONNX export API import
    cleanly, and the C++ kernel extension builds/loads (gfx942/gfx950).

Test plan

  • CI green on 3.10 / 3.11 / 3.12 / 3.13
  • pip install -e . succeeds on a Python 3.10 venv
  • Torch PTQ smoke on 3.10

Quark 0.12 declared Python >=3.11 but only used two 3.11-only symbols,
which have drop-in 3.10 equivalents:

- `typing.Self` -> import from `typing_extensions` (already a dependency).
- `datetime.UTC` -> `datetime.timezone.utc`.

Lower the floor to Python 3.10 in `pyproject.toml` / `setup.py` and add the
3.10 classifier so Quark installs and runs on 3.10 environments (e.g. venvs
that ship torch/other stacks pinned to 3.10).
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.

1 participant